diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e9721dd..d767459 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,10 +12,10 @@ jobs: steps: - name: Check out code uses: actions/checkout@v2 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v1 with: - java-version: 11 + java-version: 17 # Base64 decodes and pipes the GPG key content into the secret file - name: Prepare environment env: @@ -35,7 +35,7 @@ jobs: # Runs upload, and then closes & releases the repository - name: Publish Release Version to MavenCentral run: | - if ${{ endswith(github.event.release.tag_name, '-SNAPSHOT') }}; then + if ${{ contains(github.event.release.tag_name, '-rc') }}; then echo "Publising Snapshot Version ${{ github.event.release.tag_name}} to Snapshot repository" ./gradlew publishToSonatype else diff --git a/LICENSE.md b/LICENSE.md index 47cfdfb..5479bb8 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Copyright (c) 2023 Appwrite (https://appwrite.io) and individual contributors. +Copyright (c) 2024 Appwrite (https://appwrite.io) and individual contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/README.md b/README.md index c611a49..6e62098 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,17 @@ ![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.4.12-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.5.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.4.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.5.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) Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Kotlin SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) -![Appwrite](https://appwrite.io/images/github.png) +![Appwrite](https://github.com/appwrite/appwrite/raw/main/public/images/github.png) ## Installation @@ -39,7 +39,7 @@ repositories { Next, add the dependency to your project's `build.gradle(.kts)` file: ```groovy -implementation("io.appwrite:sdk-for-kotlin:4.1.0") +implementation("io.appwrite:sdk-for-kotlin:5.0.0") ``` ### Maven @@ -50,7 +50,7 @@ Add this to your project's `pom.xml` file: io.appwrite sdk-for-kotlin - 4.1.0 + 5.0.0 ``` @@ -84,7 +84,9 @@ val users = Users(client) val user = users.create( user = ID.unique(), email = "email@example.com", + phone = "+123456789", password = "password", + name = "Walter O'Brien" ) ``` @@ -106,7 +108,9 @@ suspend fun main() { val user = users.create( user = ID.unique(), email = "email@example.com", + phone = "+123456789", password = "password", + name = "Walter O'Brien" ) } ``` @@ -126,7 +130,9 @@ suspend fun main() { val user = users.create( user = ID.unique(), email = "email@example.com", + phone = "+123456789", password = "password", + name = "Walter O'Brien" ) } catch (e: AppwriteException) { e.printStackTrace() diff --git a/build.gradle b/build.gradle index 181fbfb..ac355f3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { - id "org.jetbrains.kotlin.jvm" version '1.8.0' + id "org.jetbrains.kotlin.jvm" version '1.9.10' id "java-library" - id "io.github.gradle-nexus.publish-plugin" version "1.1.0" + id "io.github.gradle-nexus.publish-plugin" version "1.3.0" } apply from: "${rootDir}/scripts/configure.gradle" @@ -29,14 +29,16 @@ repositories { } dependencies { - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0") - api(platform("com.squareup.okhttp3:okhttp-bom:4.9.3")) + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1") + + api(platform("com.squareup.okhttp3:okhttp-bom:4.12.0")) api("com.squareup.okhttp3:okhttp") + implementation("com.squareup.okhttp3:okhttp-urlconnection") implementation("com.squareup.okhttp3:logging-interceptor") implementation("com.google.code.gson:gson:2.9.0") - testImplementation 'org.jetbrains.kotlin:kotlin-test-junit' + testImplementation("org.jetbrains.kotlin:kotlin-test-junit") } test { diff --git a/docs/examples/java/account/create-anonymous-session.md b/docs/examples/java/account/create-anonymous-session.md new file mode 100644 index 0000000..ba83373 --- /dev/null +++ b/docs/examples/java/account/create-anonymous-session.md @@ -0,0 +1,18 @@ +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("5df5acd0d48c2"); // Your project ID + +Account account = new Account(client); + +account.createAnonymousSession(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/java/account/create-email-password-session.md b/docs/examples/java/account/create-email-password-session.md new file mode 100644 index 0000000..0af4269 --- /dev/null +++ b/docs/examples/java/account/create-email-password-session.md @@ -0,0 +1,23 @@ +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("5df5acd0d48c2"); // Your project ID + +Account account = new Account(client); + +account.createEmailPasswordSession( + "email@example.com", // email + "password", // password + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/account/create-email-token.md b/docs/examples/java/account/create-email-token.md new file mode 100644 index 0000000..040b59b --- /dev/null +++ b/docs/examples/java/account/create-email-token.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("5df5acd0d48c2"); // Your project ID + +Account account = new Account(client); + +account.createEmailToken( + "", // userId + "email@example.com", // email + false, // phrase (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/account/create-j-w-t.md b/docs/examples/java/account/create-j-w-t.md new file mode 100644 index 0000000..1e223e4 --- /dev/null +++ b/docs/examples/java/account/create-j-w-t.md @@ -0,0 +1,18 @@ +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("5df5acd0d48c2"); // Your project ID + +Account account = new Account(client); + +account.createJWT(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/java/account/create-magic-u-r-l-token.md b/docs/examples/java/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000..71a318c --- /dev/null +++ b/docs/examples/java/account/create-magic-u-r-l-token.md @@ -0,0 +1,25 @@ +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("5df5acd0d48c2"); // Your project ID + +Account account = new Account(client); + +account.createMagicURLToken( + "", // userId + "email@example.com", // email + "https://example.com", // url (optional) + false, // phrase (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/account/create-mfa-authenticator.md b/docs/examples/java/account/create-mfa-authenticator.md new file mode 100644 index 0000000..9cf177f --- /dev/null +++ b/docs/examples/java/account/create-mfa-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("5df5acd0d48c2") // 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-mfa-challenge.md b/docs/examples/java/account/create-mfa-challenge.md new file mode 100644 index 0000000..6a3d9ce --- /dev/null +++ b/docs/examples/java/account/create-mfa-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("5df5acd0d48c2"); // 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-mfa-recovery-codes.md b/docs/examples/java/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000..6a9342d --- /dev/null +++ b/docs/examples/java/account/create-mfa-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("5df5acd0d48c2") // 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/create-o-auth2token.md b/docs/examples/java/account/create-o-auth2token.md new file mode 100644 index 0000000..4c92629 --- /dev/null +++ b/docs/examples/java/account/create-o-auth2token.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; +import io.appwrite.enums.OAuthProvider; + +Client client = new Client() + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2"); // Your project ID + +Account account = new Account(client); + +account.createOAuth2Token( + OAuthProvider.AMAZON, // provider + "https://example.com", // success (optional) + "https://example.com", // failure (optional) + listOf(), // scopes (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/account/create-phone-token.md b/docs/examples/java/account/create-phone-token.md new file mode 100644 index 0000000..022eaa4 --- /dev/null +++ b/docs/examples/java/account/create-phone-token.md @@ -0,0 +1,23 @@ +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("5df5acd0d48c2"); // Your project ID + +Account account = new Account(client); + +account.createPhoneToken( + "", // userId + "+12065550100", // phone + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/account/create-phone-verification.md b/docs/examples/java/account/create-phone-verification.md index 013b357..bfe3722 100644 --- a/docs/examples/java/account/create-phone-verification.md +++ b/docs/examples/java/account/create-phone-verification.md @@ -5,7 +5,7 @@ import io.appwrite.services.Account; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Account account = new Account(client); diff --git a/docs/examples/java/account/create-recovery.md b/docs/examples/java/account/create-recovery.md index 284efc8..590fee3 100644 --- a/docs/examples/java/account/create-recovery.md +++ b/docs/examples/java/account/create-recovery.md @@ -5,13 +5,13 @@ import io.appwrite.services.Account; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Account account = new Account(client); account.createRecovery( - "email@example.com", - "https://example.com" + "email@example.com", // email + "https://example.com", // url new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ account.createRecovery( System.out.println(result); }) ); + diff --git a/docs/examples/java/account/create-session.md b/docs/examples/java/account/create-session.md new file mode 100644 index 0000000..0a9606e --- /dev/null +++ b/docs/examples/java/account/create-session.md @@ -0,0 +1,23 @@ +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("5df5acd0d48c2"); // Your project ID + +Account account = new Account(client); + +account.createSession( + "", // userId + "", // secret + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/account/create-verification.md b/docs/examples/java/account/create-verification.md index 0280b4b..d38067b 100644 --- a/docs/examples/java/account/create-verification.md +++ b/docs/examples/java/account/create-verification.md @@ -5,12 +5,12 @@ import io.appwrite.services.Account; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Account account = new Account(client); account.createVerification( - "https://example.com" + "https://example.com", // url new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ account.createVerification( System.out.println(result); }) ); + diff --git a/docs/examples/java/account/create.md b/docs/examples/java/account/create.md new file mode 100644 index 0000000..f0d3a51 --- /dev/null +++ b/docs/examples/java/account/create.md @@ -0,0 +1,25 @@ +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("5df5acd0d48c2"); // Your project ID + +Account account = new Account(client); + +account.create( + "", // userId + "email@example.com", // email + "", // password + "", // name (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/account/delete-identity.md b/docs/examples/java/account/delete-identity.md index 54bad5a..9417083 100644 --- a/docs/examples/java/account/delete-identity.md +++ b/docs/examples/java/account/delete-identity.md @@ -5,12 +5,12 @@ import io.appwrite.services.Account; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Account account = new Account(client); account.deleteIdentity( - "[IDENTITY_ID]" + "", // identityId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ account.deleteIdentity( System.out.println(result); }) ); + diff --git a/docs/examples/java/account/delete-mfa-authenticator.md b/docs/examples/java/account/delete-mfa-authenticator.md new file mode 100644 index 0000000..c335161 --- /dev/null +++ b/docs/examples/java/account/delete-mfa-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("5df5acd0d48c2") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.deleteMfaAuthenticator( + 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/delete-session.md b/docs/examples/java/account/delete-session.md index 2cd069e..b77ac28 100644 --- a/docs/examples/java/account/delete-session.md +++ b/docs/examples/java/account/delete-session.md @@ -5,12 +5,12 @@ import io.appwrite.services.Account; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Account account = new Account(client); account.deleteSession( - "[SESSION_ID]" + "", // sessionId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ account.deleteSession( System.out.println(result); }) ); + diff --git a/docs/examples/java/account/delete-sessions.md b/docs/examples/java/account/delete-sessions.md index 7a9999d..80103a4 100644 --- a/docs/examples/java/account/delete-sessions.md +++ b/docs/examples/java/account/delete-sessions.md @@ -5,7 +5,7 @@ import io.appwrite.services.Account; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Account account = new Account(client); diff --git a/docs/examples/java/account/get-mfa-recovery-codes.md b/docs/examples/java/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000..7298699 --- /dev/null +++ b/docs/examples/java/account/get-mfa-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("5df5acd0d48c2") // 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/get-prefs.md b/docs/examples/java/account/get-prefs.md index 3f6cd20..fd05e63 100644 --- a/docs/examples/java/account/get-prefs.md +++ b/docs/examples/java/account/get-prefs.md @@ -5,7 +5,7 @@ import io.appwrite.services.Account; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Account account = new Account(client); diff --git a/docs/examples/java/account/get-session.md b/docs/examples/java/account/get-session.md index 17229e2..60c4312 100644 --- a/docs/examples/java/account/get-session.md +++ b/docs/examples/java/account/get-session.md @@ -5,12 +5,12 @@ import io.appwrite.services.Account; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Account account = new Account(client); account.getSession( - "[SESSION_ID]" + "", // sessionId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ account.getSession( System.out.println(result); }) ); + diff --git a/docs/examples/java/account/get.md b/docs/examples/java/account/get.md index 80a4988..f492881 100644 --- a/docs/examples/java/account/get.md +++ b/docs/examples/java/account/get.md @@ -5,7 +5,7 @@ import io.appwrite.services.Account; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Account account = new Account(client); diff --git a/docs/examples/java/account/list-identities.md b/docs/examples/java/account/list-identities.md index d6fcb68..4b07399 100644 --- a/docs/examples/java/account/list-identities.md +++ b/docs/examples/java/account/list-identities.md @@ -5,11 +5,12 @@ import io.appwrite.services.Account; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Account account = new Account(client); account.listIdentities( + listOf(), // queries (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -19,3 +20,4 @@ account.listIdentities( System.out.println(result); }) ); + diff --git a/docs/examples/java/account/list-logs.md b/docs/examples/java/account/list-logs.md index 971ac86..b33b55a 100644 --- a/docs/examples/java/account/list-logs.md +++ b/docs/examples/java/account/list-logs.md @@ -5,11 +5,12 @@ import io.appwrite.services.Account; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Account account = new Account(client); account.listLogs( + listOf(), // queries (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -19,3 +20,4 @@ account.listLogs( System.out.println(result); }) ); + diff --git a/docs/examples/java/account/list-mfa-factors.md b/docs/examples/java/account/list-mfa-factors.md new file mode 100644 index 0000000..9232cdf --- /dev/null +++ b/docs/examples/java/account/list-mfa-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("5df5acd0d48c2") // 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/list-sessions.md b/docs/examples/java/account/list-sessions.md index 9d7e630..c1fd540 100644 --- a/docs/examples/java/account/list-sessions.md +++ b/docs/examples/java/account/list-sessions.md @@ -5,7 +5,7 @@ import io.appwrite.services.Account; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Account account = new Account(client); diff --git a/docs/examples/java/account/update-email.md b/docs/examples/java/account/update-email.md index 67ab31a..453e1da 100644 --- a/docs/examples/java/account/update-email.md +++ b/docs/examples/java/account/update-email.md @@ -5,13 +5,13 @@ import io.appwrite.services.Account; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Account account = new Account(client); account.updateEmail( - "email@example.com", - "password" + "email@example.com", // email + "password", // password new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ account.updateEmail( System.out.println(result); }) ); + diff --git a/docs/examples/java/account/update-m-f-a.md b/docs/examples/java/account/update-m-f-a.md new file mode 100644 index 0000000..28780ae --- /dev/null +++ b/docs/examples/java/account/update-m-f-a.md @@ -0,0 +1,23 @@ +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("5df5acd0d48c2") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.updateMFA( + false, // mfa + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/account/update-magic-u-r-l-session.md b/docs/examples/java/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000..f11d09a --- /dev/null +++ b/docs/examples/java/account/update-magic-u-r-l-session.md @@ -0,0 +1,23 @@ +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("5df5acd0d48c2"); // Your project ID + +Account account = new Account(client); + +account.updateMagicURLSession( + "", // userId + "", // secret + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/account/update-mfa-authenticator.md b/docs/examples/java/account/update-mfa-authenticator.md new file mode 100644 index 0000000..cc6b774 --- /dev/null +++ b/docs/examples/java/account/update-mfa-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("5df5acd0d48c2") // 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-mfa-challenge.md b/docs/examples/java/account/update-mfa-challenge.md new file mode 100644 index 0000000..8b907b1 --- /dev/null +++ b/docs/examples/java/account/update-mfa-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("5df5acd0d48c2") // 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-mfa-recovery-codes.md b/docs/examples/java/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000..c00cd9e --- /dev/null +++ b/docs/examples/java/account/update-mfa-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("5df5acd0d48c2") // 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/account/update-name.md b/docs/examples/java/account/update-name.md index 6900f12..4880522 100644 --- a/docs/examples/java/account/update-name.md +++ b/docs/examples/java/account/update-name.md @@ -5,12 +5,12 @@ import io.appwrite.services.Account; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Account account = new Account(client); account.updateName( - "[NAME]" + "", // name new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ account.updateName( System.out.println(result); }) ); + diff --git a/docs/examples/java/account/update-password.md b/docs/examples/java/account/update-password.md index ace01fc..078301a 100644 --- a/docs/examples/java/account/update-password.md +++ b/docs/examples/java/account/update-password.md @@ -5,12 +5,13 @@ import io.appwrite.services.Account; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Account account = new Account(client); account.updatePassword( - "", + "", // password + "password", // oldPassword (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +21,4 @@ account.updatePassword( System.out.println(result); }) ); + diff --git a/docs/examples/java/account/update-phone-session.md b/docs/examples/java/account/update-phone-session.md new file mode 100644 index 0000000..b4fdb3c --- /dev/null +++ b/docs/examples/java/account/update-phone-session.md @@ -0,0 +1,23 @@ +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("5df5acd0d48c2"); // Your project ID + +Account account = new Account(client); + +account.updatePhoneSession( + "", // userId + "", // secret + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/account/update-phone-verification.md b/docs/examples/java/account/update-phone-verification.md index 8c3c975..509f220 100644 --- a/docs/examples/java/account/update-phone-verification.md +++ b/docs/examples/java/account/update-phone-verification.md @@ -5,13 +5,13 @@ import io.appwrite.services.Account; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Account account = new Account(client); account.updatePhoneVerification( - "[USER_ID]", - "[SECRET]" + "", // userId + "", // secret new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ account.updatePhoneVerification( System.out.println(result); }) ); + diff --git a/docs/examples/java/account/update-phone.md b/docs/examples/java/account/update-phone.md index 9365a0f..1808767 100644 --- a/docs/examples/java/account/update-phone.md +++ b/docs/examples/java/account/update-phone.md @@ -5,13 +5,13 @@ import io.appwrite.services.Account; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Account account = new Account(client); account.updatePhone( - "+12065550100", - "password" + "+12065550100", // phone + "password", // password new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ account.updatePhone( System.out.println(result); }) ); + diff --git a/docs/examples/java/account/update-prefs.md b/docs/examples/java/account/update-prefs.md index 24a3625..0ff1116 100644 --- a/docs/examples/java/account/update-prefs.md +++ b/docs/examples/java/account/update-prefs.md @@ -5,12 +5,12 @@ import io.appwrite.services.Account; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Account account = new Account(client); account.updatePrefs( - mapOf( "a" to "b" ) + mapOf( "a" to "b" ), // prefs new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ account.updatePrefs( System.out.println(result); }) ); + diff --git a/docs/examples/java/account/update-recovery.md b/docs/examples/java/account/update-recovery.md index bc3251d..11cd3e7 100644 --- a/docs/examples/java/account/update-recovery.md +++ b/docs/examples/java/account/update-recovery.md @@ -5,15 +5,14 @@ import io.appwrite.services.Account; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Account account = new Account(client); account.updateRecovery( - "[USER_ID]", - "[SECRET]", - "password", - "password" + "", // userId + "", // secret + "", // password new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -23,3 +22,4 @@ account.updateRecovery( System.out.println(result); }) ); + diff --git a/docs/examples/java/account/update-session.md b/docs/examples/java/account/update-session.md index 62d77e1..a944695 100644 --- a/docs/examples/java/account/update-session.md +++ b/docs/examples/java/account/update-session.md @@ -5,12 +5,12 @@ import io.appwrite.services.Account; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Account account = new Account(client); account.updateSession( - "[SESSION_ID]" + "", // sessionId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ account.updateSession( System.out.println(result); }) ); + diff --git a/docs/examples/java/account/update-status.md b/docs/examples/java/account/update-status.md index 4af2cf1..888bd31 100644 --- a/docs/examples/java/account/update-status.md +++ b/docs/examples/java/account/update-status.md @@ -5,7 +5,7 @@ import io.appwrite.services.Account; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Account account = new Account(client); diff --git a/docs/examples/java/account/update-verification.md b/docs/examples/java/account/update-verification.md index 2190daf..3b2db93 100644 --- a/docs/examples/java/account/update-verification.md +++ b/docs/examples/java/account/update-verification.md @@ -5,13 +5,13 @@ import io.appwrite.services.Account; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Account account = new Account(client); account.updateVerification( - "[USER_ID]", - "[SECRET]" + "", // userId + "", // secret new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ account.updateVerification( System.out.println(result); }) ); + diff --git a/docs/examples/java/avatars/get-browser.md b/docs/examples/java/avatars/get-browser.md index 42e8e57..7e89188 100644 --- a/docs/examples/java/avatars/get-browser.md +++ b/docs/examples/java/avatars/get-browser.md @@ -1,16 +1,20 @@ import io.appwrite.Client; import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Avatars; +import io.appwrite.enums.Browser; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Avatars avatars = new Avatars(client); avatars.getBrowser( - "aa", + Browser.AVANT_BROWSER, // code + 0, // width (optional) + 0, // height (optional) + 0, // quality (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +24,4 @@ avatars.getBrowser( System.out.println(result); }) ); + diff --git a/docs/examples/java/avatars/get-credit-card.md b/docs/examples/java/avatars/get-credit-card.md index 5e3b32b..e6e6004 100644 --- a/docs/examples/java/avatars/get-credit-card.md +++ b/docs/examples/java/avatars/get-credit-card.md @@ -1,16 +1,20 @@ import io.appwrite.Client; import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Avatars; +import io.appwrite.enums.CreditCard; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Avatars avatars = new Avatars(client); avatars.getCreditCard( - "amex", + CreditCard.AMERICAN_EXPRESS, // code + 0, // width (optional) + 0, // height (optional) + 0, // quality (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +24,4 @@ avatars.getCreditCard( System.out.println(result); }) ); + diff --git a/docs/examples/java/avatars/get-favicon.md b/docs/examples/java/avatars/get-favicon.md index 109f88f..3819896 100644 --- a/docs/examples/java/avatars/get-favicon.md +++ b/docs/examples/java/avatars/get-favicon.md @@ -5,12 +5,12 @@ import io.appwrite.services.Avatars; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Avatars avatars = new Avatars(client); avatars.getFavicon( - "https://example.com" + "https://example.com", // url new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ avatars.getFavicon( System.out.println(result); }) ); + diff --git a/docs/examples/java/avatars/get-flag.md b/docs/examples/java/avatars/get-flag.md index 6ad820a..b5dc08a 100644 --- a/docs/examples/java/avatars/get-flag.md +++ b/docs/examples/java/avatars/get-flag.md @@ -1,16 +1,20 @@ import io.appwrite.Client; import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Avatars; +import io.appwrite.enums.Flag; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Avatars avatars = new Avatars(client); avatars.getFlag( - "af", + Flag.AFGHANISTAN, // code + 0, // width (optional) + 0, // height (optional) + 0, // quality (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +24,4 @@ avatars.getFlag( System.out.println(result); }) ); + diff --git a/docs/examples/java/avatars/get-image.md b/docs/examples/java/avatars/get-image.md index 2680544..f1d0d29 100644 --- a/docs/examples/java/avatars/get-image.md +++ b/docs/examples/java/avatars/get-image.md @@ -5,12 +5,14 @@ import io.appwrite.services.Avatars; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Avatars avatars = new Avatars(client); avatars.getImage( - "https://example.com", + "https://example.com", // url + 0, // width (optional) + 0, // height (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +22,4 @@ avatars.getImage( System.out.println(result); }) ); + diff --git a/docs/examples/java/avatars/get-initials.md b/docs/examples/java/avatars/get-initials.md index 8a86e7a..8d69379 100644 --- a/docs/examples/java/avatars/get-initials.md +++ b/docs/examples/java/avatars/get-initials.md @@ -5,11 +5,15 @@ import io.appwrite.services.Avatars; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Avatars avatars = new Avatars(client); avatars.getInitials( + "", // name (optional) + 0, // width (optional) + 0, // height (optional) + "", // background (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -19,3 +23,4 @@ avatars.getInitials( System.out.println(result); }) ); + diff --git a/docs/examples/java/avatars/get-q-r.md b/docs/examples/java/avatars/get-q-r.md index c57d70a..8a34781 100644 --- a/docs/examples/java/avatars/get-q-r.md +++ b/docs/examples/java/avatars/get-q-r.md @@ -5,12 +5,15 @@ import io.appwrite.services.Avatars; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Avatars avatars = new Avatars(client); avatars.getQR( - "[TEXT]", + "", // text + 1, // size (optional) + 0, // margin (optional) + false, // download (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +23,4 @@ avatars.getQR( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/create-boolean-attribute.md b/docs/examples/java/databases/create-boolean-attribute.md index 6e79f0a..c1325cf 100644 --- a/docs/examples/java/databases/create-boolean-attribute.md +++ b/docs/examples/java/databases/create-boolean-attribute.md @@ -10,10 +10,12 @@ Client client = new Client() Databases databases = new Databases(client); databases.createBooleanAttribute( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "", - false, + "", // databaseId + "", // collectionId + "", // key + false, // required + false, // default (optional) + false, // array (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -23,3 +25,4 @@ databases.createBooleanAttribute( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/create-collection.md b/docs/examples/java/databases/create-collection.md index 96b5d9b..4be7245 100644 --- a/docs/examples/java/databases/create-collection.md +++ b/docs/examples/java/databases/create-collection.md @@ -10,9 +10,12 @@ Client client = new Client() Databases databases = new Databases(client); databases.createCollection( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "[NAME]", + "", // databaseId + "", // collectionId + "", // name + listOf("read("any")"), // permissions (optional) + false, // documentSecurity (optional) + false, // enabled (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -22,3 +25,4 @@ databases.createCollection( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/create-datetime-attribute.md b/docs/examples/java/databases/create-datetime-attribute.md index 307a8ff..514933c 100644 --- a/docs/examples/java/databases/create-datetime-attribute.md +++ b/docs/examples/java/databases/create-datetime-attribute.md @@ -10,10 +10,12 @@ Client client = new Client() Databases databases = new Databases(client); databases.createDatetimeAttribute( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "", - false, + "", // databaseId + "", // collectionId + "", // key + false, // required + "", // default (optional) + false, // array (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -23,3 +25,4 @@ databases.createDatetimeAttribute( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/create-document.md b/docs/examples/java/databases/create-document.md index 029c3f7..73f2c5a 100644 --- a/docs/examples/java/databases/create-document.md +++ b/docs/examples/java/databases/create-document.md @@ -5,15 +5,16 @@ import io.appwrite.services.Databases; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Databases databases = new Databases(client); databases.createDocument( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "[DOCUMENT_ID]", - mapOf( "a" to "b" ), + "", // databaseId + "", // collectionId + "", // documentId + mapOf( "a" to "b" ), // data + listOf("read("any")"), // permissions (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -23,3 +24,4 @@ databases.createDocument( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/create-email-attribute.md b/docs/examples/java/databases/create-email-attribute.md index 8774c55..375ca5c 100644 --- a/docs/examples/java/databases/create-email-attribute.md +++ b/docs/examples/java/databases/create-email-attribute.md @@ -10,10 +10,12 @@ Client client = new Client() Databases databases = new Databases(client); databases.createEmailAttribute( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "", - false, + "", // databaseId + "", // collectionId + "", // key + false, // required + "email@example.com", // default (optional) + false, // array (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -23,3 +25,4 @@ databases.createEmailAttribute( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/create-enum-attribute.md b/docs/examples/java/databases/create-enum-attribute.md index e2cf6a2..c0190bc 100644 --- a/docs/examples/java/databases/create-enum-attribute.md +++ b/docs/examples/java/databases/create-enum-attribute.md @@ -10,11 +10,13 @@ Client client = new Client() Databases databases = new Databases(client); databases.createEnumAttribute( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "", - listOf(), - false, + "", // databaseId + "", // collectionId + "", // key + listOf(), // elements + false, // required + "", // default (optional) + false, // array (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -24,3 +26,4 @@ databases.createEnumAttribute( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/create-float-attribute.md b/docs/examples/java/databases/create-float-attribute.md index 0fba6ac..844ae50 100644 --- a/docs/examples/java/databases/create-float-attribute.md +++ b/docs/examples/java/databases/create-float-attribute.md @@ -10,10 +10,14 @@ Client client = new Client() Databases databases = new Databases(client); databases.createFloatAttribute( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "", - false, + "", // databaseId + "", // collectionId + "", // key + false, // required + 0, // min (optional) + 0, // max (optional) + 0, // default (optional) + false, // array (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -23,3 +27,4 @@ databases.createFloatAttribute( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/create-index.md b/docs/examples/java/databases/create-index.md index 5dbdce8..bcfb327 100644 --- a/docs/examples/java/databases/create-index.md +++ b/docs/examples/java/databases/create-index.md @@ -1,6 +1,7 @@ import io.appwrite.Client; import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Databases; +import io.appwrite.enums.IndexType; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint @@ -10,11 +11,12 @@ Client client = new Client() Databases databases = new Databases(client); databases.createIndex( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "", - "key", - listOf(), + "", // databaseId + "", // collectionId + "", // key + IndexType.KEY, // type + listOf(), // attributes + listOf(), // orders (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -24,3 +26,4 @@ databases.createIndex( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/create-integer-attribute.md b/docs/examples/java/databases/create-integer-attribute.md index 5446862..feab244 100644 --- a/docs/examples/java/databases/create-integer-attribute.md +++ b/docs/examples/java/databases/create-integer-attribute.md @@ -10,10 +10,14 @@ Client client = new Client() Databases databases = new Databases(client); databases.createIntegerAttribute( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "", - false, + "", // databaseId + "", // collectionId + "", // key + false, // required + 0, // min (optional) + 0, // max (optional) + 0, // default (optional) + false, // array (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -23,3 +27,4 @@ databases.createIntegerAttribute( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/create-ip-attribute.md b/docs/examples/java/databases/create-ip-attribute.md index fe37da9..f624212 100644 --- a/docs/examples/java/databases/create-ip-attribute.md +++ b/docs/examples/java/databases/create-ip-attribute.md @@ -10,10 +10,12 @@ Client client = new Client() Databases databases = new Databases(client); databases.createIpAttribute( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "", - false, + "", // databaseId + "", // collectionId + "", // key + false, // required + "", // default (optional) + false, // array (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -23,3 +25,4 @@ databases.createIpAttribute( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/create-relationship-attribute.md b/docs/examples/java/databases/create-relationship-attribute.md index 0b7e5f9..ed998b4 100644 --- a/docs/examples/java/databases/create-relationship-attribute.md +++ b/docs/examples/java/databases/create-relationship-attribute.md @@ -1,6 +1,7 @@ import io.appwrite.Client; import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Databases; +import io.appwrite.enums.RelationshipType; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint @@ -10,10 +11,14 @@ Client client = new Client() Databases databases = new Databases(client); databases.createRelationshipAttribute( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "[RELATED_COLLECTION_ID]", - "oneToOne", + "", // databaseId + "", // collectionId + "", // relatedCollectionId + RelationshipType.ONETOONE, // type + false, // twoWay (optional) + "", // key (optional) + "", // twoWayKey (optional) + RelationMutate.CASCADE, // onDelete (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -23,3 +28,4 @@ databases.createRelationshipAttribute( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/create-string-attribute.md b/docs/examples/java/databases/create-string-attribute.md index a9b1916..70257ea 100644 --- a/docs/examples/java/databases/create-string-attribute.md +++ b/docs/examples/java/databases/create-string-attribute.md @@ -10,11 +10,14 @@ Client client = new Client() Databases databases = new Databases(client); databases.createStringAttribute( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "", - 1, - false, + "", // databaseId + "", // collectionId + "", // key + 1, // size + false, // required + "", // default (optional) + false, // array (optional) + false, // encrypt (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -24,3 +27,4 @@ databases.createStringAttribute( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/create-url-attribute.md b/docs/examples/java/databases/create-url-attribute.md index 9c504d8..706db3f 100644 --- a/docs/examples/java/databases/create-url-attribute.md +++ b/docs/examples/java/databases/create-url-attribute.md @@ -10,10 +10,12 @@ Client client = new Client() Databases databases = new Databases(client); databases.createUrlAttribute( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "", - false, + "", // databaseId + "", // collectionId + "", // key + false, // required + "https://example.com", // default (optional) + false, // array (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -23,3 +25,4 @@ databases.createUrlAttribute( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/create.md b/docs/examples/java/databases/create.md index a323434..3700e18 100644 --- a/docs/examples/java/databases/create.md +++ b/docs/examples/java/databases/create.md @@ -10,8 +10,9 @@ Client client = new Client() Databases databases = new Databases(client); databases.create( - "[DATABASE_ID]", - "[NAME]", + "", // databaseId + "", // name + false, // enabled (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +22,4 @@ databases.create( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/delete-attribute.md b/docs/examples/java/databases/delete-attribute.md index 68aeecd..ee14deb 100644 --- a/docs/examples/java/databases/delete-attribute.md +++ b/docs/examples/java/databases/delete-attribute.md @@ -10,9 +10,9 @@ Client client = new Client() Databases databases = new Databases(client); databases.deleteAttribute( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "" + "", // databaseId + "", // collectionId + "", // key new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -22,3 +22,4 @@ databases.deleteAttribute( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/delete-collection.md b/docs/examples/java/databases/delete-collection.md index cd328b4..de17e07 100644 --- a/docs/examples/java/databases/delete-collection.md +++ b/docs/examples/java/databases/delete-collection.md @@ -10,8 +10,8 @@ Client client = new Client() Databases databases = new Databases(client); databases.deleteCollection( - "[DATABASE_ID]", - "[COLLECTION_ID]" + "", // databaseId + "", // collectionId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ databases.deleteCollection( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/delete-document.md b/docs/examples/java/databases/delete-document.md index 4f4c849..722bb4f 100644 --- a/docs/examples/java/databases/delete-document.md +++ b/docs/examples/java/databases/delete-document.md @@ -5,14 +5,14 @@ import io.appwrite.services.Databases; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Databases databases = new Databases(client); databases.deleteDocument( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "[DOCUMENT_ID]" + "", // databaseId + "", // collectionId + "", // documentId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -22,3 +22,4 @@ databases.deleteDocument( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/delete-index.md b/docs/examples/java/databases/delete-index.md index 640bd0f..ed36408 100644 --- a/docs/examples/java/databases/delete-index.md +++ b/docs/examples/java/databases/delete-index.md @@ -10,9 +10,9 @@ Client client = new Client() Databases databases = new Databases(client); databases.deleteIndex( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "" + "", // databaseId + "", // collectionId + "", // key new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -22,3 +22,4 @@ databases.deleteIndex( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/delete.md b/docs/examples/java/databases/delete.md index 897a450..aa323b2 100644 --- a/docs/examples/java/databases/delete.md +++ b/docs/examples/java/databases/delete.md @@ -10,7 +10,7 @@ Client client = new Client() Databases databases = new Databases(client); databases.delete( - "[DATABASE_ID]" + "", // databaseId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ databases.delete( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/get-attribute.md b/docs/examples/java/databases/get-attribute.md index 79c1d2b..be2dc5d 100644 --- a/docs/examples/java/databases/get-attribute.md +++ b/docs/examples/java/databases/get-attribute.md @@ -10,9 +10,9 @@ Client client = new Client() Databases databases = new Databases(client); databases.getAttribute( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "" + "", // databaseId + "", // collectionId + "", // key new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -22,3 +22,4 @@ databases.getAttribute( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/get-collection.md b/docs/examples/java/databases/get-collection.md index 3ecfa0c..75701bd 100644 --- a/docs/examples/java/databases/get-collection.md +++ b/docs/examples/java/databases/get-collection.md @@ -10,8 +10,8 @@ Client client = new Client() Databases databases = new Databases(client); databases.getCollection( - "[DATABASE_ID]", - "[COLLECTION_ID]" + "", // databaseId + "", // collectionId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ databases.getCollection( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/get-document.md b/docs/examples/java/databases/get-document.md index 2061bed..7b6d043 100644 --- a/docs/examples/java/databases/get-document.md +++ b/docs/examples/java/databases/get-document.md @@ -5,14 +5,15 @@ import io.appwrite.services.Databases; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Databases databases = new Databases(client); databases.getDocument( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "[DOCUMENT_ID]", + "", // databaseId + "", // collectionId + "", // documentId + listOf(), // queries (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -22,3 +23,4 @@ databases.getDocument( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/get-index.md b/docs/examples/java/databases/get-index.md index 2bf036a..1c5dec7 100644 --- a/docs/examples/java/databases/get-index.md +++ b/docs/examples/java/databases/get-index.md @@ -10,9 +10,9 @@ Client client = new Client() Databases databases = new Databases(client); databases.getIndex( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "" + "", // databaseId + "", // collectionId + "", // key new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -22,3 +22,4 @@ databases.getIndex( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/get.md b/docs/examples/java/databases/get.md index 066ec4d..f21ee37 100644 --- a/docs/examples/java/databases/get.md +++ b/docs/examples/java/databases/get.md @@ -10,7 +10,7 @@ Client client = new Client() Databases databases = new Databases(client); databases.get( - "[DATABASE_ID]" + "", // databaseId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ databases.get( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/list-attributes.md b/docs/examples/java/databases/list-attributes.md index f42baa0..3f5b659 100644 --- a/docs/examples/java/databases/list-attributes.md +++ b/docs/examples/java/databases/list-attributes.md @@ -10,8 +10,9 @@ Client client = new Client() Databases databases = new Databases(client); databases.listAttributes( - "[DATABASE_ID]", - "[COLLECTION_ID]", + "", // databaseId + "", // collectionId + listOf(), // queries (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +22,4 @@ databases.listAttributes( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/list-collections.md b/docs/examples/java/databases/list-collections.md index 67c343f..cdb807f 100644 --- a/docs/examples/java/databases/list-collections.md +++ b/docs/examples/java/databases/list-collections.md @@ -10,7 +10,9 @@ Client client = new Client() Databases databases = new Databases(client); databases.listCollections( - "[DATABASE_ID]", + "", // databaseId + listOf(), // queries (optional) + "", // search (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +22,4 @@ databases.listCollections( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/list-documents.md b/docs/examples/java/databases/list-documents.md index 7a4a1b7..3dd929d 100644 --- a/docs/examples/java/databases/list-documents.md +++ b/docs/examples/java/databases/list-documents.md @@ -5,13 +5,14 @@ import io.appwrite.services.Databases; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Databases databases = new Databases(client); databases.listDocuments( - "[DATABASE_ID]", - "[COLLECTION_ID]", + "", // databaseId + "", // collectionId + listOf(), // queries (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +22,4 @@ databases.listDocuments( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/list-indexes.md b/docs/examples/java/databases/list-indexes.md index be50cdd..5d59dfa 100644 --- a/docs/examples/java/databases/list-indexes.md +++ b/docs/examples/java/databases/list-indexes.md @@ -10,8 +10,9 @@ Client client = new Client() Databases databases = new Databases(client); databases.listIndexes( - "[DATABASE_ID]", - "[COLLECTION_ID]", + "", // databaseId + "", // collectionId + listOf(), // queries (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +22,4 @@ databases.listIndexes( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/list.md b/docs/examples/java/databases/list.md index 04f8186..19334f3 100644 --- a/docs/examples/java/databases/list.md +++ b/docs/examples/java/databases/list.md @@ -10,6 +10,8 @@ Client client = new Client() Databases databases = new Databases(client); databases.list( + listOf(), // queries (optional) + "", // search (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -19,3 +21,4 @@ databases.list( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/update-boolean-attribute.md b/docs/examples/java/databases/update-boolean-attribute.md index 97cee2d..8b47913 100644 --- a/docs/examples/java/databases/update-boolean-attribute.md +++ b/docs/examples/java/databases/update-boolean-attribute.md @@ -10,11 +10,11 @@ Client client = new Client() Databases databases = new Databases(client); databases.updateBooleanAttribute( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "", - false, - false + "", // databaseId + "", // collectionId + "", // key + false, // required + false, // default new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -24,3 +24,4 @@ databases.updateBooleanAttribute( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/update-collection.md b/docs/examples/java/databases/update-collection.md index 3f25c50..f3cdf9a 100644 --- a/docs/examples/java/databases/update-collection.md +++ b/docs/examples/java/databases/update-collection.md @@ -10,9 +10,12 @@ Client client = new Client() Databases databases = new Databases(client); databases.updateCollection( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "[NAME]", + "", // databaseId + "", // collectionId + "", // name + listOf("read("any")"), // permissions (optional) + false, // documentSecurity (optional) + false, // enabled (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -22,3 +25,4 @@ databases.updateCollection( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/update-datetime-attribute.md b/docs/examples/java/databases/update-datetime-attribute.md index 503f2de..bc6bee4 100644 --- a/docs/examples/java/databases/update-datetime-attribute.md +++ b/docs/examples/java/databases/update-datetime-attribute.md @@ -10,11 +10,11 @@ Client client = new Client() Databases databases = new Databases(client); databases.updateDatetimeAttribute( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "", - false, - "" + "", // databaseId + "", // collectionId + "", // key + false, // required + "", // default new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -24,3 +24,4 @@ databases.updateDatetimeAttribute( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/update-document.md b/docs/examples/java/databases/update-document.md index e9a596d..246a900 100644 --- a/docs/examples/java/databases/update-document.md +++ b/docs/examples/java/databases/update-document.md @@ -5,14 +5,16 @@ import io.appwrite.services.Databases; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Databases databases = new Databases(client); databases.updateDocument( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "[DOCUMENT_ID]", + "", // databaseId + "", // collectionId + "", // documentId + mapOf( "a" to "b" ), // data (optional) + listOf("read("any")"), // permissions (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -22,3 +24,4 @@ databases.updateDocument( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/update-email-attribute.md b/docs/examples/java/databases/update-email-attribute.md index 39ea153..a62447d 100644 --- a/docs/examples/java/databases/update-email-attribute.md +++ b/docs/examples/java/databases/update-email-attribute.md @@ -10,11 +10,11 @@ Client client = new Client() Databases databases = new Databases(client); databases.updateEmailAttribute( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "", - false, - "email@example.com" + "", // databaseId + "", // collectionId + "", // key + false, // required + "email@example.com", // default new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -24,3 +24,4 @@ databases.updateEmailAttribute( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/update-enum-attribute.md b/docs/examples/java/databases/update-enum-attribute.md index 969ea4e..b78fb88 100644 --- a/docs/examples/java/databases/update-enum-attribute.md +++ b/docs/examples/java/databases/update-enum-attribute.md @@ -10,12 +10,12 @@ Client client = new Client() Databases databases = new Databases(client); databases.updateEnumAttribute( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "", - listOf(), - false, - "[DEFAULT]" + "", // databaseId + "", // collectionId + "", // key + listOf(), // elements + false, // required + "", // default new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -25,3 +25,4 @@ databases.updateEnumAttribute( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/update-float-attribute.md b/docs/examples/java/databases/update-float-attribute.md index 67d76e4..89e6c61 100644 --- a/docs/examples/java/databases/update-float-attribute.md +++ b/docs/examples/java/databases/update-float-attribute.md @@ -10,13 +10,13 @@ Client client = new Client() Databases databases = new Databases(client); databases.updateFloatAttribute( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "", - false, - 0, - 0, - 0 + "", // databaseId + "", // collectionId + "", // key + false, // required + 0, // min + 0, // max + 0, // default new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -26,3 +26,4 @@ databases.updateFloatAttribute( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/update-integer-attribute.md b/docs/examples/java/databases/update-integer-attribute.md index b9308dc..1e90bdc 100644 --- a/docs/examples/java/databases/update-integer-attribute.md +++ b/docs/examples/java/databases/update-integer-attribute.md @@ -10,13 +10,13 @@ Client client = new Client() Databases databases = new Databases(client); databases.updateIntegerAttribute( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "", - false, - 0, - 0, - 0 + "", // databaseId + "", // collectionId + "", // key + false, // required + 0, // min + 0, // max + 0, // default new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -26,3 +26,4 @@ databases.updateIntegerAttribute( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/update-ip-attribute.md b/docs/examples/java/databases/update-ip-attribute.md index 6a936a5..8df90b5 100644 --- a/docs/examples/java/databases/update-ip-attribute.md +++ b/docs/examples/java/databases/update-ip-attribute.md @@ -10,11 +10,11 @@ Client client = new Client() Databases databases = new Databases(client); databases.updateIpAttribute( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "", - false, - "" + "", // databaseId + "", // collectionId + "", // key + false, // required + "", // default new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -24,3 +24,4 @@ databases.updateIpAttribute( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/update-relationship-attribute.md b/docs/examples/java/databases/update-relationship-attribute.md index 272952b..1fd638f 100644 --- a/docs/examples/java/databases/update-relationship-attribute.md +++ b/docs/examples/java/databases/update-relationship-attribute.md @@ -10,9 +10,10 @@ Client client = new Client() Databases databases = new Databases(client); databases.updateRelationshipAttribute( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "", + "", // databaseId + "", // collectionId + "", // key + RelationMutate.CASCADE, // onDelete (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -22,3 +23,4 @@ databases.updateRelationshipAttribute( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/update-string-attribute.md b/docs/examples/java/databases/update-string-attribute.md index aba0d0e..b5cf75a 100644 --- a/docs/examples/java/databases/update-string-attribute.md +++ b/docs/examples/java/databases/update-string-attribute.md @@ -10,11 +10,11 @@ Client client = new Client() Databases databases = new Databases(client); databases.updateStringAttribute( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "", - false, - "[DEFAULT]" + "", // databaseId + "", // collectionId + "", // key + false, // required + "", // default new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -24,3 +24,4 @@ databases.updateStringAttribute( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/update-url-attribute.md b/docs/examples/java/databases/update-url-attribute.md index 87ab384..c93f509 100644 --- a/docs/examples/java/databases/update-url-attribute.md +++ b/docs/examples/java/databases/update-url-attribute.md @@ -10,11 +10,11 @@ Client client = new Client() Databases databases = new Databases(client); databases.updateUrlAttribute( - "[DATABASE_ID]", - "[COLLECTION_ID]", - "", - false, - "https://example.com" + "", // databaseId + "", // collectionId + "", // key + false, // required + "https://example.com", // default new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -24,3 +24,4 @@ databases.updateUrlAttribute( System.out.println(result); }) ); + diff --git a/docs/examples/java/databases/update.md b/docs/examples/java/databases/update.md index b706df6..2d9695b 100644 --- a/docs/examples/java/databases/update.md +++ b/docs/examples/java/databases/update.md @@ -10,8 +10,9 @@ Client client = new Client() Databases databases = new Databases(client); databases.update( - "[DATABASE_ID]", - "[NAME]", + "", // databaseId + "", // name + false, // enabled (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +22,4 @@ databases.update( System.out.println(result); }) ); + diff --git a/docs/examples/java/functions/create-build.md b/docs/examples/java/functions/create-build.md index 10c8d2f..097587f 100644 --- a/docs/examples/java/functions/create-build.md +++ b/docs/examples/java/functions/create-build.md @@ -10,9 +10,9 @@ Client client = new Client() Functions functions = new Functions(client); functions.createBuild( - "[FUNCTION_ID]", - "[DEPLOYMENT_ID]", - "[BUILD_ID]" + "", // functionId + "", // deploymentId + "", // buildId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -22,3 +22,4 @@ functions.createBuild( System.out.println(result); }) ); + diff --git a/docs/examples/java/functions/create-deployment.md b/docs/examples/java/functions/create-deployment.md index 4e6da33..25ca118 100644 --- a/docs/examples/java/functions/create-deployment.md +++ b/docs/examples/java/functions/create-deployment.md @@ -11,9 +11,11 @@ Client client = new Client() Functions functions = new Functions(client); functions.createDeployment( - "[FUNCTION_ID]", - InputFile.fromPath("file.png"), - false, + "", // functionId + InputFile.fromPath("file.png"), // code + false, // activate + "", // entrypoint (optional) + "", // commands (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -23,3 +25,4 @@ functions.createDeployment( System.out.println(result); }) ); + diff --git a/docs/examples/java/functions/create-execution.md b/docs/examples/java/functions/create-execution.md index 315f57d..f3507f3 100644 --- a/docs/examples/java/functions/create-execution.md +++ b/docs/examples/java/functions/create-execution.md @@ -5,12 +5,17 @@ import io.appwrite.services.Functions; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Functions functions = new Functions(client); functions.createExecution( - "[FUNCTION_ID]", + "", // functionId + "", // body (optional) + false, // async (optional) + "", // path (optional) + ExecutionMethod.GET, // method (optional) + mapOf( "a" to "b" ), // headers (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +25,4 @@ functions.createExecution( System.out.println(result); }) ); + diff --git a/docs/examples/java/functions/create-variable.md b/docs/examples/java/functions/create-variable.md index 5e9c5a6..f833f34 100644 --- a/docs/examples/java/functions/create-variable.md +++ b/docs/examples/java/functions/create-variable.md @@ -10,9 +10,9 @@ Client client = new Client() Functions functions = new Functions(client); functions.createVariable( - "[FUNCTION_ID]", - "[KEY]", - "[VALUE]" + "", // functionId + "", // key + "", // value new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -22,3 +22,4 @@ functions.createVariable( System.out.println(result); }) ); + diff --git a/docs/examples/java/functions/create.md b/docs/examples/java/functions/create.md index aac8169..edaaa11 100644 --- a/docs/examples/java/functions/create.md +++ b/docs/examples/java/functions/create.md @@ -1,6 +1,7 @@ import io.appwrite.Client; import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Functions; +import io.appwrite.enums.Runtime; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint @@ -10,9 +11,26 @@ Client client = new Client() Functions functions = new Functions(client); functions.create( - "[FUNCTION_ID]", - "[NAME]", - "node-18.0", + "", // functionId + "", // name + .NODE_14_5, // runtime + listOf("any"), // execute (optional) + listOf(), // events (optional) + "", // schedule (optional) + 1, // timeout (optional) + false, // enabled (optional) + false, // logging (optional) + "", // entrypoint (optional) + "", // commands (optional) + "", // installationId (optional) + "", // providerRepositoryId (optional) + "", // providerBranch (optional) + false, // providerSilentMode (optional) + "", // providerRootDirectory (optional) + "", // templateRepository (optional) + "", // templateOwner (optional) + "", // templateRootDirectory (optional) + "", // templateBranch (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -22,3 +40,4 @@ functions.create( System.out.println(result); }) ); + diff --git a/docs/examples/java/functions/delete-deployment.md b/docs/examples/java/functions/delete-deployment.md index 703dce6..83de970 100644 --- a/docs/examples/java/functions/delete-deployment.md +++ b/docs/examples/java/functions/delete-deployment.md @@ -10,8 +10,8 @@ Client client = new Client() Functions functions = new Functions(client); functions.deleteDeployment( - "[FUNCTION_ID]", - "[DEPLOYMENT_ID]" + "", // functionId + "", // deploymentId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ functions.deleteDeployment( System.out.println(result); }) ); + diff --git a/docs/examples/java/functions/delete-variable.md b/docs/examples/java/functions/delete-variable.md index d366150..6d91f50 100644 --- a/docs/examples/java/functions/delete-variable.md +++ b/docs/examples/java/functions/delete-variable.md @@ -10,8 +10,8 @@ Client client = new Client() Functions functions = new Functions(client); functions.deleteVariable( - "[FUNCTION_ID]", - "[VARIABLE_ID]" + "", // functionId + "", // variableId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ functions.deleteVariable( System.out.println(result); }) ); + diff --git a/docs/examples/java/functions/delete.md b/docs/examples/java/functions/delete.md index 8f39896..647da6e 100644 --- a/docs/examples/java/functions/delete.md +++ b/docs/examples/java/functions/delete.md @@ -10,7 +10,7 @@ Client client = new Client() Functions functions = new Functions(client); functions.delete( - "[FUNCTION_ID]" + "", // functionId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ functions.delete( System.out.println(result); }) ); + diff --git a/docs/examples/java/functions/download-deployment.md b/docs/examples/java/functions/download-deployment.md index 91898dc..e241481 100644 --- a/docs/examples/java/functions/download-deployment.md +++ b/docs/examples/java/functions/download-deployment.md @@ -10,8 +10,8 @@ Client client = new Client() Functions functions = new Functions(client); functions.downloadDeployment( - "[FUNCTION_ID]", - "[DEPLOYMENT_ID]" + "", // functionId + "", // deploymentId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ functions.downloadDeployment( System.out.println(result); }) ); + diff --git a/docs/examples/java/functions/get-deployment.md b/docs/examples/java/functions/get-deployment.md index 5b539d2..12575ad 100644 --- a/docs/examples/java/functions/get-deployment.md +++ b/docs/examples/java/functions/get-deployment.md @@ -10,8 +10,8 @@ Client client = new Client() Functions functions = new Functions(client); functions.getDeployment( - "[FUNCTION_ID]", - "[DEPLOYMENT_ID]" + "", // functionId + "", // deploymentId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ functions.getDeployment( System.out.println(result); }) ); + diff --git a/docs/examples/java/functions/get-execution.md b/docs/examples/java/functions/get-execution.md index b1ff948..1f0d01b 100644 --- a/docs/examples/java/functions/get-execution.md +++ b/docs/examples/java/functions/get-execution.md @@ -5,13 +5,13 @@ import io.appwrite.services.Functions; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Functions functions = new Functions(client); functions.getExecution( - "[FUNCTION_ID]", - "[EXECUTION_ID]" + "", // functionId + "", // executionId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ functions.getExecution( System.out.println(result); }) ); + diff --git a/docs/examples/java/functions/get-variable.md b/docs/examples/java/functions/get-variable.md index 2be25a5..6b89b16 100644 --- a/docs/examples/java/functions/get-variable.md +++ b/docs/examples/java/functions/get-variable.md @@ -10,8 +10,8 @@ Client client = new Client() Functions functions = new Functions(client); functions.getVariable( - "[FUNCTION_ID]", - "[VARIABLE_ID]" + "", // functionId + "", // variableId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ functions.getVariable( System.out.println(result); }) ); + diff --git a/docs/examples/java/functions/get.md b/docs/examples/java/functions/get.md index 8ad5ea3..777bf83 100644 --- a/docs/examples/java/functions/get.md +++ b/docs/examples/java/functions/get.md @@ -10,7 +10,7 @@ Client client = new Client() Functions functions = new Functions(client); functions.get( - "[FUNCTION_ID]" + "", // functionId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ functions.get( System.out.println(result); }) ); + diff --git a/docs/examples/java/functions/list-deployments.md b/docs/examples/java/functions/list-deployments.md index 61f48c8..bee24c9 100644 --- a/docs/examples/java/functions/list-deployments.md +++ b/docs/examples/java/functions/list-deployments.md @@ -10,7 +10,9 @@ Client client = new Client() Functions functions = new Functions(client); functions.listDeployments( - "[FUNCTION_ID]", + "", // functionId + listOf(), // queries (optional) + "", // search (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +22,4 @@ functions.listDeployments( System.out.println(result); }) ); + diff --git a/docs/examples/java/functions/list-executions.md b/docs/examples/java/functions/list-executions.md index 392e9c8..d8632aa 100644 --- a/docs/examples/java/functions/list-executions.md +++ b/docs/examples/java/functions/list-executions.md @@ -5,12 +5,14 @@ import io.appwrite.services.Functions; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Functions functions = new Functions(client); functions.listExecutions( - "[FUNCTION_ID]", + "", // functionId + listOf(), // queries (optional) + "", // search (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +22,4 @@ functions.listExecutions( System.out.println(result); }) ); + diff --git a/docs/examples/java/functions/list-variables.md b/docs/examples/java/functions/list-variables.md index 4fa47e8..df66fd7 100644 --- a/docs/examples/java/functions/list-variables.md +++ b/docs/examples/java/functions/list-variables.md @@ -10,7 +10,7 @@ Client client = new Client() Functions functions = new Functions(client); functions.listVariables( - "[FUNCTION_ID]" + "", // functionId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ functions.listVariables( System.out.println(result); }) ); + diff --git a/docs/examples/java/functions/list.md b/docs/examples/java/functions/list.md index 4224cf5..2276e55 100644 --- a/docs/examples/java/functions/list.md +++ b/docs/examples/java/functions/list.md @@ -10,6 +10,8 @@ Client client = new Client() Functions functions = new Functions(client); functions.list( + listOf(), // queries (optional) + "", // search (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -19,3 +21,4 @@ functions.list( System.out.println(result); }) ); + diff --git a/docs/examples/java/functions/update-deployment.md b/docs/examples/java/functions/update-deployment.md index 2af0637..b0a9c15 100644 --- a/docs/examples/java/functions/update-deployment.md +++ b/docs/examples/java/functions/update-deployment.md @@ -10,8 +10,8 @@ Client client = new Client() Functions functions = new Functions(client); functions.updateDeployment( - "[FUNCTION_ID]", - "[DEPLOYMENT_ID]" + "", // functionId + "", // deploymentId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ functions.updateDeployment( System.out.println(result); }) ); + diff --git a/docs/examples/java/functions/update-variable.md b/docs/examples/java/functions/update-variable.md index f30bbf8..20610d9 100644 --- a/docs/examples/java/functions/update-variable.md +++ b/docs/examples/java/functions/update-variable.md @@ -10,9 +10,10 @@ Client client = new Client() Functions functions = new Functions(client); functions.updateVariable( - "[FUNCTION_ID]", - "[VARIABLE_ID]", - "[KEY]", + "", // functionId + "", // variableId + "", // key + "", // value (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -22,3 +23,4 @@ functions.updateVariable( System.out.println(result); }) ); + diff --git a/docs/examples/java/functions/update.md b/docs/examples/java/functions/update.md index 8a53d75..dca9943 100644 --- a/docs/examples/java/functions/update.md +++ b/docs/examples/java/functions/update.md @@ -10,8 +10,22 @@ Client client = new Client() Functions functions = new Functions(client); functions.update( - "[FUNCTION_ID]", - "[NAME]", + "", // functionId + "", // name + .NODE_14_5, // runtime (optional) + listOf("any"), // execute (optional) + listOf(), // events (optional) + "", // schedule (optional) + 1, // timeout (optional) + false, // enabled (optional) + false, // logging (optional) + "", // entrypoint (optional) + "", // commands (optional) + "", // installationId (optional) + "", // providerRepositoryId (optional) + "", // providerBranch (optional) + false, // providerSilentMode (optional) + "", // providerRootDirectory (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +35,4 @@ functions.update( System.out.println(result); }) ); + diff --git a/docs/examples/java/graphql/mutation.md b/docs/examples/java/graphql/mutation.md index d689c62..3b45db7 100644 --- a/docs/examples/java/graphql/mutation.md +++ b/docs/examples/java/graphql/mutation.md @@ -10,7 +10,7 @@ Client client = new Client() Graphql graphql = new Graphql(client); graphql.mutation( - mapOf( "a" to "b" ) + mapOf( "a" to "b" ), // query new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ graphql.mutation( System.out.println(result); }) ); + diff --git a/docs/examples/java/graphql/query.md b/docs/examples/java/graphql/query.md index e4b8693..508b326 100644 --- a/docs/examples/java/graphql/query.md +++ b/docs/examples/java/graphql/query.md @@ -10,7 +10,7 @@ Client client = new Client() Graphql graphql = new Graphql(client); graphql.query( - mapOf( "a" to "b" ) + mapOf( "a" to "b" ), // query new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ graphql.query( System.out.println(result); }) ); + diff --git a/docs/examples/java/health/get-certificate.md b/docs/examples/java/health/get-certificate.md new file mode 100644 index 0000000..73120ec --- /dev/null +++ b/docs/examples/java/health/get-certificate.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Health health = new Health(client); + +health.getCertificate( + "", // domain (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/health/get-failed-jobs.md b/docs/examples/java/health/get-failed-jobs.md new file mode 100644 index 0000000..7fa35ae --- /dev/null +++ b/docs/examples/java/health/get-failed-jobs.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; +import io.appwrite.enums.Name; + +Client client = new Client() + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Health health = new Health(client); + +health.getFailedJobs( + .V1_DATABASE, // name + 0, // threshold (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/health/get-queue-builds.md b/docs/examples/java/health/get-queue-builds.md index ff8a54f..e7289a7 100644 --- a/docs/examples/java/health/get-queue-builds.md +++ b/docs/examples/java/health/get-queue-builds.md @@ -10,6 +10,7 @@ Client client = new Client() Health health = new Health(client); health.getQueueBuilds( + 0, // threshold (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -19,3 +20,4 @@ health.getQueueBuilds( System.out.println(result); }) ); + diff --git a/docs/examples/java/health/get-queue-certificates.md b/docs/examples/java/health/get-queue-certificates.md index e3247d5..14722d1 100644 --- a/docs/examples/java/health/get-queue-certificates.md +++ b/docs/examples/java/health/get-queue-certificates.md @@ -10,6 +10,7 @@ Client client = new Client() Health health = new Health(client); health.getQueueCertificates( + 0, // threshold (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -19,3 +20,4 @@ health.getQueueCertificates( System.out.println(result); }) ); + diff --git a/docs/examples/java/health/get-queue-databases.md b/docs/examples/java/health/get-queue-databases.md index 79b4897..c504a84 100644 --- a/docs/examples/java/health/get-queue-databases.md +++ b/docs/examples/java/health/get-queue-databases.md @@ -10,6 +10,8 @@ Client client = new Client() Health health = new Health(client); health.getQueueDatabases( + "", // name (optional) + 0, // threshold (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -19,3 +21,4 @@ health.getQueueDatabases( System.out.println(result); }) ); + diff --git a/docs/examples/java/health/get-queue-deletes.md b/docs/examples/java/health/get-queue-deletes.md index 4152092..83a4862 100644 --- a/docs/examples/java/health/get-queue-deletes.md +++ b/docs/examples/java/health/get-queue-deletes.md @@ -10,6 +10,7 @@ Client client = new Client() Health health = new Health(client); health.getQueueDeletes( + 0, // threshold (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -19,3 +20,4 @@ health.getQueueDeletes( System.out.println(result); }) ); + diff --git a/docs/examples/java/health/get-queue-functions.md b/docs/examples/java/health/get-queue-functions.md index 9643108..1984d81 100644 --- a/docs/examples/java/health/get-queue-functions.md +++ b/docs/examples/java/health/get-queue-functions.md @@ -10,6 +10,7 @@ Client client = new Client() Health health = new Health(client); health.getQueueFunctions( + 0, // threshold (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -19,3 +20,4 @@ health.getQueueFunctions( System.out.println(result); }) ); + diff --git a/docs/examples/java/health/get-queue-logs.md b/docs/examples/java/health/get-queue-logs.md index 8e81796..fa7fa7e 100644 --- a/docs/examples/java/health/get-queue-logs.md +++ b/docs/examples/java/health/get-queue-logs.md @@ -10,6 +10,7 @@ Client client = new Client() Health health = new Health(client); health.getQueueLogs( + 0, // threshold (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -19,3 +20,4 @@ health.getQueueLogs( System.out.println(result); }) ); + diff --git a/docs/examples/java/health/get-queue-mails.md b/docs/examples/java/health/get-queue-mails.md index 812273e..3962d94 100644 --- a/docs/examples/java/health/get-queue-mails.md +++ b/docs/examples/java/health/get-queue-mails.md @@ -10,6 +10,7 @@ Client client = new Client() Health health = new Health(client); health.getQueueMails( + 0, // threshold (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -19,3 +20,4 @@ health.getQueueMails( System.out.println(result); }) ); + diff --git a/docs/examples/java/health/get-queue-messaging.md b/docs/examples/java/health/get-queue-messaging.md index 1e0c8f5..01b7e5a 100644 --- a/docs/examples/java/health/get-queue-messaging.md +++ b/docs/examples/java/health/get-queue-messaging.md @@ -10,6 +10,7 @@ Client client = new Client() Health health = new Health(client); health.getQueueMessaging( + 0, // threshold (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -19,3 +20,4 @@ health.getQueueMessaging( System.out.println(result); }) ); + diff --git a/docs/examples/java/health/get-queue-migrations.md b/docs/examples/java/health/get-queue-migrations.md index eaf4a89..7272a6f 100644 --- a/docs/examples/java/health/get-queue-migrations.md +++ b/docs/examples/java/health/get-queue-migrations.md @@ -10,6 +10,7 @@ Client client = new Client() Health health = new Health(client); health.getQueueMigrations( + 0, // threshold (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -19,3 +20,4 @@ health.getQueueMigrations( System.out.println(result); }) ); + diff --git a/docs/examples/java/health/get-queue-usage-dump.md b/docs/examples/java/health/get-queue-usage-dump.md new file mode 100644 index 0000000..8083af8 --- /dev/null +++ b/docs/examples/java/health/get-queue-usage-dump.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Health health = new Health(client); + +health.getQueueUsageDump( + 0, // threshold (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/health/get-queue-usage.md b/docs/examples/java/health/get-queue-usage.md new file mode 100644 index 0000000..ad4a163 --- /dev/null +++ b/docs/examples/java/health/get-queue-usage.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Health health = new Health(client); + +health.getQueueUsage( + 0, // threshold (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/health/get-queue-webhooks.md b/docs/examples/java/health/get-queue-webhooks.md index e400824..06dba93 100644 --- a/docs/examples/java/health/get-queue-webhooks.md +++ b/docs/examples/java/health/get-queue-webhooks.md @@ -10,6 +10,7 @@ Client client = new Client() Health health = new Health(client); health.getQueueWebhooks( + 0, // threshold (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -19,3 +20,4 @@ health.getQueueWebhooks( System.out.println(result); }) ); + diff --git a/docs/examples/java/health/get-storage.md b/docs/examples/java/health/get-storage.md new file mode 100644 index 0000000..c011ba5 --- /dev/null +++ b/docs/examples/java/health/get-storage.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Health health = new Health(client); + +health.getStorage(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/java/locale/get.md b/docs/examples/java/locale/get.md index 4fb6be9..de09960 100644 --- a/docs/examples/java/locale/get.md +++ b/docs/examples/java/locale/get.md @@ -5,7 +5,7 @@ import io.appwrite.services.Locale; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Locale locale = new Locale(client); diff --git a/docs/examples/java/locale/list-codes.md b/docs/examples/java/locale/list-codes.md index a3feffe..55e7503 100644 --- a/docs/examples/java/locale/list-codes.md +++ b/docs/examples/java/locale/list-codes.md @@ -5,7 +5,7 @@ import io.appwrite.services.Locale; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Locale locale = new Locale(client); diff --git a/docs/examples/java/locale/list-continents.md b/docs/examples/java/locale/list-continents.md index 661fcc3..793c863 100644 --- a/docs/examples/java/locale/list-continents.md +++ b/docs/examples/java/locale/list-continents.md @@ -5,7 +5,7 @@ import io.appwrite.services.Locale; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Locale locale = new Locale(client); diff --git a/docs/examples/java/locale/list-countries-e-u.md b/docs/examples/java/locale/list-countries-e-u.md index 6164ca0..8d45317 100644 --- a/docs/examples/java/locale/list-countries-e-u.md +++ b/docs/examples/java/locale/list-countries-e-u.md @@ -5,7 +5,7 @@ import io.appwrite.services.Locale; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Locale locale = new Locale(client); diff --git a/docs/examples/java/locale/list-countries-phones.md b/docs/examples/java/locale/list-countries-phones.md index 2cb41c1..bad8ff2 100644 --- a/docs/examples/java/locale/list-countries-phones.md +++ b/docs/examples/java/locale/list-countries-phones.md @@ -5,7 +5,7 @@ import io.appwrite.services.Locale; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Locale locale = new Locale(client); diff --git a/docs/examples/java/locale/list-countries.md b/docs/examples/java/locale/list-countries.md index 74d3b5d..96aac66 100644 --- a/docs/examples/java/locale/list-countries.md +++ b/docs/examples/java/locale/list-countries.md @@ -5,7 +5,7 @@ import io.appwrite.services.Locale; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Locale locale = new Locale(client); diff --git a/docs/examples/java/locale/list-currencies.md b/docs/examples/java/locale/list-currencies.md index 54a0e4d..55365ef 100644 --- a/docs/examples/java/locale/list-currencies.md +++ b/docs/examples/java/locale/list-currencies.md @@ -5,7 +5,7 @@ import io.appwrite.services.Locale; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Locale locale = new Locale(client); diff --git a/docs/examples/java/locale/list-languages.md b/docs/examples/java/locale/list-languages.md index 54976c5..fbf5565 100644 --- a/docs/examples/java/locale/list-languages.md +++ b/docs/examples/java/locale/list-languages.md @@ -5,7 +5,7 @@ import io.appwrite.services.Locale; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Locale locale = new Locale(client); diff --git a/docs/examples/java/messaging/create-apns-provider.md b/docs/examples/java/messaging/create-apns-provider.md new file mode 100644 index 0000000..2941fc6 --- /dev/null +++ b/docs/examples/java/messaging/create-apns-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // 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-email.md b/docs/examples/java/messaging/create-email.md new file mode 100644 index 0000000..4bf3a7c --- /dev/null +++ b/docs/examples/java/messaging/create-email.md @@ -0,0 +1,34 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createEmail( + "", // messageId + "", // subject + "", // content + listOf(), // topics (optional) + listOf(), // users (optional) + listOf(), // targets (optional) + listOf(), // cc (optional) + listOf(), // bcc (optional) + listOf(), // attachments (optional) + false, // draft (optional) + false, // html (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-fcm-provider.md b/docs/examples/java/messaging/create-fcm-provider.md new file mode 100644 index 0000000..8a0211c --- /dev/null +++ b/docs/examples/java/messaging/create-fcm-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // 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-mailgun-provider.md b/docs/examples/java/messaging/create-mailgun-provider.md new file mode 100644 index 0000000..946729b --- /dev/null +++ b/docs/examples/java/messaging/create-mailgun-provider.md @@ -0,0 +1,32 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createMailgunProvider( + "", // providerId + "", // name + "", // apiKey (optional) + "", // domain (optional) + false, // isEuRegion (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/create-msg91provider.md b/docs/examples/java/messaging/create-msg91provider.md new file mode 100644 index 0000000..2f4ef83 --- /dev/null +++ b/docs/examples/java/messaging/create-msg91provider.md @@ -0,0 +1,28 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createMsg91Provider( + "", // providerId + "", // name + "+12065550100", // from (optional) + "", // senderId (optional) + "", // authKey (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-push.md b/docs/examples/java/messaging/create-push.md new file mode 100644 index 0000000..904b436 --- /dev/null +++ b/docs/examples/java/messaging/create-push.md @@ -0,0 +1,38 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createPush( + "", // messageId + "", // title + "<BODY>", // body + listOf(), // topics (optional) + listOf(), // users (optional) + listOf(), // targets (optional) + mapOf( "a" to "b" ), // data (optional) + "<ACTION>", // action (optional) + "[ID1:ID2]", // image (optional) + "<ICON>", // icon (optional) + "<SOUND>", // sound (optional) + "<COLOR>", // color (optional) + "<TAG>", // tag (optional) + "<BADGE>", // badge (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-sendgrid-provider.md b/docs/examples/java/messaging/create-sendgrid-provider.md new file mode 100644 index 0000000..9da521e --- /dev/null +++ b/docs/examples/java/messaging/create-sendgrid-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createSendgridProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name + "<API_KEY>", // apiKey (optional) + "<FROM_NAME>", // fromName (optional) + "email@example.com", // fromEmail (optional) + "<REPLY_TO_NAME>", // 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/create-sms.md b/docs/examples/java/messaging/create-sms.md new file mode 100644 index 0000000..2bde3b6 --- /dev/null +++ b/docs/examples/java/messaging/create-sms.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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createSms( + "<MESSAGE_ID>", // messageId + "<CONTENT>", // 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-smtp-provider.md b/docs/examples/java/messaging/create-smtp-provider.md new file mode 100644 index 0000000..05a9ab1 --- /dev/null +++ b/docs/examples/java/messaging/create-smtp-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createSmtpProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name + "<HOST>", // host + 1, // port (optional) + "<USERNAME>", // username (optional) + "<PASSWORD>", // password (optional) + SmtpEncryption.NONE, // encryption (optional) + false, // autoTLS (optional) + "<MAILER>", // mailer (optional) + "<FROM_NAME>", // fromName (optional) + "email@example.com", // fromEmail (optional) + "<REPLY_TO_NAME>", // 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/create-subscriber.md b/docs/examples/java/messaging/create-subscriber.md new file mode 100644 index 0000000..1aa89e1 --- /dev/null +++ b/docs/examples/java/messaging/create-subscriber.md @@ -0,0 +1,25 @@ +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("5df5acd0d48c2") // Your project ID + .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + +Messaging messaging = new Messaging(client); + +messaging.createSubscriber( + "<TOPIC_ID>", // topicId + "<SUBSCRIBER_ID>", // subscriberId + "<TARGET_ID>", // targetId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/create-telesign-provider.md b/docs/examples/java/messaging/create-telesign-provider.md new file mode 100644 index 0000000..738f1fd --- /dev/null +++ b/docs/examples/java/messaging/create-telesign-provider.md @@ -0,0 +1,28 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createTelesignProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name + "+12065550100", // from (optional) + "<CUSTOMER_ID>", // customerId (optional) + "<API_KEY>", // apiKey (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-textmagic-provider.md b/docs/examples/java/messaging/create-textmagic-provider.md new file mode 100644 index 0000000..f78362d --- /dev/null +++ b/docs/examples/java/messaging/create-textmagic-provider.md @@ -0,0 +1,28 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createTextmagicProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name + "+12065550100", // from (optional) + "<USERNAME>", // username (optional) + "<API_KEY>", // apiKey (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-topic.md b/docs/examples/java/messaging/create-topic.md new file mode 100644 index 0000000..fa314c4 --- /dev/null +++ b/docs/examples/java/messaging/create-topic.md @@ -0,0 +1,25 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createTopic( + "<TOPIC_ID>", // topicId + "<NAME>", // name + listOf("any"), // subscribe (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/create-twilio-provider.md b/docs/examples/java/messaging/create-twilio-provider.md new file mode 100644 index 0000000..896e4a3 --- /dev/null +++ b/docs/examples/java/messaging/create-twilio-provider.md @@ -0,0 +1,28 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createTwilioProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name + "+12065550100", // from (optional) + "<ACCOUNT_SID>", // accountSid (optional) + "<AUTH_TOKEN>", // authToken (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-vonage-provider.md b/docs/examples/java/messaging/create-vonage-provider.md new file mode 100644 index 0000000..e7ee86b --- /dev/null +++ b/docs/examples/java/messaging/create-vonage-provider.md @@ -0,0 +1,28 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createVonageProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name + "+12065550100", // from (optional) + "<API_KEY>", // apiKey (optional) + "<API_SECRET>", // apiSecret (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/delete-provider.md b/docs/examples/java/messaging/delete-provider.md new file mode 100644 index 0000000..f980650 --- /dev/null +++ b/docs/examples/java/messaging/delete-provider.md @@ -0,0 +1,23 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.deleteProvider( + "<PROVIDER_ID>", // providerId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/delete-subscriber.md b/docs/examples/java/messaging/delete-subscriber.md new file mode 100644 index 0000000..ba02c12 --- /dev/null +++ b/docs/examples/java/messaging/delete-subscriber.md @@ -0,0 +1,24 @@ +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("5df5acd0d48c2") // Your project ID + .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + +Messaging messaging = new Messaging(client); + +messaging.deleteSubscriber( + "<TOPIC_ID>", // topicId + "<SUBSCRIBER_ID>", // subscriberId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/delete-topic.md b/docs/examples/java/messaging/delete-topic.md new file mode 100644 index 0000000..17aefe1 --- /dev/null +++ b/docs/examples/java/messaging/delete-topic.md @@ -0,0 +1,23 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.deleteTopic( + "<TOPIC_ID>", // topicId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/delete.md b/docs/examples/java/messaging/delete.md new file mode 100644 index 0000000..1565f8b --- /dev/null +++ b/docs/examples/java/messaging/delete.md @@ -0,0 +1,23 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.delete( + "<MESSAGE_ID>", // messageId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/get-message.md b/docs/examples/java/messaging/get-message.md new file mode 100644 index 0000000..9129a20 --- /dev/null +++ b/docs/examples/java/messaging/get-message.md @@ -0,0 +1,23 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.getMessage( + "<MESSAGE_ID>", // messageId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/get-provider.md b/docs/examples/java/messaging/get-provider.md new file mode 100644 index 0000000..704a2b2 --- /dev/null +++ b/docs/examples/java/messaging/get-provider.md @@ -0,0 +1,23 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.getProvider( + "<PROVIDER_ID>", // providerId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/get-subscriber.md b/docs/examples/java/messaging/get-subscriber.md new file mode 100644 index 0000000..53638ef --- /dev/null +++ b/docs/examples/java/messaging/get-subscriber.md @@ -0,0 +1,24 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.getSubscriber( + "<TOPIC_ID>", // topicId + "<SUBSCRIBER_ID>", // subscriberId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/get-topic.md b/docs/examples/java/messaging/get-topic.md new file mode 100644 index 0000000..3e8ad4c --- /dev/null +++ b/docs/examples/java/messaging/get-topic.md @@ -0,0 +1,23 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.getTopic( + "<TOPIC_ID>", // topicId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/list-message-logs.md b/docs/examples/java/messaging/list-message-logs.md new file mode 100644 index 0000000..224c2ef --- /dev/null +++ b/docs/examples/java/messaging/list-message-logs.md @@ -0,0 +1,24 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.listMessageLogs( + "<MESSAGE_ID>", // messageId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/list-messages.md b/docs/examples/java/messaging/list-messages.md new file mode 100644 index 0000000..7b31e16 --- /dev/null +++ b/docs/examples/java/messaging/list-messages.md @@ -0,0 +1,24 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.listMessages( + listOf(), // queries (optional) + "<SEARCH>", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/list-provider-logs.md b/docs/examples/java/messaging/list-provider-logs.md new file mode 100644 index 0000000..1cda4d1 --- /dev/null +++ b/docs/examples/java/messaging/list-provider-logs.md @@ -0,0 +1,24 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.listProviderLogs( + "<PROVIDER_ID>", // providerId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/list-providers.md b/docs/examples/java/messaging/list-providers.md new file mode 100644 index 0000000..a524933 --- /dev/null +++ b/docs/examples/java/messaging/list-providers.md @@ -0,0 +1,24 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.listProviders( + listOf(), // queries (optional) + "<SEARCH>", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/list-subscriber-logs.md b/docs/examples/java/messaging/list-subscriber-logs.md new file mode 100644 index 0000000..3cab923 --- /dev/null +++ b/docs/examples/java/messaging/list-subscriber-logs.md @@ -0,0 +1,24 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.listSubscriberLogs( + "<SUBSCRIBER_ID>", // subscriberId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/list-subscribers.md b/docs/examples/java/messaging/list-subscribers.md new file mode 100644 index 0000000..1250442 --- /dev/null +++ b/docs/examples/java/messaging/list-subscribers.md @@ -0,0 +1,25 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.listSubscribers( + "<TOPIC_ID>", // topicId + listOf(), // queries (optional) + "<SEARCH>", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/list-targets.md b/docs/examples/java/messaging/list-targets.md new file mode 100644 index 0000000..32a621c --- /dev/null +++ b/docs/examples/java/messaging/list-targets.md @@ -0,0 +1,24 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.listTargets( + "<MESSAGE_ID>", // messageId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/list-topic-logs.md b/docs/examples/java/messaging/list-topic-logs.md new file mode 100644 index 0000000..4e00e16 --- /dev/null +++ b/docs/examples/java/messaging/list-topic-logs.md @@ -0,0 +1,24 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.listTopicLogs( + "<TOPIC_ID>", // topicId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/list-topics.md b/docs/examples/java/messaging/list-topics.md new file mode 100644 index 0000000..91b843e --- /dev/null +++ b/docs/examples/java/messaging/list-topics.md @@ -0,0 +1,24 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.listTopics( + listOf(), // queries (optional) + "<SEARCH>", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/update-apns-provider.md b/docs/examples/java/messaging/update-apns-provider.md new file mode 100644 index 0000000..14873be --- /dev/null +++ b/docs/examples/java/messaging/update-apns-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateApnsProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name (optional) + false, // enabled (optional) + "<AUTH_KEY>", // authKey (optional) + "<AUTH_KEY_ID>", // authKeyId (optional) + "<TEAM_ID>", // teamId (optional) + "<BUNDLE_ID>", // 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-email.md b/docs/examples/java/messaging/update-email.md new file mode 100644 index 0000000..1bfa2d0 --- /dev/null +++ b/docs/examples/java/messaging/update-email.md @@ -0,0 +1,33 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateEmail( + "<MESSAGE_ID>", // messageId + listOf(), // topics (optional) + listOf(), // users (optional) + listOf(), // targets (optional) + "<SUBJECT>", // subject (optional) + "<CONTENT>", // content (optional) + false, // draft (optional) + false, // html (optional) + listOf(), // cc (optional) + listOf(), // bcc (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-fcm-provider.md b/docs/examples/java/messaging/update-fcm-provider.md new file mode 100644 index 0000000..631bdf4 --- /dev/null +++ b/docs/examples/java/messaging/update-fcm-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateFcmProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // 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-mailgun-provider.md b/docs/examples/java/messaging/update-mailgun-provider.md new file mode 100644 index 0000000..881dc3e --- /dev/null +++ b/docs/examples/java/messaging/update-mailgun-provider.md @@ -0,0 +1,32 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateMailgunProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name (optional) + "<API_KEY>", // apiKey (optional) + "<DOMAIN>", // domain (optional) + false, // isEuRegion (optional) + false, // enabled (optional) + "<FROM_NAME>", // fromName (optional) + "email@example.com", // fromEmail (optional) + "<REPLY_TO_NAME>", // replyToName (optional) + "<REPLY_TO_EMAIL>", // replyToEmail (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/update-msg91provider.md b/docs/examples/java/messaging/update-msg91provider.md new file mode 100644 index 0000000..b9ba21d --- /dev/null +++ b/docs/examples/java/messaging/update-msg91provider.md @@ -0,0 +1,28 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateMsg91Provider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name (optional) + false, // enabled (optional) + "<SENDER_ID>", // senderId (optional) + "<AUTH_KEY>", // authKey (optional) + "<FROM>", // from (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/update-push.md b/docs/examples/java/messaging/update-push.md new file mode 100644 index 0000000..468f958 --- /dev/null +++ b/docs/examples/java/messaging/update-push.md @@ -0,0 +1,38 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updatePush( + "<MESSAGE_ID>", // messageId + listOf(), // topics (optional) + listOf(), // users (optional) + listOf(), // targets (optional) + "<TITLE>", // title (optional) + "<BODY>", // body (optional) + mapOf( "a" to "b" ), // data (optional) + "<ACTION>", // action (optional) + "[ID1:ID2]", // image (optional) + "<ICON>", // icon (optional) + "<SOUND>", // sound (optional) + "<COLOR>", // color (optional) + "<TAG>", // tag (optional) + 0, // badge (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-sendgrid-provider.md b/docs/examples/java/messaging/update-sendgrid-provider.md new file mode 100644 index 0000000..099a617 --- /dev/null +++ b/docs/examples/java/messaging/update-sendgrid-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateSendgridProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name (optional) + false, // enabled (optional) + "<API_KEY>", // apiKey (optional) + "<FROM_NAME>", // fromName (optional) + "email@example.com", // fromEmail (optional) + "<REPLY_TO_NAME>", // replyToName (optional) + "<REPLY_TO_EMAIL>", // replyToEmail (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/update-sms.md b/docs/examples/java/messaging/update-sms.md new file mode 100644 index 0000000..913bd59 --- /dev/null +++ b/docs/examples/java/messaging/update-sms.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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateSms( + "<MESSAGE_ID>", // messageId + listOf(), // topics (optional) + listOf(), // users (optional) + listOf(), // targets (optional) + "<CONTENT>", // 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-smtp-provider.md b/docs/examples/java/messaging/update-smtp-provider.md new file mode 100644 index 0000000..4bc5017 --- /dev/null +++ b/docs/examples/java/messaging/update-smtp-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateSmtpProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name (optional) + "<HOST>", // host (optional) + 1, // port (optional) + "<USERNAME>", // username (optional) + "<PASSWORD>", // password (optional) + SmtpEncryption.NONE, // encryption (optional) + false, // autoTLS (optional) + "<MAILER>", // mailer (optional) + "<FROM_NAME>", // fromName (optional) + "email@example.com", // fromEmail (optional) + "<REPLY_TO_NAME>", // replyToName (optional) + "<REPLY_TO_EMAIL>", // 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-telesign-provider.md b/docs/examples/java/messaging/update-telesign-provider.md new file mode 100644 index 0000000..31ab356 --- /dev/null +++ b/docs/examples/java/messaging/update-telesign-provider.md @@ -0,0 +1,28 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateTelesignProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name (optional) + false, // enabled (optional) + "<CUSTOMER_ID>", // customerId (optional) + "<API_KEY>", // apiKey (optional) + "<FROM>", // from (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/update-textmagic-provider.md b/docs/examples/java/messaging/update-textmagic-provider.md new file mode 100644 index 0000000..c4013dd --- /dev/null +++ b/docs/examples/java/messaging/update-textmagic-provider.md @@ -0,0 +1,28 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateTextmagicProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name (optional) + false, // enabled (optional) + "<USERNAME>", // username (optional) + "<API_KEY>", // apiKey (optional) + "<FROM>", // from (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/update-topic.md b/docs/examples/java/messaging/update-topic.md new file mode 100644 index 0000000..0c6d41f --- /dev/null +++ b/docs/examples/java/messaging/update-topic.md @@ -0,0 +1,25 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateTopic( + "<TOPIC_ID>", // topicId + "<NAME>", // name (optional) + listOf("any"), // subscribe (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/update-twilio-provider.md b/docs/examples/java/messaging/update-twilio-provider.md new file mode 100644 index 0000000..7f8980d --- /dev/null +++ b/docs/examples/java/messaging/update-twilio-provider.md @@ -0,0 +1,28 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateTwilioProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name (optional) + false, // enabled (optional) + "<ACCOUNT_SID>", // accountSid (optional) + "<AUTH_TOKEN>", // authToken (optional) + "<FROM>", // from (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/messaging/update-vonage-provider.md b/docs/examples/java/messaging/update-vonage-provider.md new file mode 100644 index 0000000..7bbb06e --- /dev/null +++ b/docs/examples/java/messaging/update-vonage-provider.md @@ -0,0 +1,28 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateVonageProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name (optional) + false, // enabled (optional) + "<API_KEY>", // apiKey (optional) + "<API_SECRET>", // apiSecret (optional) + "<FROM>", // from (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/storage/create-bucket.md b/docs/examples/java/storage/create-bucket.md index c9ebc91..735aef7 100644 --- a/docs/examples/java/storage/create-bucket.md +++ b/docs/examples/java/storage/create-bucket.md @@ -10,8 +10,16 @@ Client client = new Client() Storage storage = new Storage(client); storage.createBucket( - "[BUCKET_ID]", - "[NAME]", + "<BUCKET_ID>", // bucketId + "<NAME>", // name + listOf("read("any")"), // permissions (optional) + false, // fileSecurity (optional) + false, // enabled (optional) + 1, // maximumFileSize (optional) + listOf(), // allowedFileExtensions (optional) + .NONE, // compression (optional) + false, // encryption (optional) + false, // antivirus (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +29,4 @@ storage.createBucket( System.out.println(result); }) ); + diff --git a/docs/examples/java/storage/create-file.md b/docs/examples/java/storage/create-file.md index c83557b..275724f 100644 --- a/docs/examples/java/storage/create-file.md +++ b/docs/examples/java/storage/create-file.md @@ -6,14 +6,15 @@ import io.appwrite.services.Storage; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Storage storage = new Storage(client); storage.createFile( - "[BUCKET_ID]", - "[FILE_ID]", - InputFile.fromPath("file.png"), + "<BUCKET_ID>", // bucketId + "<FILE_ID>", // fileId + InputFile.fromPath("file.png"), // file + listOf("read("any")"), // permissions (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -23,3 +24,4 @@ storage.createFile( System.out.println(result); }) ); + diff --git a/docs/examples/java/storage/delete-bucket.md b/docs/examples/java/storage/delete-bucket.md index f26e9ee..e6e3d12 100644 --- a/docs/examples/java/storage/delete-bucket.md +++ b/docs/examples/java/storage/delete-bucket.md @@ -10,7 +10,7 @@ Client client = new Client() Storage storage = new Storage(client); storage.deleteBucket( - "[BUCKET_ID]" + "<BUCKET_ID>", // bucketId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ storage.deleteBucket( System.out.println(result); }) ); + diff --git a/docs/examples/java/storage/delete-file.md b/docs/examples/java/storage/delete-file.md index eb00b97..af498b4 100644 --- a/docs/examples/java/storage/delete-file.md +++ b/docs/examples/java/storage/delete-file.md @@ -5,13 +5,13 @@ import io.appwrite.services.Storage; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Storage storage = new Storage(client); storage.deleteFile( - "[BUCKET_ID]", - "[FILE_ID]" + "<BUCKET_ID>", // bucketId + "<FILE_ID>", // fileId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ storage.deleteFile( System.out.println(result); }) ); + diff --git a/docs/examples/java/storage/get-bucket.md b/docs/examples/java/storage/get-bucket.md index 2157dd7..e225985 100644 --- a/docs/examples/java/storage/get-bucket.md +++ b/docs/examples/java/storage/get-bucket.md @@ -10,7 +10,7 @@ Client client = new Client() Storage storage = new Storage(client); storage.getBucket( - "[BUCKET_ID]" + "<BUCKET_ID>", // bucketId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ storage.getBucket( System.out.println(result); }) ); + diff --git a/docs/examples/java/storage/get-file-download.md b/docs/examples/java/storage/get-file-download.md index 8eef7e3..171cfd6 100644 --- a/docs/examples/java/storage/get-file-download.md +++ b/docs/examples/java/storage/get-file-download.md @@ -5,13 +5,13 @@ import io.appwrite.services.Storage; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Storage storage = new Storage(client); storage.getFileDownload( - "[BUCKET_ID]", - "[FILE_ID]" + "<BUCKET_ID>", // bucketId + "<FILE_ID>", // fileId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ storage.getFileDownload( System.out.println(result); }) ); + diff --git a/docs/examples/java/storage/get-file-preview.md b/docs/examples/java/storage/get-file-preview.md index 275e803..17d6e68 100644 --- a/docs/examples/java/storage/get-file-preview.md +++ b/docs/examples/java/storage/get-file-preview.md @@ -5,13 +5,24 @@ import io.appwrite.services.Storage; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Storage storage = new Storage(client); storage.getFilePreview( - "[BUCKET_ID]", - "[FILE_ID]", + "<BUCKET_ID>", // bucketId + "<FILE_ID>", // fileId + 0, // width (optional) + 0, // height (optional) + ImageGravity.CENTER, // gravity (optional) + 0, // quality (optional) + 0, // borderWidth (optional) + "", // borderColor (optional) + 0, // borderRadius (optional) + 0, // opacity (optional) + -360, // rotation (optional) + "", // background (optional) + ImageFormat.JPG, // output (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +32,4 @@ storage.getFilePreview( System.out.println(result); }) ); + diff --git a/docs/examples/java/storage/get-file-view.md b/docs/examples/java/storage/get-file-view.md index adc0407..fc90ab9 100644 --- a/docs/examples/java/storage/get-file-view.md +++ b/docs/examples/java/storage/get-file-view.md @@ -5,13 +5,13 @@ import io.appwrite.services.Storage; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Storage storage = new Storage(client); storage.getFileView( - "[BUCKET_ID]", - "[FILE_ID]" + "<BUCKET_ID>", // bucketId + "<FILE_ID>", // fileId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ storage.getFileView( System.out.println(result); }) ); + diff --git a/docs/examples/java/storage/get-file.md b/docs/examples/java/storage/get-file.md index 4cb6fe6..edcba74 100644 --- a/docs/examples/java/storage/get-file.md +++ b/docs/examples/java/storage/get-file.md @@ -5,13 +5,13 @@ import io.appwrite.services.Storage; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Storage storage = new Storage(client); storage.getFile( - "[BUCKET_ID]", - "[FILE_ID]" + "<BUCKET_ID>", // bucketId + "<FILE_ID>", // fileId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ storage.getFile( System.out.println(result); }) ); + diff --git a/docs/examples/java/storage/list-buckets.md b/docs/examples/java/storage/list-buckets.md index 49c29ca..7e1e934 100644 --- a/docs/examples/java/storage/list-buckets.md +++ b/docs/examples/java/storage/list-buckets.md @@ -10,6 +10,8 @@ Client client = new Client() Storage storage = new Storage(client); storage.listBuckets( + listOf(), // queries (optional) + "<SEARCH>", // search (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -19,3 +21,4 @@ storage.listBuckets( System.out.println(result); }) ); + diff --git a/docs/examples/java/storage/list-files.md b/docs/examples/java/storage/list-files.md index 59719e5..cf1f9a0 100644 --- a/docs/examples/java/storage/list-files.md +++ b/docs/examples/java/storage/list-files.md @@ -5,12 +5,14 @@ import io.appwrite.services.Storage; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Storage storage = new Storage(client); storage.listFiles( - "[BUCKET_ID]", + "<BUCKET_ID>", // bucketId + listOf(), // queries (optional) + "<SEARCH>", // search (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +22,4 @@ storage.listFiles( System.out.println(result); }) ); + diff --git a/docs/examples/java/storage/update-bucket.md b/docs/examples/java/storage/update-bucket.md index 05483ea..ade3a57 100644 --- a/docs/examples/java/storage/update-bucket.md +++ b/docs/examples/java/storage/update-bucket.md @@ -10,8 +10,16 @@ Client client = new Client() Storage storage = new Storage(client); storage.updateBucket( - "[BUCKET_ID]", - "[NAME]", + "<BUCKET_ID>", // bucketId + "<NAME>", // name + listOf("read("any")"), // permissions (optional) + false, // fileSecurity (optional) + false, // enabled (optional) + 1, // maximumFileSize (optional) + listOf(), // allowedFileExtensions (optional) + .NONE, // compression (optional) + false, // encryption (optional) + false, // antivirus (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +29,4 @@ storage.updateBucket( System.out.println(result); }) ); + diff --git a/docs/examples/java/storage/update-file.md b/docs/examples/java/storage/update-file.md index 05385c2..961228c 100644 --- a/docs/examples/java/storage/update-file.md +++ b/docs/examples/java/storage/update-file.md @@ -5,13 +5,15 @@ import io.appwrite.services.Storage; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Storage storage = new Storage(client); storage.updateFile( - "[BUCKET_ID]", - "[FILE_ID]", + "<BUCKET_ID>", // bucketId + "<FILE_ID>", // fileId + "<NAME>", // name (optional) + listOf("read("any")"), // permissions (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +23,4 @@ storage.updateFile( System.out.println(result); }) ); + diff --git a/docs/examples/java/teams/create-membership.md b/docs/examples/java/teams/create-membership.md index 295674f..c16dd83 100644 --- a/docs/examples/java/teams/create-membership.md +++ b/docs/examples/java/teams/create-membership.md @@ -5,13 +5,18 @@ import io.appwrite.services.Teams; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Teams teams = new Teams(client); teams.createMembership( - "[TEAM_ID]", - listOf(), + "<TEAM_ID>", // teamId + listOf(), // roles + "email@example.com", // email (optional) + "<USER_ID>", // userId (optional) + "+12065550100", // phone (optional) + "https://example.com", // url (optional) + "<NAME>", // name (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +26,4 @@ teams.createMembership( System.out.println(result); }) ); + diff --git a/docs/examples/java/teams/create.md b/docs/examples/java/teams/create.md index 4f3be33..b709bc7 100644 --- a/docs/examples/java/teams/create.md +++ b/docs/examples/java/teams/create.md @@ -5,13 +5,14 @@ import io.appwrite.services.Teams; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Teams teams = new Teams(client); teams.create( - "[TEAM_ID]", - "[NAME]", + "<TEAM_ID>", // teamId + "<NAME>", // name + listOf(), // roles (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +22,4 @@ teams.create( System.out.println(result); }) ); + diff --git a/docs/examples/java/teams/delete-membership.md b/docs/examples/java/teams/delete-membership.md index e82ab29..25e3a39 100644 --- a/docs/examples/java/teams/delete-membership.md +++ b/docs/examples/java/teams/delete-membership.md @@ -5,13 +5,13 @@ import io.appwrite.services.Teams; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Teams teams = new Teams(client); teams.deleteMembership( - "[TEAM_ID]", - "[MEMBERSHIP_ID]" + "<TEAM_ID>", // teamId + "<MEMBERSHIP_ID>", // membershipId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ teams.deleteMembership( System.out.println(result); }) ); + diff --git a/docs/examples/java/teams/delete.md b/docs/examples/java/teams/delete.md index fa805eb..3bdd838 100644 --- a/docs/examples/java/teams/delete.md +++ b/docs/examples/java/teams/delete.md @@ -5,12 +5,12 @@ import io.appwrite.services.Teams; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Teams teams = new Teams(client); teams.delete( - "[TEAM_ID]" + "<TEAM_ID>", // teamId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ teams.delete( System.out.println(result); }) ); + diff --git a/docs/examples/java/teams/get-membership.md b/docs/examples/java/teams/get-membership.md index fc00d43..de1c052 100644 --- a/docs/examples/java/teams/get-membership.md +++ b/docs/examples/java/teams/get-membership.md @@ -5,13 +5,13 @@ import io.appwrite.services.Teams; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Teams teams = new Teams(client); teams.getMembership( - "[TEAM_ID]", - "[MEMBERSHIP_ID]" + "<TEAM_ID>", // teamId + "<MEMBERSHIP_ID>", // membershipId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ teams.getMembership( System.out.println(result); }) ); + diff --git a/docs/examples/java/teams/get-prefs.md b/docs/examples/java/teams/get-prefs.md index b14dfc9..8647443 100644 --- a/docs/examples/java/teams/get-prefs.md +++ b/docs/examples/java/teams/get-prefs.md @@ -5,12 +5,12 @@ import io.appwrite.services.Teams; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Teams teams = new Teams(client); teams.getPrefs( - "[TEAM_ID]" + "<TEAM_ID>", // teamId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ teams.getPrefs( System.out.println(result); }) ); + diff --git a/docs/examples/java/teams/get.md b/docs/examples/java/teams/get.md index 6be034b..3fd4ba7 100644 --- a/docs/examples/java/teams/get.md +++ b/docs/examples/java/teams/get.md @@ -5,12 +5,12 @@ import io.appwrite.services.Teams; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Teams teams = new Teams(client); teams.get( - "[TEAM_ID]" + "<TEAM_ID>", // teamId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ teams.get( System.out.println(result); }) ); + diff --git a/docs/examples/java/teams/list-memberships.md b/docs/examples/java/teams/list-memberships.md index 0b9055f..98b1096 100644 --- a/docs/examples/java/teams/list-memberships.md +++ b/docs/examples/java/teams/list-memberships.md @@ -5,12 +5,14 @@ import io.appwrite.services.Teams; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Teams teams = new Teams(client); teams.listMemberships( - "[TEAM_ID]", + "<TEAM_ID>", // teamId + listOf(), // queries (optional) + "<SEARCH>", // search (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +22,4 @@ teams.listMemberships( System.out.println(result); }) ); + diff --git a/docs/examples/java/teams/list.md b/docs/examples/java/teams/list.md index 22a9d51..c27e9fe 100644 --- a/docs/examples/java/teams/list.md +++ b/docs/examples/java/teams/list.md @@ -5,11 +5,13 @@ import io.appwrite.services.Teams; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Teams teams = new Teams(client); teams.list( + listOf(), // queries (optional) + "<SEARCH>", // search (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -19,3 +21,4 @@ teams.list( System.out.println(result); }) ); + diff --git a/docs/examples/java/teams/update-membership-status.md b/docs/examples/java/teams/update-membership-status.md index 64e6966..9c86c60 100644 --- a/docs/examples/java/teams/update-membership-status.md +++ b/docs/examples/java/teams/update-membership-status.md @@ -5,15 +5,15 @@ import io.appwrite.services.Teams; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Teams teams = new Teams(client); teams.updateMembershipStatus( - "[TEAM_ID]", - "[MEMBERSHIP_ID]", - "[USER_ID]", - "[SECRET]" + "<TEAM_ID>", // teamId + "<MEMBERSHIP_ID>", // membershipId + "<USER_ID>", // userId + "<SECRET>", // secret new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -23,3 +23,4 @@ teams.updateMembershipStatus( System.out.println(result); }) ); + diff --git a/docs/examples/java/teams/update-membership.md b/docs/examples/java/teams/update-membership.md index e1fd432..fd2abed 100644 --- a/docs/examples/java/teams/update-membership.md +++ b/docs/examples/java/teams/update-membership.md @@ -5,14 +5,14 @@ import io.appwrite.services.Teams; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Teams teams = new Teams(client); teams.updateMembership( - "[TEAM_ID]", - "[MEMBERSHIP_ID]", - listOf() + "<TEAM_ID>", // teamId + "<MEMBERSHIP_ID>", // membershipId + listOf(), // roles new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -22,3 +22,4 @@ teams.updateMembership( System.out.println(result); }) ); + diff --git a/docs/examples/java/teams/update-name.md b/docs/examples/java/teams/update-name.md index 3d95ccb..96f5032 100644 --- a/docs/examples/java/teams/update-name.md +++ b/docs/examples/java/teams/update-name.md @@ -5,13 +5,13 @@ import io.appwrite.services.Teams; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + .setSession(""); // The user session to authenticate with Teams teams = new Teams(client); teams.updateName( - "[TEAM_ID]", - "[NAME]" + "<TEAM_ID>", // teamId + "<NAME>", // name new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ teams.updateName( System.out.println(result); }) ); + diff --git a/docs/examples/java/teams/update-prefs.md b/docs/examples/java/teams/update-prefs.md index 674bc64..790fa3e 100644 --- a/docs/examples/java/teams/update-prefs.md +++ b/docs/examples/java/teams/update-prefs.md @@ -5,13 +5,13 @@ import io.appwrite.services.Teams; Client client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + .setSession(""); // The user session to authenticate with Teams teams = new Teams(client); teams.updatePrefs( - "[TEAM_ID]", - mapOf( "a" to "b" ) + "<TEAM_ID>", // teamId + mapOf( "a" to "b" ), // prefs new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ teams.updatePrefs( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/create-argon2user.md b/docs/examples/java/users/create-argon2user.md index 47ac52c..4e6a257 100644 --- a/docs/examples/java/users/create-argon2user.md +++ b/docs/examples/java/users/create-argon2user.md @@ -10,9 +10,10 @@ Client client = new Client() Users users = new Users(client); users.createArgon2User( - "[USER_ID]", - "email@example.com", - "password", + "<USER_ID>", // userId + "email@example.com", // email + "password", // password + "<NAME>", // name (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -22,3 +23,4 @@ users.createArgon2User( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/create-bcrypt-user.md b/docs/examples/java/users/create-bcrypt-user.md index 91989df..8faeb03 100644 --- a/docs/examples/java/users/create-bcrypt-user.md +++ b/docs/examples/java/users/create-bcrypt-user.md @@ -10,9 +10,10 @@ Client client = new Client() Users users = new Users(client); users.createBcryptUser( - "[USER_ID]", - "email@example.com", - "password", + "<USER_ID>", // userId + "email@example.com", // email + "password", // password + "<NAME>", // name (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -22,3 +23,4 @@ users.createBcryptUser( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/create-m-d5user.md b/docs/examples/java/users/create-m-d5user.md index 35de18d..134db69 100644 --- a/docs/examples/java/users/create-m-d5user.md +++ b/docs/examples/java/users/create-m-d5user.md @@ -10,9 +10,10 @@ Client client = new Client() Users users = new Users(client); users.createMD5User( - "[USER_ID]", - "email@example.com", - "password", + "<USER_ID>", // userId + "email@example.com", // email + "password", // password + "<NAME>", // name (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -22,3 +23,4 @@ users.createMD5User( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/create-mfa-recovery-codes.md b/docs/examples/java/users/create-mfa-recovery-codes.md new file mode 100644 index 0000000..5e7e665 --- /dev/null +++ b/docs/examples/java/users/create-mfa-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Users users = new Users(client); + +users.createMfaRecoveryCodes( + "<USER_ID>", // userId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/users/create-p-h-pass-user.md b/docs/examples/java/users/create-p-h-pass-user.md index 7501f02..48f9070 100644 --- a/docs/examples/java/users/create-p-h-pass-user.md +++ b/docs/examples/java/users/create-p-h-pass-user.md @@ -10,9 +10,10 @@ Client client = new Client() Users users = new Users(client); users.createPHPassUser( - "[USER_ID]", - "email@example.com", - "password", + "<USER_ID>", // userId + "email@example.com", // email + "password", // password + "<NAME>", // name (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -22,3 +23,4 @@ users.createPHPassUser( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/create-s-h-a-user.md b/docs/examples/java/users/create-s-h-a-user.md index ae26de5..b10674c 100644 --- a/docs/examples/java/users/create-s-h-a-user.md +++ b/docs/examples/java/users/create-s-h-a-user.md @@ -10,9 +10,11 @@ Client client = new Client() Users users = new Users(client); users.createSHAUser( - "[USER_ID]", - "email@example.com", - "password", + "<USER_ID>", // userId + "email@example.com", // email + "password", // password + PasswordHash.SHA1, // passwordVersion (optional) + "<NAME>", // name (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -22,3 +24,4 @@ users.createSHAUser( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/create-scrypt-modified-user.md b/docs/examples/java/users/create-scrypt-modified-user.md index da0936a..eb06445 100644 --- a/docs/examples/java/users/create-scrypt-modified-user.md +++ b/docs/examples/java/users/create-scrypt-modified-user.md @@ -10,12 +10,13 @@ Client client = new Client() Users users = new Users(client); users.createScryptModifiedUser( - "[USER_ID]", - "email@example.com", - "password", - "[PASSWORD_SALT]", - "[PASSWORD_SALT_SEPARATOR]", - "[PASSWORD_SIGNER_KEY]", + "<USER_ID>", // userId + "email@example.com", // email + "password", // password + "<PASSWORD_SALT>", // passwordSalt + "<PASSWORD_SALT_SEPARATOR>", // passwordSaltSeparator + "<PASSWORD_SIGNER_KEY>", // passwordSignerKey + "<NAME>", // name (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -25,3 +26,4 @@ users.createScryptModifiedUser( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/create-scrypt-user.md b/docs/examples/java/users/create-scrypt-user.md index 9b48e06..a98d50b 100644 --- a/docs/examples/java/users/create-scrypt-user.md +++ b/docs/examples/java/users/create-scrypt-user.md @@ -10,14 +10,15 @@ Client client = new Client() Users users = new Users(client); users.createScryptUser( - "[USER_ID]", - "email@example.com", - "password", - "[PASSWORD_SALT]", - 0, - 0, - 0, - 0, + "<USER_ID>", // userId + "email@example.com", // email + "password", // password + "<PASSWORD_SALT>", // passwordSalt + 0, // passwordCpu + 0, // passwordMemory + 0, // passwordParallel + 0, // passwordLength + "<NAME>", // name (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -27,3 +28,4 @@ users.createScryptUser( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/create-session.md b/docs/examples/java/users/create-session.md new file mode 100644 index 0000000..8b20589 --- /dev/null +++ b/docs/examples/java/users/create-session.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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Users users = new Users(client); + +users.createSession( + "<USER_ID>", // userId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/users/create-target.md b/docs/examples/java/users/create-target.md new file mode 100644 index 0000000..5b38772 --- /dev/null +++ b/docs/examples/java/users/create-target.md @@ -0,0 +1,29 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; +import io.appwrite.enums.MessagingProviderType; + +Client client = new Client() + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Users users = new Users(client); + +users.createTarget( + "<USER_ID>", // userId + "<TARGET_ID>", // targetId + MessagingProviderType.EMAIL, // providerType + "<IDENTIFIER>", // identifier + "<PROVIDER_ID>", // providerId (optional) + "<NAME>", // name (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/users/create-token.md b/docs/examples/java/users/create-token.md new file mode 100644 index 0000000..44f0a3c --- /dev/null +++ b/docs/examples/java/users/create-token.md @@ -0,0 +1,25 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Users users = new Users(client); + +users.createToken( + "<USER_ID>", // userId + 4, // length (optional) + 60, // expire (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/users/create.md b/docs/examples/java/users/create.md index 97aad15..89eb328 100644 --- a/docs/examples/java/users/create.md +++ b/docs/examples/java/users/create.md @@ -10,7 +10,11 @@ Client client = new Client() Users users = new Users(client); users.create( - "[USER_ID]", + "<USER_ID>", // userId + "email@example.com", // email (optional) + "+12065550100", // phone (optional) + "", // password (optional) + "<NAME>", // name (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +24,4 @@ users.create( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/delete-identity.md b/docs/examples/java/users/delete-identity.md index cd165a6..54459cd 100644 --- a/docs/examples/java/users/delete-identity.md +++ b/docs/examples/java/users/delete-identity.md @@ -10,7 +10,7 @@ Client client = new Client() Users users = new Users(client); users.deleteIdentity( - "[IDENTITY_ID]" + "<IDENTITY_ID>", // identityId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ users.deleteIdentity( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/delete-mfa-authenticator.md b/docs/examples/java/users/delete-mfa-authenticator.md new file mode 100644 index 0000000..df3691f --- /dev/null +++ b/docs/examples/java/users/delete-mfa-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Users users = new Users(client); + +users.deleteMfaAuthenticator( + "<USER_ID>", // 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/delete-session.md b/docs/examples/java/users/delete-session.md index 8415328..3eaaef2 100644 --- a/docs/examples/java/users/delete-session.md +++ b/docs/examples/java/users/delete-session.md @@ -10,8 +10,8 @@ Client client = new Client() Users users = new Users(client); users.deleteSession( - "[USER_ID]", - "[SESSION_ID]" + "<USER_ID>", // userId + "<SESSION_ID>", // sessionId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ users.deleteSession( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/delete-sessions.md b/docs/examples/java/users/delete-sessions.md index 9a2284c..63981e7 100644 --- a/docs/examples/java/users/delete-sessions.md +++ b/docs/examples/java/users/delete-sessions.md @@ -10,7 +10,7 @@ Client client = new Client() Users users = new Users(client); users.deleteSessions( - "[USER_ID]" + "<USER_ID>", // userId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ users.deleteSessions( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/delete-target.md b/docs/examples/java/users/delete-target.md new file mode 100644 index 0000000..6a703fa --- /dev/null +++ b/docs/examples/java/users/delete-target.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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Users users = new Users(client); + +users.deleteTarget( + "<USER_ID>", // userId + "<TARGET_ID>", // targetId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/users/delete.md b/docs/examples/java/users/delete.md index 893a4d3..4dfbe94 100644 --- a/docs/examples/java/users/delete.md +++ b/docs/examples/java/users/delete.md @@ -10,7 +10,7 @@ Client client = new Client() Users users = new Users(client); users.delete( - "[USER_ID]" + "<USER_ID>", // userId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ users.delete( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/get-mfa-recovery-codes.md b/docs/examples/java/users/get-mfa-recovery-codes.md new file mode 100644 index 0000000..13ffbb3 --- /dev/null +++ b/docs/examples/java/users/get-mfa-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Users users = new Users(client); + +users.getMfaRecoveryCodes( + "<USER_ID>", // userId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/users/get-prefs.md b/docs/examples/java/users/get-prefs.md index 664843e..a1dc1c0 100644 --- a/docs/examples/java/users/get-prefs.md +++ b/docs/examples/java/users/get-prefs.md @@ -10,7 +10,7 @@ Client client = new Client() Users users = new Users(client); users.getPrefs( - "[USER_ID]" + "<USER_ID>", // userId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ users.getPrefs( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/get-target.md b/docs/examples/java/users/get-target.md new file mode 100644 index 0000000..c5674c7 --- /dev/null +++ b/docs/examples/java/users/get-target.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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Users users = new Users(client); + +users.getTarget( + "<USER_ID>", // userId + "<TARGET_ID>", // targetId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/users/get.md b/docs/examples/java/users/get.md index 1be96ae..55060b5 100644 --- a/docs/examples/java/users/get.md +++ b/docs/examples/java/users/get.md @@ -10,7 +10,7 @@ Client client = new Client() Users users = new Users(client); users.get( - "[USER_ID]" + "<USER_ID>", // userId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ users.get( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/list-identities.md b/docs/examples/java/users/list-identities.md index 011f3a6..16724f0 100644 --- a/docs/examples/java/users/list-identities.md +++ b/docs/examples/java/users/list-identities.md @@ -10,6 +10,8 @@ Client client = new Client() Users users = new Users(client); users.listIdentities( + listOf(), // queries (optional) + "<SEARCH>", // search (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -19,3 +21,4 @@ users.listIdentities( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/list-logs.md b/docs/examples/java/users/list-logs.md index 08ace35..6a38abb 100644 --- a/docs/examples/java/users/list-logs.md +++ b/docs/examples/java/users/list-logs.md @@ -10,7 +10,8 @@ Client client = new Client() Users users = new Users(client); users.listLogs( - "[USER_ID]", + "<USER_ID>", // userId + listOf(), // queries (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +21,4 @@ users.listLogs( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/list-memberships.md b/docs/examples/java/users/list-memberships.md index 503dbcb..240f6f9 100644 --- a/docs/examples/java/users/list-memberships.md +++ b/docs/examples/java/users/list-memberships.md @@ -10,7 +10,7 @@ Client client = new Client() Users users = new Users(client); users.listMemberships( - "[USER_ID]" + "<USER_ID>", // userId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ users.listMemberships( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/list-mfa-factors.md b/docs/examples/java/users/list-mfa-factors.md new file mode 100644 index 0000000..ee28831 --- /dev/null +++ b/docs/examples/java/users/list-mfa-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Users users = new Users(client); + +users.listMfaFactors( + "<USER_ID>", // userId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/users/list-sessions.md b/docs/examples/java/users/list-sessions.md index efe091f..680bee0 100644 --- a/docs/examples/java/users/list-sessions.md +++ b/docs/examples/java/users/list-sessions.md @@ -10,7 +10,7 @@ Client client = new Client() Users users = new Users(client); users.listSessions( - "[USER_ID]" + "<USER_ID>", // userId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -20,3 +20,4 @@ users.listSessions( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/list-targets.md b/docs/examples/java/users/list-targets.md new file mode 100644 index 0000000..6e925eb --- /dev/null +++ b/docs/examples/java/users/list-targets.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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Users users = new Users(client); + +users.listTargets( + "<USER_ID>", // userId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/users/list.md b/docs/examples/java/users/list.md index d591bce..9d8b0a7 100644 --- a/docs/examples/java/users/list.md +++ b/docs/examples/java/users/list.md @@ -10,6 +10,8 @@ Client client = new Client() Users users = new Users(client); users.list( + listOf(), // queries (optional) + "<SEARCH>", // search (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -19,3 +21,4 @@ users.list( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/update-email-verification.md b/docs/examples/java/users/update-email-verification.md index 3d6d205..7770ee4 100644 --- a/docs/examples/java/users/update-email-verification.md +++ b/docs/examples/java/users/update-email-verification.md @@ -10,8 +10,8 @@ Client client = new Client() Users users = new Users(client); users.updateEmailVerification( - "[USER_ID]", - false + "<USER_ID>", // userId + false, // emailVerification new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ users.updateEmailVerification( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/update-email.md b/docs/examples/java/users/update-email.md index d0e9b17..bc9407b 100644 --- a/docs/examples/java/users/update-email.md +++ b/docs/examples/java/users/update-email.md @@ -10,8 +10,8 @@ Client client = new Client() Users users = new Users(client); users.updateEmail( - "[USER_ID]", - "email@example.com" + "<USER_ID>", // userId + "email@example.com", // email new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ users.updateEmail( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/update-labels.md b/docs/examples/java/users/update-labels.md index e0c7bdc..6b3c81b 100644 --- a/docs/examples/java/users/update-labels.md +++ b/docs/examples/java/users/update-labels.md @@ -10,8 +10,8 @@ Client client = new Client() Users users = new Users(client); users.updateLabels( - "[USER_ID]", - listOf() + "<USER_ID>", // userId + listOf(), // labels new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ users.updateLabels( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/update-mfa-recovery-codes.md b/docs/examples/java/users/update-mfa-recovery-codes.md new file mode 100644 index 0000000..34bdcc6 --- /dev/null +++ b/docs/examples/java/users/update-mfa-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Users users = new Users(client); + +users.updateMfaRecoveryCodes( + "<USER_ID>", // userId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/users/update-mfa.md b/docs/examples/java/users/update-mfa.md new file mode 100644 index 0000000..7630c81 --- /dev/null +++ b/docs/examples/java/users/update-mfa.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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Users users = new Users(client); + +users.updateMfa( + "<USER_ID>", // userId + false, // mfa + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/java/users/update-name.md b/docs/examples/java/users/update-name.md index e16f539..f2b8e98 100644 --- a/docs/examples/java/users/update-name.md +++ b/docs/examples/java/users/update-name.md @@ -10,8 +10,8 @@ Client client = new Client() Users users = new Users(client); users.updateName( - "[USER_ID]", - "[NAME]" + "<USER_ID>", // userId + "<NAME>", // name new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ users.updateName( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/update-password.md b/docs/examples/java/users/update-password.md index c94e6dd..4f5c58b 100644 --- a/docs/examples/java/users/update-password.md +++ b/docs/examples/java/users/update-password.md @@ -10,8 +10,8 @@ Client client = new Client() Users users = new Users(client); users.updatePassword( - "[USER_ID]", - "" + "<USER_ID>", // userId + "", // password new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ users.updatePassword( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/update-phone-verification.md b/docs/examples/java/users/update-phone-verification.md index 8c9a26d..58137b5 100644 --- a/docs/examples/java/users/update-phone-verification.md +++ b/docs/examples/java/users/update-phone-verification.md @@ -10,8 +10,8 @@ Client client = new Client() Users users = new Users(client); users.updatePhoneVerification( - "[USER_ID]", - false + "<USER_ID>", // userId + false, // phoneVerification new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ users.updatePhoneVerification( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/update-phone.md b/docs/examples/java/users/update-phone.md index 4a2accb..7b060aa 100644 --- a/docs/examples/java/users/update-phone.md +++ b/docs/examples/java/users/update-phone.md @@ -10,8 +10,8 @@ Client client = new Client() Users users = new Users(client); users.updatePhone( - "[USER_ID]", - "+12065550100" + "<USER_ID>", // userId + "+12065550100", // number new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ users.updatePhone( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/update-prefs.md b/docs/examples/java/users/update-prefs.md index b12a5d8..e9f278a 100644 --- a/docs/examples/java/users/update-prefs.md +++ b/docs/examples/java/users/update-prefs.md @@ -10,8 +10,8 @@ Client client = new Client() Users users = new Users(client); users.updatePrefs( - "[USER_ID]", - mapOf( "a" to "b" ) + "<USER_ID>", // userId + mapOf( "a" to "b" ), // prefs new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ users.updatePrefs( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/update-status.md b/docs/examples/java/users/update-status.md index 012142c..ce78408 100644 --- a/docs/examples/java/users/update-status.md +++ b/docs/examples/java/users/update-status.md @@ -10,8 +10,8 @@ Client client = new Client() Users users = new Users(client); users.updateStatus( - "[USER_ID]", - false + "<USER_ID>", // userId + false, // status new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); @@ -21,3 +21,4 @@ users.updateStatus( System.out.println(result); }) ); + diff --git a/docs/examples/java/users/update-target.md b/docs/examples/java/users/update-target.md new file mode 100644 index 0000000..8f3ae78 --- /dev/null +++ b/docs/examples/java/users/update-target.md @@ -0,0 +1,27 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +Users users = new Users(client); + +users.updateTarget( + "<USER_ID>", // userId + "<TARGET_ID>", // targetId + "<IDENTIFIER>", // identifier (optional) + "<PROVIDER_ID>", // providerId (optional) + "<NAME>", // name (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/kotlin/account/create-anonymous-session.md b/docs/examples/kotlin/account/create-anonymous-session.md new file mode 100644 index 0000000..67686bb --- /dev/null +++ b/docs/examples/kotlin/account/create-anonymous-session.md @@ -0,0 +1,11 @@ +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("5df5acd0d48c2") // Your project ID + +val account = Account(client) + +val response = account.createAnonymousSession() diff --git a/docs/examples/kotlin/account/create-email-password-session.md b/docs/examples/kotlin/account/create-email-password-session.md new file mode 100644 index 0000000..e02d47c --- /dev/null +++ b/docs/examples/kotlin/account/create-email-password-session.md @@ -0,0 +1,14 @@ +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("5df5acd0d48c2") // Your project ID + +val account = Account(client) + +val response = account.createEmailPasswordSession( + email = "email@example.com", + password = "password" +) diff --git a/docs/examples/kotlin/account/create-email-token.md b/docs/examples/kotlin/account/create-email-token.md new file mode 100644 index 0000000..90a7c9e --- /dev/null +++ b/docs/examples/kotlin/account/create-email-token.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("5df5acd0d48c2") // Your project ID + +val account = Account(client) + +val response = account.createEmailToken( + userId = "<USER_ID>", + email = "email@example.com", + phrase = false // optional +) diff --git a/docs/examples/kotlin/account/create-j-w-t.md b/docs/examples/kotlin/account/create-j-w-t.md new file mode 100644 index 0000000..234e012 --- /dev/null +++ b/docs/examples/kotlin/account/create-j-w-t.md @@ -0,0 +1,11 @@ +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("5df5acd0d48c2") // Your project ID + +val account = Account(client) + +val response = account.createJWT() diff --git a/docs/examples/kotlin/account/create-magic-u-r-l-token.md b/docs/examples/kotlin/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000..4d4775b --- /dev/null +++ b/docs/examples/kotlin/account/create-magic-u-r-l-token.md @@ -0,0 +1,16 @@ +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("5df5acd0d48c2") // Your project ID + +val account = Account(client) + +val response = account.createMagicURLToken( + userId = "<USER_ID>", + email = "email@example.com", + url = "https://example.com", // optional + phrase = false // optional +) diff --git a/docs/examples/kotlin/account/create-mfa-authenticator.md b/docs/examples/kotlin/account/create-mfa-authenticator.md new file mode 100644 index 0000000..48aed25 --- /dev/null +++ b/docs/examples/kotlin/account/create-mfa-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("5df5acd0d48c2") // 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-mfa-challenge.md b/docs/examples/kotlin/account/create-mfa-challenge.md new file mode 100644 index 0000000..2f041eb --- /dev/null +++ b/docs/examples/kotlin/account/create-mfa-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("5df5acd0d48c2") // Your project ID + +val account = Account(client) + +val response = account.createMfaChallenge( + factor = AuthenticationFactor.EMAIL +) diff --git a/docs/examples/kotlin/account/create-mfa-recovery-codes.md b/docs/examples/kotlin/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000..2665e99 --- /dev/null +++ b/docs/examples/kotlin/account/create-mfa-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("5df5acd0d48c2") // 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/create-o-auth2token.md b/docs/examples/kotlin/account/create-o-auth2token.md new file mode 100644 index 0000000..5718139 --- /dev/null +++ b/docs/examples/kotlin/account/create-o-auth2token.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account +import io.appwrite.enums.OAuthProvider + +val client = Client() + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + +val account = Account(client) + +account.createOAuth2Token( + provider = OAuthProvider.AMAZON, + success = "https://example.com", // optional + failure = "https://example.com", // optional + scopes = listOf() // optional +) diff --git a/docs/examples/kotlin/account/create-phone-token.md b/docs/examples/kotlin/account/create-phone-token.md new file mode 100644 index 0000000..925d861 --- /dev/null +++ b/docs/examples/kotlin/account/create-phone-token.md @@ -0,0 +1,14 @@ +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("5df5acd0d48c2") // Your project ID + +val account = Account(client) + +val response = account.createPhoneToken( + userId = "<USER_ID>", + phone = "+12065550100" +) diff --git a/docs/examples/kotlin/account/create-phone-verification.md b/docs/examples/kotlin/account/create-phone-verification.md index e18d4ce..a2e08c6 100644 --- a/docs/examples/kotlin/account/create-phone-verification.md +++ b/docs/examples/kotlin/account/create-phone-verification.md @@ -1,10 +1,11 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Account -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val account = Account(client) diff --git a/docs/examples/kotlin/account/create-recovery.md b/docs/examples/kotlin/account/create-recovery.md index a219cb8..c1d22f5 100644 --- a/docs/examples/kotlin/account/create-recovery.md +++ b/docs/examples/kotlin/account/create-recovery.md @@ -1,10 +1,11 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Account -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val account = Account(client) diff --git a/docs/examples/kotlin/account/create-session.md b/docs/examples/kotlin/account/create-session.md new file mode 100644 index 0000000..8627df3 --- /dev/null +++ b/docs/examples/kotlin/account/create-session.md @@ -0,0 +1,14 @@ +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("5df5acd0d48c2") // Your project ID + +val account = Account(client) + +val response = account.createSession( + userId = "<USER_ID>", + secret = "<SECRET>" +) diff --git a/docs/examples/kotlin/account/create-verification.md b/docs/examples/kotlin/account/create-verification.md index 33846f1..cfd0f21 100644 --- a/docs/examples/kotlin/account/create-verification.md +++ b/docs/examples/kotlin/account/create-verification.md @@ -1,10 +1,11 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Account -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val account = Account(client) diff --git a/docs/examples/kotlin/account/create.md b/docs/examples/kotlin/account/create.md new file mode 100644 index 0000000..e18eaf2 --- /dev/null +++ b/docs/examples/kotlin/account/create.md @@ -0,0 +1,16 @@ +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("5df5acd0d48c2") // Your project ID + +val account = Account(client) + +val response = account.create( + userId = "<USER_ID>", + email = "email@example.com", + password = "", + name = "<NAME>" // optional +) diff --git a/docs/examples/kotlin/account/delete-identity.md b/docs/examples/kotlin/account/delete-identity.md index c21ccda..5695029 100644 --- a/docs/examples/kotlin/account/delete-identity.md +++ b/docs/examples/kotlin/account/delete-identity.md @@ -1,13 +1,14 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Account -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val account = Account(client) val response = account.deleteIdentity( - identityId = "[IDENTITY_ID]" + identityId = "<IDENTITY_ID>" ) diff --git a/docs/examples/kotlin/account/delete-mfa-authenticator.md b/docs/examples/kotlin/account/delete-mfa-authenticator.md new file mode 100644 index 0000000..56b69f5 --- /dev/null +++ b/docs/examples/kotlin/account/delete-mfa-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("5df5acd0d48c2") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.deleteMfaAuthenticator( + type = AuthenticatorType.TOTP, + otp = "<OTP>" +) diff --git a/docs/examples/kotlin/account/delete-session.md b/docs/examples/kotlin/account/delete-session.md index 60aa4f2..a02389d 100644 --- a/docs/examples/kotlin/account/delete-session.md +++ b/docs/examples/kotlin/account/delete-session.md @@ -1,13 +1,14 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Account -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val account = Account(client) val response = account.deleteSession( - sessionId = "[SESSION_ID]" + sessionId = "<SESSION_ID>" ) diff --git a/docs/examples/kotlin/account/delete-sessions.md b/docs/examples/kotlin/account/delete-sessions.md index a16622a..3698dac 100644 --- a/docs/examples/kotlin/account/delete-sessions.md +++ b/docs/examples/kotlin/account/delete-sessions.md @@ -1,10 +1,11 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Account -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val account = Account(client) diff --git a/docs/examples/kotlin/account/get-mfa-recovery-codes.md b/docs/examples/kotlin/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000..4ff8a23 --- /dev/null +++ b/docs/examples/kotlin/account/get-mfa-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("5df5acd0d48c2") // 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/get-prefs.md b/docs/examples/kotlin/account/get-prefs.md index dbbba1d..8581225 100644 --- a/docs/examples/kotlin/account/get-prefs.md +++ b/docs/examples/kotlin/account/get-prefs.md @@ -1,10 +1,11 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Account -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val account = Account(client) diff --git a/docs/examples/kotlin/account/get-session.md b/docs/examples/kotlin/account/get-session.md index 0786110..d64687b 100644 --- a/docs/examples/kotlin/account/get-session.md +++ b/docs/examples/kotlin/account/get-session.md @@ -1,13 +1,14 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Account -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val account = Account(client) val response = account.getSession( - sessionId = "[SESSION_ID]" + sessionId = "<SESSION_ID>" ) diff --git a/docs/examples/kotlin/account/get.md b/docs/examples/kotlin/account/get.md index 1fb002a..4c8cb97 100644 --- a/docs/examples/kotlin/account/get.md +++ b/docs/examples/kotlin/account/get.md @@ -1,10 +1,11 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Account -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val account = Account(client) diff --git a/docs/examples/kotlin/account/list-identities.md b/docs/examples/kotlin/account/list-identities.md index c300e28..5dda161 100644 --- a/docs/examples/kotlin/account/list-identities.md +++ b/docs/examples/kotlin/account/list-identities.md @@ -1,12 +1,14 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Account -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val account = Account(client) val response = account.listIdentities( + queries = listOf() // optional ) diff --git a/docs/examples/kotlin/account/list-logs.md b/docs/examples/kotlin/account/list-logs.md index daddd75..4550de2 100644 --- a/docs/examples/kotlin/account/list-logs.md +++ b/docs/examples/kotlin/account/list-logs.md @@ -1,12 +1,14 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Account -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val account = Account(client) val response = account.listLogs( + queries = listOf() // optional ) diff --git a/docs/examples/kotlin/account/list-mfa-factors.md b/docs/examples/kotlin/account/list-mfa-factors.md new file mode 100644 index 0000000..5703870 --- /dev/null +++ b/docs/examples/kotlin/account/list-mfa-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("5df5acd0d48c2") // 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/list-sessions.md b/docs/examples/kotlin/account/list-sessions.md index 132a5da..91a922c 100644 --- a/docs/examples/kotlin/account/list-sessions.md +++ b/docs/examples/kotlin/account/list-sessions.md @@ -1,10 +1,11 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Account -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val account = Account(client) diff --git a/docs/examples/kotlin/account/update-email.md b/docs/examples/kotlin/account/update-email.md index 1127bbc..c952b55 100644 --- a/docs/examples/kotlin/account/update-email.md +++ b/docs/examples/kotlin/account/update-email.md @@ -1,10 +1,11 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Account -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val account = Account(client) diff --git a/docs/examples/kotlin/account/update-m-f-a.md b/docs/examples/kotlin/account/update-m-f-a.md new file mode 100644 index 0000000..6f23864 --- /dev/null +++ b/docs/examples/kotlin/account/update-m-f-a.md @@ -0,0 +1,14 @@ +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("5df5acd0d48c2") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.updateMFA( + mfa = false +) diff --git a/docs/examples/kotlin/account/update-magic-u-r-l-session.md b/docs/examples/kotlin/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000..1a533bf --- /dev/null +++ b/docs/examples/kotlin/account/update-magic-u-r-l-session.md @@ -0,0 +1,14 @@ +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("5df5acd0d48c2") // Your project ID + +val account = Account(client) + +val response = account.updateMagicURLSession( + userId = "<USER_ID>", + secret = "<SECRET>" +) diff --git a/docs/examples/kotlin/account/update-mfa-authenticator.md b/docs/examples/kotlin/account/update-mfa-authenticator.md new file mode 100644 index 0000000..a3edc9b --- /dev/null +++ b/docs/examples/kotlin/account/update-mfa-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("5df5acd0d48c2") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.updateMfaAuthenticator( + type = AuthenticatorType.TOTP, + otp = "<OTP>" +) diff --git a/docs/examples/kotlin/account/update-mfa-challenge.md b/docs/examples/kotlin/account/update-mfa-challenge.md new file mode 100644 index 0000000..2fb5d38 --- /dev/null +++ b/docs/examples/kotlin/account/update-mfa-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("5df5acd0d48c2") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.updateMfaChallenge( + challengeId = "<CHALLENGE_ID>", + otp = "<OTP>" +) diff --git a/docs/examples/kotlin/account/update-mfa-recovery-codes.md b/docs/examples/kotlin/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000..bef9f9a --- /dev/null +++ b/docs/examples/kotlin/account/update-mfa-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("5df5acd0d48c2") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.updateMfaRecoveryCodes() diff --git a/docs/examples/kotlin/account/update-name.md b/docs/examples/kotlin/account/update-name.md index 3de89a5..711aa36 100644 --- a/docs/examples/kotlin/account/update-name.md +++ b/docs/examples/kotlin/account/update-name.md @@ -1,13 +1,14 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Account -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val account = Account(client) val response = account.updateName( - name = "[NAME]" + name = "<NAME>" ) diff --git a/docs/examples/kotlin/account/update-password.md b/docs/examples/kotlin/account/update-password.md index df92d9e..8d62d87 100644 --- a/docs/examples/kotlin/account/update-password.md +++ b/docs/examples/kotlin/account/update-password.md @@ -1,13 +1,15 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Account -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val account = Account(client) val response = account.updatePassword( password = "", + oldPassword = "password" // optional ) diff --git a/docs/examples/kotlin/account/update-phone-session.md b/docs/examples/kotlin/account/update-phone-session.md new file mode 100644 index 0000000..b6b1385 --- /dev/null +++ b/docs/examples/kotlin/account/update-phone-session.md @@ -0,0 +1,14 @@ +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("5df5acd0d48c2") // Your project ID + +val account = Account(client) + +val response = account.updatePhoneSession( + userId = "<USER_ID>", + secret = "<SECRET>" +) diff --git a/docs/examples/kotlin/account/update-phone-verification.md b/docs/examples/kotlin/account/update-phone-verification.md index 0ed51d3..eb2c075 100644 --- a/docs/examples/kotlin/account/update-phone-verification.md +++ b/docs/examples/kotlin/account/update-phone-verification.md @@ -1,14 +1,15 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Account -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val account = Account(client) val response = account.updatePhoneVerification( - userId = "[USER_ID]", - secret = "[SECRET]" + userId = "<USER_ID>", + secret = "<SECRET>" ) diff --git a/docs/examples/kotlin/account/update-phone.md b/docs/examples/kotlin/account/update-phone.md index 9c823bb..35adaab 100644 --- a/docs/examples/kotlin/account/update-phone.md +++ b/docs/examples/kotlin/account/update-phone.md @@ -1,10 +1,11 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Account -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val account = Account(client) diff --git a/docs/examples/kotlin/account/update-prefs.md b/docs/examples/kotlin/account/update-prefs.md index 6226269..fda3f94 100644 --- a/docs/examples/kotlin/account/update-prefs.md +++ b/docs/examples/kotlin/account/update-prefs.md @@ -1,10 +1,11 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Account -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val account = Account(client) diff --git a/docs/examples/kotlin/account/update-recovery.md b/docs/examples/kotlin/account/update-recovery.md index 1b676c1..3543991 100644 --- a/docs/examples/kotlin/account/update-recovery.md +++ b/docs/examples/kotlin/account/update-recovery.md @@ -1,16 +1,16 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Account -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val account = Account(client) val response = account.updateRecovery( - userId = "[USER_ID]", - secret = "[SECRET]", - password = "password", - passwordAgain = "password" + userId = "<USER_ID>", + secret = "<SECRET>", + password = "" ) diff --git a/docs/examples/kotlin/account/update-session.md b/docs/examples/kotlin/account/update-session.md index bd3d28e..c75abc0 100644 --- a/docs/examples/kotlin/account/update-session.md +++ b/docs/examples/kotlin/account/update-session.md @@ -1,13 +1,14 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Account -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val account = Account(client) val response = account.updateSession( - sessionId = "[SESSION_ID]" + sessionId = "<SESSION_ID>" ) diff --git a/docs/examples/kotlin/account/update-status.md b/docs/examples/kotlin/account/update-status.md index 3ed0627..07adc53 100644 --- a/docs/examples/kotlin/account/update-status.md +++ b/docs/examples/kotlin/account/update-status.md @@ -1,10 +1,11 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Account -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val account = Account(client) diff --git a/docs/examples/kotlin/account/update-verification.md b/docs/examples/kotlin/account/update-verification.md index e73e555..19e55fc 100644 --- a/docs/examples/kotlin/account/update-verification.md +++ b/docs/examples/kotlin/account/update-verification.md @@ -1,14 +1,15 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Account -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val account = Account(client) val response = account.updateVerification( - userId = "[USER_ID]", - secret = "[SECRET]" + userId = "<USER_ID>", + secret = "<SECRET>" ) diff --git a/docs/examples/kotlin/avatars/get-browser.md b/docs/examples/kotlin/avatars/get-browser.md index e9f6eb2..b5eb52d 100644 --- a/docs/examples/kotlin/avatars/get-browser.md +++ b/docs/examples/kotlin/avatars/get-browser.md @@ -1,13 +1,18 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Avatars +import io.appwrite.enums.Browser -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val avatars = Avatars(client) val result = avatars.getBrowser( - code = "aa", + code = Browser.AVANT_BROWSER, + width = 0, // optional + height = 0, // optional + quality = 0 // optional ) diff --git a/docs/examples/kotlin/avatars/get-credit-card.md b/docs/examples/kotlin/avatars/get-credit-card.md index c3413ac..f60f78f 100644 --- a/docs/examples/kotlin/avatars/get-credit-card.md +++ b/docs/examples/kotlin/avatars/get-credit-card.md @@ -1,13 +1,18 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Avatars +import io.appwrite.enums.CreditCard -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val avatars = Avatars(client) val result = avatars.getCreditCard( - code = "amex", + code = CreditCard.AMERICAN_EXPRESS, + width = 0, // optional + height = 0, // optional + quality = 0 // optional ) diff --git a/docs/examples/kotlin/avatars/get-favicon.md b/docs/examples/kotlin/avatars/get-favicon.md index cd1ea0c..22d91ff 100644 --- a/docs/examples/kotlin/avatars/get-favicon.md +++ b/docs/examples/kotlin/avatars/get-favicon.md @@ -1,10 +1,11 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Avatars -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val avatars = Avatars(client) diff --git a/docs/examples/kotlin/avatars/get-flag.md b/docs/examples/kotlin/avatars/get-flag.md index a81c59a..646445c 100644 --- a/docs/examples/kotlin/avatars/get-flag.md +++ b/docs/examples/kotlin/avatars/get-flag.md @@ -1,13 +1,18 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Avatars +import io.appwrite.enums.Flag -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val avatars = Avatars(client) val result = avatars.getFlag( - code = "af", + code = Flag.AFGHANISTAN, + width = 0, // optional + height = 0, // optional + quality = 0 // optional ) diff --git a/docs/examples/kotlin/avatars/get-image.md b/docs/examples/kotlin/avatars/get-image.md index 09cacde..bda8ee6 100644 --- a/docs/examples/kotlin/avatars/get-image.md +++ b/docs/examples/kotlin/avatars/get-image.md @@ -1,13 +1,16 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Avatars -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val avatars = Avatars(client) val result = avatars.getImage( url = "https://example.com", + width = 0, // optional + height = 0 // optional ) diff --git a/docs/examples/kotlin/avatars/get-initials.md b/docs/examples/kotlin/avatars/get-initials.md index ba46fb0..35378c0 100644 --- a/docs/examples/kotlin/avatars/get-initials.md +++ b/docs/examples/kotlin/avatars/get-initials.md @@ -1,12 +1,17 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Avatars -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val avatars = Avatars(client) val result = avatars.getInitials( + name = "<NAME>", // optional + width = 0, // optional + height = 0, // optional + background = "" // optional ) diff --git a/docs/examples/kotlin/avatars/get-q-r.md b/docs/examples/kotlin/avatars/get-q-r.md index c43aabc..84e5e37 100644 --- a/docs/examples/kotlin/avatars/get-q-r.md +++ b/docs/examples/kotlin/avatars/get-q-r.md @@ -1,13 +1,17 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Avatars -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val avatars = Avatars(client) val result = avatars.getQR( - text = "[TEXT]", + text = "<TEXT>", + size = 1, // optional + margin = 0, // optional + download = false // optional ) diff --git a/docs/examples/kotlin/databases/create-boolean-attribute.md b/docs/examples/kotlin/databases/create-boolean-attribute.md index 22de123..733fede 100644 --- a/docs/examples/kotlin/databases/create-boolean-attribute.md +++ b/docs/examples/kotlin/databases/create-boolean-attribute.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,8 +10,10 @@ val client = Client(context) val databases = Databases(client) val response = databases.createBooleanAttribute( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "", required = false, + default = false, // optional + array = false // optional ) diff --git a/docs/examples/kotlin/databases/create-collection.md b/docs/examples/kotlin/databases/create-collection.md index 9ba70cf..1ae8865 100644 --- a/docs/examples/kotlin/databases/create-collection.md +++ b/docs/examples/kotlin/databases/create-collection.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,7 +10,10 @@ val client = Client(context) val databases = Databases(client) val response = databases.createCollection( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", - name = "[NAME]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + name = "<NAME>", + permissions = listOf("read("any")"), // optional + documentSecurity = false, // optional + enabled = false // optional ) diff --git a/docs/examples/kotlin/databases/create-datetime-attribute.md b/docs/examples/kotlin/databases/create-datetime-attribute.md index d410244..3c39c71 100644 --- a/docs/examples/kotlin/databases/create-datetime-attribute.md +++ b/docs/examples/kotlin/databases/create-datetime-attribute.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,8 +10,10 @@ val client = Client(context) val databases = Databases(client) val response = databases.createDatetimeAttribute( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "", required = false, + default = "", // optional + array = false // optional ) diff --git a/docs/examples/kotlin/databases/create-document.md b/docs/examples/kotlin/databases/create-document.md index 95e5977..9c7608b 100644 --- a/docs/examples/kotlin/databases/create-document.md +++ b/docs/examples/kotlin/databases/create-document.md @@ -1,16 +1,18 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val databases = Databases(client) val response = databases.createDocument( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", - documentId = "[DOCUMENT_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + documentId = "<DOCUMENT_ID>", data = mapOf( "a" to "b" ), + permissions = listOf("read("any")") // optional ) diff --git a/docs/examples/kotlin/databases/create-email-attribute.md b/docs/examples/kotlin/databases/create-email-attribute.md index 292f31f..94d928d 100644 --- a/docs/examples/kotlin/databases/create-email-attribute.md +++ b/docs/examples/kotlin/databases/create-email-attribute.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,8 +10,10 @@ val client = Client(context) val databases = Databases(client) val response = databases.createEmailAttribute( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "", required = false, + default = "email@example.com", // optional + array = false // optional ) diff --git a/docs/examples/kotlin/databases/create-enum-attribute.md b/docs/examples/kotlin/databases/create-enum-attribute.md index 99008a4..4376186 100644 --- a/docs/examples/kotlin/databases/create-enum-attribute.md +++ b/docs/examples/kotlin/databases/create-enum-attribute.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,9 +10,11 @@ val client = Client(context) val databases = Databases(client) val response = databases.createEnumAttribute( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "", elements = listOf(), required = false, + default = "<DEFAULT>", // optional + array = false // optional ) diff --git a/docs/examples/kotlin/databases/create-float-attribute.md b/docs/examples/kotlin/databases/create-float-attribute.md index 6814962..1d6f94c 100644 --- a/docs/examples/kotlin/databases/create-float-attribute.md +++ b/docs/examples/kotlin/databases/create-float-attribute.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,8 +10,12 @@ val client = Client(context) val databases = Databases(client) val response = databases.createFloatAttribute( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "", required = false, + min = 0, // optional + max = 0, // optional + default = 0, // optional + array = false // optional ) diff --git a/docs/examples/kotlin/databases/create-index.md b/docs/examples/kotlin/databases/create-index.md index 42b3dbe..f61f829 100644 --- a/docs/examples/kotlin/databases/create-index.md +++ b/docs/examples/kotlin/databases/create-index.md @@ -1,7 +1,9 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases +import io.appwrite.enums.IndexType -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,9 +11,10 @@ val client = Client(context) val databases = Databases(client) val response = databases.createIndex( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "", - type = "key", + type = IndexType.KEY, attributes = listOf(), + orders = listOf() // optional ) diff --git a/docs/examples/kotlin/databases/create-integer-attribute.md b/docs/examples/kotlin/databases/create-integer-attribute.md index 57b2ff6..ae496a8 100644 --- a/docs/examples/kotlin/databases/create-integer-attribute.md +++ b/docs/examples/kotlin/databases/create-integer-attribute.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,8 +10,12 @@ val client = Client(context) val databases = Databases(client) val response = databases.createIntegerAttribute( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "", required = false, + min = 0, // optional + max = 0, // optional + default = 0, // optional + array = false // optional ) diff --git a/docs/examples/kotlin/databases/create-ip-attribute.md b/docs/examples/kotlin/databases/create-ip-attribute.md index f941b82..5f78d50 100644 --- a/docs/examples/kotlin/databases/create-ip-attribute.md +++ b/docs/examples/kotlin/databases/create-ip-attribute.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,8 +10,10 @@ val client = Client(context) val databases = Databases(client) val response = databases.createIpAttribute( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "", required = false, + default = "", // optional + array = false // optional ) diff --git a/docs/examples/kotlin/databases/create-relationship-attribute.md b/docs/examples/kotlin/databases/create-relationship-attribute.md index 22ebc4a..832192a 100644 --- a/docs/examples/kotlin/databases/create-relationship-attribute.md +++ b/docs/examples/kotlin/databases/create-relationship-attribute.md @@ -1,7 +1,9 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases +import io.appwrite.enums.RelationshipType -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,8 +11,12 @@ val client = Client(context) val databases = Databases(client) val response = databases.createRelationshipAttribute( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", - relatedCollectionId = "[RELATED_COLLECTION_ID]", - type = "oneToOne", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + relatedCollectionId = "<RELATED_COLLECTION_ID>", + type = RelationshipType.ONETOONE, + twoWay = false, // optional + key = "", // optional + twoWayKey = "", // optional + onDelete = "cascade" // optional ) diff --git a/docs/examples/kotlin/databases/create-string-attribute.md b/docs/examples/kotlin/databases/create-string-attribute.md index c5d3d52..3724e6b 100644 --- a/docs/examples/kotlin/databases/create-string-attribute.md +++ b/docs/examples/kotlin/databases/create-string-attribute.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,9 +10,12 @@ val client = Client(context) val databases = Databases(client) val response = databases.createStringAttribute( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "", size = 1, required = false, + default = "<DEFAULT>", // optional + array = false, // optional + encrypt = false // optional ) diff --git a/docs/examples/kotlin/databases/create-url-attribute.md b/docs/examples/kotlin/databases/create-url-attribute.md index 8cd0731..e2c5220 100644 --- a/docs/examples/kotlin/databases/create-url-attribute.md +++ b/docs/examples/kotlin/databases/create-url-attribute.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,8 +10,10 @@ val client = Client(context) val databases = Databases(client) val response = databases.createUrlAttribute( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "", required = false, + default = "https://example.com", // optional + array = false // optional ) diff --git a/docs/examples/kotlin/databases/create.md b/docs/examples/kotlin/databases/create.md index d7d462a..ce48187 100644 --- a/docs/examples/kotlin/databases/create.md +++ b/docs/examples/kotlin/databases/create.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,7 @@ val client = Client(context) val databases = Databases(client) val response = databases.create( - databaseId = "[DATABASE_ID]", - name = "[NAME]", + databaseId = "<DATABASE_ID>", + name = "<NAME>", + enabled = false // optional ) diff --git a/docs/examples/kotlin/databases/delete-attribute.md b/docs/examples/kotlin/databases/delete-attribute.md index fef7a45..ad31cd4 100644 --- a/docs/examples/kotlin/databases/delete-attribute.md +++ b/docs/examples/kotlin/databases/delete-attribute.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,7 +10,7 @@ val client = Client(context) val databases = Databases(client) val response = databases.deleteAttribute( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "" ) diff --git a/docs/examples/kotlin/databases/delete-collection.md b/docs/examples/kotlin/databases/delete-collection.md index 6763593..ce4ebe7 100644 --- a/docs/examples/kotlin/databases/delete-collection.md +++ b/docs/examples/kotlin/databases/delete-collection.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,6 @@ val client = Client(context) val databases = Databases(client) val response = databases.deleteCollection( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]" + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>" ) diff --git a/docs/examples/kotlin/databases/delete-document.md b/docs/examples/kotlin/databases/delete-document.md index 2bf047f..b399a1d 100644 --- a/docs/examples/kotlin/databases/delete-document.md +++ b/docs/examples/kotlin/databases/delete-document.md @@ -1,15 +1,16 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val databases = Databases(client) val response = databases.deleteDocument( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", - documentId = "[DOCUMENT_ID]" + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + documentId = "<DOCUMENT_ID>" ) diff --git a/docs/examples/kotlin/databases/delete-index.md b/docs/examples/kotlin/databases/delete-index.md index 59bd149..791ced3 100644 --- a/docs/examples/kotlin/databases/delete-index.md +++ b/docs/examples/kotlin/databases/delete-index.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,7 +10,7 @@ val client = Client(context) val databases = Databases(client) val response = databases.deleteIndex( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "" ) diff --git a/docs/examples/kotlin/databases/delete.md b/docs/examples/kotlin/databases/delete.md index f927901..60cc227 100644 --- a/docs/examples/kotlin/databases/delete.md +++ b/docs/examples/kotlin/databases/delete.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,5 +10,5 @@ val client = Client(context) val databases = Databases(client) val response = databases.delete( - databaseId = "[DATABASE_ID]" + databaseId = "<DATABASE_ID>" ) diff --git a/docs/examples/kotlin/databases/get-attribute.md b/docs/examples/kotlin/databases/get-attribute.md index 4bba2df..1ee1462 100644 --- a/docs/examples/kotlin/databases/get-attribute.md +++ b/docs/examples/kotlin/databases/get-attribute.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,7 +10,7 @@ val client = Client(context) val databases = Databases(client) val response = databases.getAttribute( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "" ) diff --git a/docs/examples/kotlin/databases/get-collection.md b/docs/examples/kotlin/databases/get-collection.md index 76ff9a1..10da0e2 100644 --- a/docs/examples/kotlin/databases/get-collection.md +++ b/docs/examples/kotlin/databases/get-collection.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,6 @@ val client = Client(context) val databases = Databases(client) val response = databases.getCollection( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]" + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>" ) diff --git a/docs/examples/kotlin/databases/get-document.md b/docs/examples/kotlin/databases/get-document.md index 8bacaa5..4d57861 100644 --- a/docs/examples/kotlin/databases/get-document.md +++ b/docs/examples/kotlin/databases/get-document.md @@ -1,15 +1,17 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val databases = Databases(client) val response = databases.getDocument( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", - documentId = "[DOCUMENT_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + documentId = "<DOCUMENT_ID>", + queries = listOf() // optional ) diff --git a/docs/examples/kotlin/databases/get-index.md b/docs/examples/kotlin/databases/get-index.md index 2d588de..ecb0540 100644 --- a/docs/examples/kotlin/databases/get-index.md +++ b/docs/examples/kotlin/databases/get-index.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,7 +10,7 @@ val client = Client(context) val databases = Databases(client) val response = databases.getIndex( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "" ) diff --git a/docs/examples/kotlin/databases/get.md b/docs/examples/kotlin/databases/get.md index 5584d4d..92923f1 100644 --- a/docs/examples/kotlin/databases/get.md +++ b/docs/examples/kotlin/databases/get.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,5 +10,5 @@ val client = Client(context) val databases = Databases(client) val response = databases.get( - databaseId = "[DATABASE_ID]" + databaseId = "<DATABASE_ID>" ) diff --git a/docs/examples/kotlin/databases/list-attributes.md b/docs/examples/kotlin/databases/list-attributes.md index 4057571..7d67ff0 100644 --- a/docs/examples/kotlin/databases/list-attributes.md +++ b/docs/examples/kotlin/databases/list-attributes.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,7 @@ val client = Client(context) val databases = Databases(client) val response = databases.listAttributes( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + queries = listOf() // optional ) diff --git a/docs/examples/kotlin/databases/list-collections.md b/docs/examples/kotlin/databases/list-collections.md index f563c43..df8796e 100644 --- a/docs/examples/kotlin/databases/list-collections.md +++ b/docs/examples/kotlin/databases/list-collections.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,5 +10,7 @@ val client = Client(context) val databases = Databases(client) val response = databases.listCollections( - databaseId = "[DATABASE_ID]", + databaseId = "<DATABASE_ID>", + queries = listOf(), // optional + search = "<SEARCH>" // optional ) diff --git a/docs/examples/kotlin/databases/list-documents.md b/docs/examples/kotlin/databases/list-documents.md index c081013..53a48bb 100644 --- a/docs/examples/kotlin/databases/list-documents.md +++ b/docs/examples/kotlin/databases/list-documents.md @@ -1,14 +1,16 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val databases = Databases(client) val response = databases.listDocuments( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + queries = listOf() // optional ) diff --git a/docs/examples/kotlin/databases/list-indexes.md b/docs/examples/kotlin/databases/list-indexes.md index 431d7ac..8c653ea 100644 --- a/docs/examples/kotlin/databases/list-indexes.md +++ b/docs/examples/kotlin/databases/list-indexes.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,7 @@ val client = Client(context) val databases = Databases(client) val response = databases.listIndexes( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + queries = listOf() // optional ) diff --git a/docs/examples/kotlin/databases/list.md b/docs/examples/kotlin/databases/list.md index 6ffece0..7134f0e 100644 --- a/docs/examples/kotlin/databases/list.md +++ b/docs/examples/kotlin/databases/list.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,4 +10,6 @@ val client = Client(context) val databases = Databases(client) val response = databases.list( + queries = listOf(), // optional + search = "<SEARCH>" // optional ) diff --git a/docs/examples/kotlin/databases/update-boolean-attribute.md b/docs/examples/kotlin/databases/update-boolean-attribute.md index b74ad79..8ccc398 100644 --- a/docs/examples/kotlin/databases/update-boolean-attribute.md +++ b/docs/examples/kotlin/databases/update-boolean-attribute.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,8 +10,8 @@ val client = Client(context) val databases = Databases(client) val response = databases.updateBooleanAttribute( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "", required = false, default = false diff --git a/docs/examples/kotlin/databases/update-collection.md b/docs/examples/kotlin/databases/update-collection.md index f6ccffe..f7b648f 100644 --- a/docs/examples/kotlin/databases/update-collection.md +++ b/docs/examples/kotlin/databases/update-collection.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,7 +10,10 @@ val client = Client(context) val databases = Databases(client) val response = databases.updateCollection( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", - name = "[NAME]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + name = "<NAME>", + permissions = listOf("read("any")"), // optional + documentSecurity = false, // optional + enabled = false // optional ) diff --git a/docs/examples/kotlin/databases/update-datetime-attribute.md b/docs/examples/kotlin/databases/update-datetime-attribute.md index 013e437..3ffb212 100644 --- a/docs/examples/kotlin/databases/update-datetime-attribute.md +++ b/docs/examples/kotlin/databases/update-datetime-attribute.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,8 +10,8 @@ val client = Client(context) val databases = Databases(client) val response = databases.updateDatetimeAttribute( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "", required = false, default = "" diff --git a/docs/examples/kotlin/databases/update-document.md b/docs/examples/kotlin/databases/update-document.md index 10ff4c4..ef02fdb 100644 --- a/docs/examples/kotlin/databases/update-document.md +++ b/docs/examples/kotlin/databases/update-document.md @@ -1,15 +1,18 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val databases = Databases(client) val response = databases.updateDocument( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", - documentId = "[DOCUMENT_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + documentId = "<DOCUMENT_ID>", + data = mapOf( "a" to "b" ), // optional + permissions = listOf("read("any")") // optional ) diff --git a/docs/examples/kotlin/databases/update-email-attribute.md b/docs/examples/kotlin/databases/update-email-attribute.md index 39ca493..2a7a74c 100644 --- a/docs/examples/kotlin/databases/update-email-attribute.md +++ b/docs/examples/kotlin/databases/update-email-attribute.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,8 +10,8 @@ val client = Client(context) val databases = Databases(client) val response = databases.updateEmailAttribute( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "", required = false, default = "email@example.com" diff --git a/docs/examples/kotlin/databases/update-enum-attribute.md b/docs/examples/kotlin/databases/update-enum-attribute.md index ece9f22..18ff0a3 100644 --- a/docs/examples/kotlin/databases/update-enum-attribute.md +++ b/docs/examples/kotlin/databases/update-enum-attribute.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,10 +10,10 @@ val client = Client(context) val databases = Databases(client) val response = databases.updateEnumAttribute( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "", elements = listOf(), required = false, - default = "[DEFAULT]" + default = "<DEFAULT>" ) diff --git a/docs/examples/kotlin/databases/update-float-attribute.md b/docs/examples/kotlin/databases/update-float-attribute.md index ed9ec05..315bf56 100644 --- a/docs/examples/kotlin/databases/update-float-attribute.md +++ b/docs/examples/kotlin/databases/update-float-attribute.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,8 +10,8 @@ val client = Client(context) val databases = Databases(client) val response = databases.updateFloatAttribute( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "", required = false, min = 0, diff --git a/docs/examples/kotlin/databases/update-integer-attribute.md b/docs/examples/kotlin/databases/update-integer-attribute.md index e881b01..9c61307 100644 --- a/docs/examples/kotlin/databases/update-integer-attribute.md +++ b/docs/examples/kotlin/databases/update-integer-attribute.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,8 +10,8 @@ val client = Client(context) val databases = Databases(client) val response = databases.updateIntegerAttribute( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "", required = false, min = 0, diff --git a/docs/examples/kotlin/databases/update-ip-attribute.md b/docs/examples/kotlin/databases/update-ip-attribute.md index 5ebe893..a795964 100644 --- a/docs/examples/kotlin/databases/update-ip-attribute.md +++ b/docs/examples/kotlin/databases/update-ip-attribute.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,8 +10,8 @@ val client = Client(context) val databases = Databases(client) val response = databases.updateIpAttribute( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "", required = false, default = "" diff --git a/docs/examples/kotlin/databases/update-relationship-attribute.md b/docs/examples/kotlin/databases/update-relationship-attribute.md index 9c0ffec..b58559b 100644 --- a/docs/examples/kotlin/databases/update-relationship-attribute.md +++ b/docs/examples/kotlin/databases/update-relationship-attribute.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,7 +10,8 @@ val client = Client(context) val databases = Databases(client) val response = databases.updateRelationshipAttribute( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "", + onDelete = "cascade" // optional ) diff --git a/docs/examples/kotlin/databases/update-string-attribute.md b/docs/examples/kotlin/databases/update-string-attribute.md index c8db170..e6fc440 100644 --- a/docs/examples/kotlin/databases/update-string-attribute.md +++ b/docs/examples/kotlin/databases/update-string-attribute.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,9 +10,9 @@ val client = Client(context) val databases = Databases(client) val response = databases.updateStringAttribute( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "", required = false, - default = "[DEFAULT]" + default = "<DEFAULT>" ) diff --git a/docs/examples/kotlin/databases/update-url-attribute.md b/docs/examples/kotlin/databases/update-url-attribute.md index 71d9bde..84ce862 100644 --- a/docs/examples/kotlin/databases/update-url-attribute.md +++ b/docs/examples/kotlin/databases/update-url-attribute.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,8 +10,8 @@ val client = Client(context) val databases = Databases(client) val response = databases.updateUrlAttribute( - databaseId = "[DATABASE_ID]", - collectionId = "[COLLECTION_ID]", + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", key = "", required = false, default = "https://example.com" diff --git a/docs/examples/kotlin/databases/update.md b/docs/examples/kotlin/databases/update.md index 3a4c608..e458d69 100644 --- a/docs/examples/kotlin/databases/update.md +++ b/docs/examples/kotlin/databases/update.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Databases -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,7 @@ val client = Client(context) val databases = Databases(client) val response = databases.update( - databaseId = "[DATABASE_ID]", - name = "[NAME]", + databaseId = "<DATABASE_ID>", + name = "<NAME>", + enabled = false // optional ) diff --git a/docs/examples/kotlin/functions/create-build.md b/docs/examples/kotlin/functions/create-build.md index 62f9d1a..fe64c02 100644 --- a/docs/examples/kotlin/functions/create-build.md +++ b/docs/examples/kotlin/functions/create-build.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Functions -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,7 +10,7 @@ val client = Client(context) val functions = Functions(client) val response = functions.createBuild( - functionId = "[FUNCTION_ID]", - deploymentId = "[DEPLOYMENT_ID]", - buildId = "[BUILD_ID]" + functionId = "<FUNCTION_ID>", + deploymentId = "<DEPLOYMENT_ID>", + buildId = "<BUILD_ID>" ) diff --git a/docs/examples/kotlin/functions/create-deployment.md b/docs/examples/kotlin/functions/create-deployment.md index 28b89a6..e961aa3 100644 --- a/docs/examples/kotlin/functions/create-deployment.md +++ b/docs/examples/kotlin/functions/create-deployment.md @@ -1,8 +1,9 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.models.InputFile import io.appwrite.services.Functions -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -10,7 +11,9 @@ val client = Client(context) val functions = Functions(client) val response = functions.createDeployment( - functionId = "[FUNCTION_ID]", + functionId = "<FUNCTION_ID>", code = InputFile.fromPath("file.png"), activate = false, + entrypoint = "<ENTRYPOINT>", // optional + commands = "<COMMANDS>" // optional ) diff --git a/docs/examples/kotlin/functions/create-execution.md b/docs/examples/kotlin/functions/create-execution.md index 62bce1f..29f64bc 100644 --- a/docs/examples/kotlin/functions/create-execution.md +++ b/docs/examples/kotlin/functions/create-execution.md @@ -1,13 +1,19 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Functions -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val functions = Functions(client) val response = functions.createExecution( - functionId = "[FUNCTION_ID]", + functionId = "<FUNCTION_ID>", + body = "<BODY>", // optional + async = false, // optional + path = "<PATH>", // optional + method = "GET", // optional + headers = mapOf( "a" to "b" ) // optional ) diff --git a/docs/examples/kotlin/functions/create-variable.md b/docs/examples/kotlin/functions/create-variable.md index 6b23614..e604360 100644 --- a/docs/examples/kotlin/functions/create-variable.md +++ b/docs/examples/kotlin/functions/create-variable.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Functions -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,7 +10,7 @@ val client = Client(context) val functions = Functions(client) val response = functions.createVariable( - functionId = "[FUNCTION_ID]", - key = "[KEY]", - value = "[VALUE]" + functionId = "<FUNCTION_ID>", + key = "<KEY>", + value = "<VALUE>" ) diff --git a/docs/examples/kotlin/functions/create.md b/docs/examples/kotlin/functions/create.md index d45be0b..f15566e 100644 --- a/docs/examples/kotlin/functions/create.md +++ b/docs/examples/kotlin/functions/create.md @@ -1,7 +1,9 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Functions +import io.appwrite.enums.Runtime -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,7 +11,24 @@ val client = Client(context) val functions = Functions(client) val response = functions.create( - functionId = "[FUNCTION_ID]", - name = "[NAME]", - runtime = "node-18.0", + functionId = "<FUNCTION_ID>", + name = "<NAME>", + runtime = .NODE_14_5, + execute = listOf("any"), // optional + events = listOf(), // optional + schedule = "", // optional + timeout = 1, // optional + enabled = false, // optional + logging = false, // optional + entrypoint = "<ENTRYPOINT>", // optional + commands = "<COMMANDS>", // optional + installationId = "<INSTALLATION_ID>", // optional + providerRepositoryId = "<PROVIDER_REPOSITORY_ID>", // optional + providerBranch = "<PROVIDER_BRANCH>", // optional + providerSilentMode = false, // optional + providerRootDirectory = "<PROVIDER_ROOT_DIRECTORY>", // optional + templateRepository = "<TEMPLATE_REPOSITORY>", // optional + templateOwner = "<TEMPLATE_OWNER>", // optional + templateRootDirectory = "<TEMPLATE_ROOT_DIRECTORY>", // optional + templateBranch = "<TEMPLATE_BRANCH>" // optional ) diff --git a/docs/examples/kotlin/functions/delete-deployment.md b/docs/examples/kotlin/functions/delete-deployment.md index 5187ba4..43a8b60 100644 --- a/docs/examples/kotlin/functions/delete-deployment.md +++ b/docs/examples/kotlin/functions/delete-deployment.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Functions -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,6 @@ val client = Client(context) val functions = Functions(client) val response = functions.deleteDeployment( - functionId = "[FUNCTION_ID]", - deploymentId = "[DEPLOYMENT_ID]" + functionId = "<FUNCTION_ID>", + deploymentId = "<DEPLOYMENT_ID>" ) diff --git a/docs/examples/kotlin/functions/delete-variable.md b/docs/examples/kotlin/functions/delete-variable.md index f0fe4a3..db1290a 100644 --- a/docs/examples/kotlin/functions/delete-variable.md +++ b/docs/examples/kotlin/functions/delete-variable.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Functions -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,6 @@ val client = Client(context) val functions = Functions(client) val response = functions.deleteVariable( - functionId = "[FUNCTION_ID]", - variableId = "[VARIABLE_ID]" + functionId = "<FUNCTION_ID>", + variableId = "<VARIABLE_ID>" ) diff --git a/docs/examples/kotlin/functions/delete.md b/docs/examples/kotlin/functions/delete.md index f12095b..4acba27 100644 --- a/docs/examples/kotlin/functions/delete.md +++ b/docs/examples/kotlin/functions/delete.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Functions -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,5 +10,5 @@ val client = Client(context) val functions = Functions(client) val response = functions.delete( - functionId = "[FUNCTION_ID]" + functionId = "<FUNCTION_ID>" ) diff --git a/docs/examples/kotlin/functions/download-deployment.md b/docs/examples/kotlin/functions/download-deployment.md index 2388e82..7e12635 100644 --- a/docs/examples/kotlin/functions/download-deployment.md +++ b/docs/examples/kotlin/functions/download-deployment.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Functions -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,6 @@ val client = Client(context) val functions = Functions(client) val result = functions.downloadDeployment( - functionId = "[FUNCTION_ID]", - deploymentId = "[DEPLOYMENT_ID]" + functionId = "<FUNCTION_ID>", + deploymentId = "<DEPLOYMENT_ID>" ) diff --git a/docs/examples/kotlin/functions/get-deployment.md b/docs/examples/kotlin/functions/get-deployment.md index 4653e61..cb92710 100644 --- a/docs/examples/kotlin/functions/get-deployment.md +++ b/docs/examples/kotlin/functions/get-deployment.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Functions -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,6 @@ val client = Client(context) val functions = Functions(client) val response = functions.getDeployment( - functionId = "[FUNCTION_ID]", - deploymentId = "[DEPLOYMENT_ID]" + functionId = "<FUNCTION_ID>", + deploymentId = "<DEPLOYMENT_ID>" ) diff --git a/docs/examples/kotlin/functions/get-execution.md b/docs/examples/kotlin/functions/get-execution.md index 929a003..e0c9dc7 100644 --- a/docs/examples/kotlin/functions/get-execution.md +++ b/docs/examples/kotlin/functions/get-execution.md @@ -1,14 +1,15 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Functions -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val functions = Functions(client) val response = functions.getExecution( - functionId = "[FUNCTION_ID]", - executionId = "[EXECUTION_ID]" + functionId = "<FUNCTION_ID>", + executionId = "<EXECUTION_ID>" ) diff --git a/docs/examples/kotlin/functions/get-variable.md b/docs/examples/kotlin/functions/get-variable.md index ce42276..c9a0f11 100644 --- a/docs/examples/kotlin/functions/get-variable.md +++ b/docs/examples/kotlin/functions/get-variable.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Functions -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,6 @@ val client = Client(context) val functions = Functions(client) val response = functions.getVariable( - functionId = "[FUNCTION_ID]", - variableId = "[VARIABLE_ID]" + functionId = "<FUNCTION_ID>", + variableId = "<VARIABLE_ID>" ) diff --git a/docs/examples/kotlin/functions/get.md b/docs/examples/kotlin/functions/get.md index 9261ab8..bffb1a0 100644 --- a/docs/examples/kotlin/functions/get.md +++ b/docs/examples/kotlin/functions/get.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Functions -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,5 +10,5 @@ val client = Client(context) val functions = Functions(client) val response = functions.get( - functionId = "[FUNCTION_ID]" + functionId = "<FUNCTION_ID>" ) diff --git a/docs/examples/kotlin/functions/list-deployments.md b/docs/examples/kotlin/functions/list-deployments.md index 3ec2c81..bb4b0b8 100644 --- a/docs/examples/kotlin/functions/list-deployments.md +++ b/docs/examples/kotlin/functions/list-deployments.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Functions -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,5 +10,7 @@ val client = Client(context) val functions = Functions(client) val response = functions.listDeployments( - functionId = "[FUNCTION_ID]", + functionId = "<FUNCTION_ID>", + queries = listOf(), // optional + search = "<SEARCH>" // optional ) diff --git a/docs/examples/kotlin/functions/list-executions.md b/docs/examples/kotlin/functions/list-executions.md index 5378c79..04d6216 100644 --- a/docs/examples/kotlin/functions/list-executions.md +++ b/docs/examples/kotlin/functions/list-executions.md @@ -1,13 +1,16 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Functions -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val functions = Functions(client) val response = functions.listExecutions( - functionId = "[FUNCTION_ID]", + functionId = "<FUNCTION_ID>", + queries = listOf(), // optional + search = "<SEARCH>" // optional ) diff --git a/docs/examples/kotlin/functions/list-runtimes.md b/docs/examples/kotlin/functions/list-runtimes.md index 0e777cd..099b87b 100644 --- a/docs/examples/kotlin/functions/list-runtimes.md +++ b/docs/examples/kotlin/functions/list-runtimes.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Functions -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key diff --git a/docs/examples/kotlin/functions/list-variables.md b/docs/examples/kotlin/functions/list-variables.md index 10e7453..c152163 100644 --- a/docs/examples/kotlin/functions/list-variables.md +++ b/docs/examples/kotlin/functions/list-variables.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Functions -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,5 +10,5 @@ val client = Client(context) val functions = Functions(client) val response = functions.listVariables( - functionId = "[FUNCTION_ID]" + functionId = "<FUNCTION_ID>" ) diff --git a/docs/examples/kotlin/functions/list.md b/docs/examples/kotlin/functions/list.md index a5f4f0d..c04efee 100644 --- a/docs/examples/kotlin/functions/list.md +++ b/docs/examples/kotlin/functions/list.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Functions -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,4 +10,6 @@ val client = Client(context) val functions = Functions(client) val response = functions.list( + queries = listOf(), // optional + search = "<SEARCH>" // optional ) diff --git a/docs/examples/kotlin/functions/update-deployment.md b/docs/examples/kotlin/functions/update-deployment.md index 14b1473..85b0f65 100644 --- a/docs/examples/kotlin/functions/update-deployment.md +++ b/docs/examples/kotlin/functions/update-deployment.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Functions -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,6 @@ val client = Client(context) val functions = Functions(client) val response = functions.updateDeployment( - functionId = "[FUNCTION_ID]", - deploymentId = "[DEPLOYMENT_ID]" + functionId = "<FUNCTION_ID>", + deploymentId = "<DEPLOYMENT_ID>" ) diff --git a/docs/examples/kotlin/functions/update-variable.md b/docs/examples/kotlin/functions/update-variable.md index 1e0f3bb..010de12 100644 --- a/docs/examples/kotlin/functions/update-variable.md +++ b/docs/examples/kotlin/functions/update-variable.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Functions -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,7 +10,8 @@ val client = Client(context) val functions = Functions(client) val response = functions.updateVariable( - functionId = "[FUNCTION_ID]", - variableId = "[VARIABLE_ID]", - key = "[KEY]", + functionId = "<FUNCTION_ID>", + variableId = "<VARIABLE_ID>", + key = "<KEY>", + value = "<VALUE>" // optional ) diff --git a/docs/examples/kotlin/functions/update.md b/docs/examples/kotlin/functions/update.md index f8aed9d..0dc8ec3 100644 --- a/docs/examples/kotlin/functions/update.md +++ b/docs/examples/kotlin/functions/update.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Functions -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,20 @@ val client = Client(context) val functions = Functions(client) val response = functions.update( - functionId = "[FUNCTION_ID]", - name = "[NAME]", + functionId = "<FUNCTION_ID>", + name = "<NAME>", + runtime = "node-14.5", // optional + execute = listOf("any"), // optional + events = listOf(), // optional + schedule = "", // optional + timeout = 1, // optional + enabled = false, // optional + logging = false, // optional + entrypoint = "<ENTRYPOINT>", // optional + commands = "<COMMANDS>", // optional + installationId = "<INSTALLATION_ID>", // optional + providerRepositoryId = "<PROVIDER_REPOSITORY_ID>", // optional + providerBranch = "<PROVIDER_BRANCH>", // optional + providerSilentMode = false, // optional + providerRootDirectory = "<PROVIDER_ROOT_DIRECTORY>" // optional ) diff --git a/docs/examples/kotlin/graphql/mutation.md b/docs/examples/kotlin/graphql/mutation.md index aed06cd..9024c0e 100644 --- a/docs/examples/kotlin/graphql/mutation.md +++ b/docs/examples/kotlin/graphql/mutation.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Graphql -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key diff --git a/docs/examples/kotlin/graphql/query.md b/docs/examples/kotlin/graphql/query.md index bd29d43..c5e6165 100644 --- a/docs/examples/kotlin/graphql/query.md +++ b/docs/examples/kotlin/graphql/query.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Graphql -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key diff --git a/docs/examples/kotlin/health/get-antivirus.md b/docs/examples/kotlin/health/get-antivirus.md index e387fe0..b381dc2 100644 --- a/docs/examples/kotlin/health/get-antivirus.md +++ b/docs/examples/kotlin/health/get-antivirus.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Health -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key diff --git a/docs/examples/kotlin/health/get-cache.md b/docs/examples/kotlin/health/get-cache.md index 7aca9dd..0359605 100644 --- a/docs/examples/kotlin/health/get-cache.md +++ b/docs/examples/kotlin/health/get-cache.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Health -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key diff --git a/docs/examples/kotlin/health/get-certificate.md b/docs/examples/kotlin/health/get-certificate.md new file mode 100644 index 0000000..48b1e06 --- /dev/null +++ b/docs/examples/kotlin/health/get-certificate.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val health = Health(client) + +val response = health.getCertificate( + domain = "" // optional +) diff --git a/docs/examples/kotlin/health/get-d-b.md b/docs/examples/kotlin/health/get-d-b.md index 8e71914..92553e7 100644 --- a/docs/examples/kotlin/health/get-d-b.md +++ b/docs/examples/kotlin/health/get-d-b.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Health -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key diff --git a/docs/examples/kotlin/health/get-failed-jobs.md b/docs/examples/kotlin/health/get-failed-jobs.md new file mode 100644 index 0000000..b8384d3 --- /dev/null +++ b/docs/examples/kotlin/health/get-failed-jobs.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health +import io.appwrite.enums.Name + +val client = Client() + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val health = Health(client) + +val response = health.getFailedJobs( + name = .V1_DATABASE, + threshold = 0 // optional +) diff --git a/docs/examples/kotlin/health/get-pub-sub.md b/docs/examples/kotlin/health/get-pub-sub.md index 421407a..0f91e77 100644 --- a/docs/examples/kotlin/health/get-pub-sub.md +++ b/docs/examples/kotlin/health/get-pub-sub.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Health -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key diff --git a/docs/examples/kotlin/health/get-queue-builds.md b/docs/examples/kotlin/health/get-queue-builds.md index fb36bc7..1392689 100644 --- a/docs/examples/kotlin/health/get-queue-builds.md +++ b/docs/examples/kotlin/health/get-queue-builds.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Health -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,4 +10,5 @@ val client = Client(context) val health = Health(client) val response = health.getQueueBuilds( + threshold = 0 // optional ) diff --git a/docs/examples/kotlin/health/get-queue-certificates.md b/docs/examples/kotlin/health/get-queue-certificates.md index 6221519..af6e442 100644 --- a/docs/examples/kotlin/health/get-queue-certificates.md +++ b/docs/examples/kotlin/health/get-queue-certificates.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Health -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,4 +10,5 @@ val client = Client(context) val health = Health(client) val response = health.getQueueCertificates( + threshold = 0 // optional ) diff --git a/docs/examples/kotlin/health/get-queue-databases.md b/docs/examples/kotlin/health/get-queue-databases.md index 80a38c1..d9b0200 100644 --- a/docs/examples/kotlin/health/get-queue-databases.md +++ b/docs/examples/kotlin/health/get-queue-databases.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Health -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,4 +10,6 @@ val client = Client(context) val health = Health(client) val response = health.getQueueDatabases( + name = "<NAME>", // optional + threshold = 0 // optional ) diff --git a/docs/examples/kotlin/health/get-queue-deletes.md b/docs/examples/kotlin/health/get-queue-deletes.md index 2d1a410..c7f7a0a 100644 --- a/docs/examples/kotlin/health/get-queue-deletes.md +++ b/docs/examples/kotlin/health/get-queue-deletes.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Health -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,4 +10,5 @@ val client = Client(context) val health = Health(client) val response = health.getQueueDeletes( + threshold = 0 // optional ) diff --git a/docs/examples/kotlin/health/get-queue-functions.md b/docs/examples/kotlin/health/get-queue-functions.md index 3bb45b9..37f2c67 100644 --- a/docs/examples/kotlin/health/get-queue-functions.md +++ b/docs/examples/kotlin/health/get-queue-functions.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Health -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,4 +10,5 @@ val client = Client(context) val health = Health(client) val response = health.getQueueFunctions( + threshold = 0 // optional ) diff --git a/docs/examples/kotlin/health/get-queue-logs.md b/docs/examples/kotlin/health/get-queue-logs.md index 866fbe4..f0f2bde 100644 --- a/docs/examples/kotlin/health/get-queue-logs.md +++ b/docs/examples/kotlin/health/get-queue-logs.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Health -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,4 +10,5 @@ val client = Client(context) val health = Health(client) val response = health.getQueueLogs( + threshold = 0 // optional ) diff --git a/docs/examples/kotlin/health/get-queue-mails.md b/docs/examples/kotlin/health/get-queue-mails.md index ec54bc7..d4dc40a 100644 --- a/docs/examples/kotlin/health/get-queue-mails.md +++ b/docs/examples/kotlin/health/get-queue-mails.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Health -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,4 +10,5 @@ val client = Client(context) val health = Health(client) val response = health.getQueueMails( + threshold = 0 // optional ) diff --git a/docs/examples/kotlin/health/get-queue-messaging.md b/docs/examples/kotlin/health/get-queue-messaging.md index 0f707fe..ffb7192 100644 --- a/docs/examples/kotlin/health/get-queue-messaging.md +++ b/docs/examples/kotlin/health/get-queue-messaging.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Health -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,4 +10,5 @@ val client = Client(context) val health = Health(client) val response = health.getQueueMessaging( + threshold = 0 // optional ) diff --git a/docs/examples/kotlin/health/get-queue-migrations.md b/docs/examples/kotlin/health/get-queue-migrations.md index 68a1950..300814c 100644 --- a/docs/examples/kotlin/health/get-queue-migrations.md +++ b/docs/examples/kotlin/health/get-queue-migrations.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Health -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,4 +10,5 @@ val client = Client(context) val health = Health(client) val response = health.getQueueMigrations( + threshold = 0 // optional ) diff --git a/docs/examples/kotlin/health/get-queue-usage-dump.md b/docs/examples/kotlin/health/get-queue-usage-dump.md new file mode 100644 index 0000000..11c3164 --- /dev/null +++ b/docs/examples/kotlin/health/get-queue-usage-dump.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val health = Health(client) + +val response = health.getQueueUsageDump( + threshold = 0 // optional +) diff --git a/docs/examples/kotlin/health/get-queue-usage.md b/docs/examples/kotlin/health/get-queue-usage.md new file mode 100644 index 0000000..e5a9ade --- /dev/null +++ b/docs/examples/kotlin/health/get-queue-usage.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val health = Health(client) + +val response = health.getQueueUsage( + threshold = 0 // optional +) diff --git a/docs/examples/kotlin/health/get-queue-webhooks.md b/docs/examples/kotlin/health/get-queue-webhooks.md index a557198..d4d56dd 100644 --- a/docs/examples/kotlin/health/get-queue-webhooks.md +++ b/docs/examples/kotlin/health/get-queue-webhooks.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Health -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,4 +10,5 @@ val client = Client(context) val health = Health(client) val response = health.getQueueWebhooks( + threshold = 0 // optional ) diff --git a/docs/examples/kotlin/health/get-queue.md b/docs/examples/kotlin/health/get-queue.md index ead5185..f9749e9 100644 --- a/docs/examples/kotlin/health/get-queue.md +++ b/docs/examples/kotlin/health/get-queue.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Health -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key diff --git a/docs/examples/kotlin/health/get-storage-local.md b/docs/examples/kotlin/health/get-storage-local.md index f204168..cc2664b 100644 --- a/docs/examples/kotlin/health/get-storage-local.md +++ b/docs/examples/kotlin/health/get-storage-local.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Health -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key diff --git a/docs/examples/kotlin/health/get-storage.md b/docs/examples/kotlin/health/get-storage.md new file mode 100644 index 0000000..b4a35ab --- /dev/null +++ b/docs/examples/kotlin/health/get-storage.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val health = Health(client) + +val response = health.getStorage() diff --git a/docs/examples/kotlin/health/get-time.md b/docs/examples/kotlin/health/get-time.md index 35f3bb9..e121cb9 100644 --- a/docs/examples/kotlin/health/get-time.md +++ b/docs/examples/kotlin/health/get-time.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Health -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key diff --git a/docs/examples/kotlin/health/get.md b/docs/examples/kotlin/health/get.md index b547be9..49e229e 100644 --- a/docs/examples/kotlin/health/get.md +++ b/docs/examples/kotlin/health/get.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Health -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key diff --git a/docs/examples/kotlin/locale/get.md b/docs/examples/kotlin/locale/get.md index 1d84651..9d4853f 100644 --- a/docs/examples/kotlin/locale/get.md +++ b/docs/examples/kotlin/locale/get.md @@ -1,10 +1,11 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Locale -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val locale = Locale(client) diff --git a/docs/examples/kotlin/locale/list-codes.md b/docs/examples/kotlin/locale/list-codes.md index 28f0202..0845810 100644 --- a/docs/examples/kotlin/locale/list-codes.md +++ b/docs/examples/kotlin/locale/list-codes.md @@ -1,10 +1,11 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Locale -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val locale = Locale(client) diff --git a/docs/examples/kotlin/locale/list-continents.md b/docs/examples/kotlin/locale/list-continents.md index bd9ad18..b4be20b 100644 --- a/docs/examples/kotlin/locale/list-continents.md +++ b/docs/examples/kotlin/locale/list-continents.md @@ -1,10 +1,11 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Locale -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val locale = Locale(client) diff --git a/docs/examples/kotlin/locale/list-countries-e-u.md b/docs/examples/kotlin/locale/list-countries-e-u.md index 5d32583..f098457 100644 --- a/docs/examples/kotlin/locale/list-countries-e-u.md +++ b/docs/examples/kotlin/locale/list-countries-e-u.md @@ -1,10 +1,11 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Locale -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val locale = Locale(client) diff --git a/docs/examples/kotlin/locale/list-countries-phones.md b/docs/examples/kotlin/locale/list-countries-phones.md index e0f2ae3..9308be7 100644 --- a/docs/examples/kotlin/locale/list-countries-phones.md +++ b/docs/examples/kotlin/locale/list-countries-phones.md @@ -1,10 +1,11 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Locale -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val locale = Locale(client) diff --git a/docs/examples/kotlin/locale/list-countries.md b/docs/examples/kotlin/locale/list-countries.md index 626d381..4b2f1b1 100644 --- a/docs/examples/kotlin/locale/list-countries.md +++ b/docs/examples/kotlin/locale/list-countries.md @@ -1,10 +1,11 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Locale -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val locale = Locale(client) diff --git a/docs/examples/kotlin/locale/list-currencies.md b/docs/examples/kotlin/locale/list-currencies.md index 6457056..2ab56db 100644 --- a/docs/examples/kotlin/locale/list-currencies.md +++ b/docs/examples/kotlin/locale/list-currencies.md @@ -1,10 +1,11 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Locale -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val locale = Locale(client) diff --git a/docs/examples/kotlin/locale/list-languages.md b/docs/examples/kotlin/locale/list-languages.md index 437b1c3..8401d25 100644 --- a/docs/examples/kotlin/locale/list-languages.md +++ b/docs/examples/kotlin/locale/list-languages.md @@ -1,10 +1,11 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Locale -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val locale = Locale(client) diff --git a/docs/examples/kotlin/messaging/create-apns-provider.md b/docs/examples/kotlin/messaging/create-apns-provider.md new file mode 100644 index 0000000..d2125dc --- /dev/null +++ b/docs/examples/kotlin/messaging/create-apns-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createApnsProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", + authKey = "<AUTH_KEY>", // optional + authKeyId = "<AUTH_KEY_ID>", // optional + teamId = "<TEAM_ID>", // optional + bundleId = "<BUNDLE_ID>", // optional + sandbox = false, // optional + enabled = false // optional +) diff --git a/docs/examples/kotlin/messaging/create-email.md b/docs/examples/kotlin/messaging/create-email.md new file mode 100644 index 0000000..f5d7679 --- /dev/null +++ b/docs/examples/kotlin/messaging/create-email.md @@ -0,0 +1,25 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createEmail( + messageId = "<MESSAGE_ID>", + subject = "<SUBJECT>", + content = "<CONTENT>", + topics = listOf(), // optional + users = listOf(), // optional + targets = listOf(), // optional + cc = listOf(), // optional + bcc = listOf(), // optional + attachments = listOf(), // optional + draft = false, // optional + html = false, // optional + scheduledAt = "" // optional +) diff --git a/docs/examples/kotlin/messaging/create-fcm-provider.md b/docs/examples/kotlin/messaging/create-fcm-provider.md new file mode 100644 index 0000000..343ba99 --- /dev/null +++ b/docs/examples/kotlin/messaging/create-fcm-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createFcmProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", + serviceAccountJSON = mapOf( "a" to "b" ), // optional + enabled = false // optional +) diff --git a/docs/examples/kotlin/messaging/create-mailgun-provider.md b/docs/examples/kotlin/messaging/create-mailgun-provider.md new file mode 100644 index 0000000..0d1c55c --- /dev/null +++ b/docs/examples/kotlin/messaging/create-mailgun-provider.md @@ -0,0 +1,23 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createMailgunProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", + apiKey = "<API_KEY>", // optional + domain = "<DOMAIN>", // optional + isEuRegion = false, // optional + fromName = "<FROM_NAME>", // optional + fromEmail = "email@example.com", // optional + replyToName = "<REPLY_TO_NAME>", // optional + replyToEmail = "email@example.com", // optional + enabled = false // optional +) diff --git a/docs/examples/kotlin/messaging/create-msg91provider.md b/docs/examples/kotlin/messaging/create-msg91provider.md new file mode 100644 index 0000000..1299fa7 --- /dev/null +++ b/docs/examples/kotlin/messaging/create-msg91provider.md @@ -0,0 +1,19 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createMsg91Provider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", + from = "+12065550100", // optional + senderId = "<SENDER_ID>", // optional + authKey = "<AUTH_KEY>", // optional + enabled = false // optional +) diff --git a/docs/examples/kotlin/messaging/create-push.md b/docs/examples/kotlin/messaging/create-push.md new file mode 100644 index 0000000..1e78333 --- /dev/null +++ b/docs/examples/kotlin/messaging/create-push.md @@ -0,0 +1,29 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createPush( + messageId = "<MESSAGE_ID>", + title = "<TITLE>", + body = "<BODY>", + topics = listOf(), // optional + users = listOf(), // optional + targets = listOf(), // optional + data = mapOf( "a" to "b" ), // optional + action = "<ACTION>", // optional + image = "[ID1:ID2]", // optional + icon = "<ICON>", // optional + sound = "<SOUND>", // optional + color = "<COLOR>", // optional + tag = "<TAG>", // optional + badge = "<BADGE>", // optional + draft = false, // optional + scheduledAt = "" // optional +) diff --git a/docs/examples/kotlin/messaging/create-sendgrid-provider.md b/docs/examples/kotlin/messaging/create-sendgrid-provider.md new file mode 100644 index 0000000..701094d --- /dev/null +++ b/docs/examples/kotlin/messaging/create-sendgrid-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createSendgridProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", + apiKey = "<API_KEY>", // optional + fromName = "<FROM_NAME>", // optional + fromEmail = "email@example.com", // optional + replyToName = "<REPLY_TO_NAME>", // optional + replyToEmail = "email@example.com", // optional + enabled = false // optional +) diff --git a/docs/examples/kotlin/messaging/create-sms.md b/docs/examples/kotlin/messaging/create-sms.md new file mode 100644 index 0000000..b6f591a --- /dev/null +++ b/docs/examples/kotlin/messaging/create-sms.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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createSms( + messageId = "<MESSAGE_ID>", + content = "<CONTENT>", + topics = listOf(), // optional + users = listOf(), // optional + targets = listOf(), // optional + draft = false, // optional + scheduledAt = "" // optional +) diff --git a/docs/examples/kotlin/messaging/create-smtp-provider.md b/docs/examples/kotlin/messaging/create-smtp-provider.md new file mode 100644 index 0000000..f263dcc --- /dev/null +++ b/docs/examples/kotlin/messaging/create-smtp-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createSmtpProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", + host = "<HOST>", + port = 1, // optional + username = "<USERNAME>", // optional + password = "<PASSWORD>", // optional + encryption = "none", // optional + autoTLS = false, // optional + mailer = "<MAILER>", // optional + fromName = "<FROM_NAME>", // optional + fromEmail = "email@example.com", // optional + replyToName = "<REPLY_TO_NAME>", // optional + replyToEmail = "email@example.com", // optional + enabled = false // optional +) diff --git a/docs/examples/kotlin/messaging/create-subscriber.md b/docs/examples/kotlin/messaging/create-subscriber.md new file mode 100644 index 0000000..57b3e68 --- /dev/null +++ b/docs/examples/kotlin/messaging/create-subscriber.md @@ -0,0 +1,16 @@ +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("5df5acd0d48c2") // Your project ID + .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + +val messaging = Messaging(client) + +val response = messaging.createSubscriber( + topicId = "<TOPIC_ID>", + subscriberId = "<SUBSCRIBER_ID>", + targetId = "<TARGET_ID>" +) diff --git a/docs/examples/kotlin/messaging/create-telesign-provider.md b/docs/examples/kotlin/messaging/create-telesign-provider.md new file mode 100644 index 0000000..8808423 --- /dev/null +++ b/docs/examples/kotlin/messaging/create-telesign-provider.md @@ -0,0 +1,19 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createTelesignProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", + from = "+12065550100", // optional + customerId = "<CUSTOMER_ID>", // optional + apiKey = "<API_KEY>", // optional + enabled = false // optional +) diff --git a/docs/examples/kotlin/messaging/create-textmagic-provider.md b/docs/examples/kotlin/messaging/create-textmagic-provider.md new file mode 100644 index 0000000..d6abf32 --- /dev/null +++ b/docs/examples/kotlin/messaging/create-textmagic-provider.md @@ -0,0 +1,19 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createTextmagicProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", + from = "+12065550100", // optional + username = "<USERNAME>", // optional + apiKey = "<API_KEY>", // optional + enabled = false // optional +) diff --git a/docs/examples/kotlin/messaging/create-topic.md b/docs/examples/kotlin/messaging/create-topic.md new file mode 100644 index 0000000..110abf4 --- /dev/null +++ b/docs/examples/kotlin/messaging/create-topic.md @@ -0,0 +1,16 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createTopic( + topicId = "<TOPIC_ID>", + name = "<NAME>", + subscribe = listOf("any") // optional +) diff --git a/docs/examples/kotlin/messaging/create-twilio-provider.md b/docs/examples/kotlin/messaging/create-twilio-provider.md new file mode 100644 index 0000000..24920ea --- /dev/null +++ b/docs/examples/kotlin/messaging/create-twilio-provider.md @@ -0,0 +1,19 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createTwilioProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", + from = "+12065550100", // optional + accountSid = "<ACCOUNT_SID>", // optional + authToken = "<AUTH_TOKEN>", // optional + enabled = false // optional +) diff --git a/docs/examples/kotlin/messaging/create-vonage-provider.md b/docs/examples/kotlin/messaging/create-vonage-provider.md new file mode 100644 index 0000000..bccd077 --- /dev/null +++ b/docs/examples/kotlin/messaging/create-vonage-provider.md @@ -0,0 +1,19 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createVonageProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", + from = "+12065550100", // optional + apiKey = "<API_KEY>", // optional + apiSecret = "<API_SECRET>", // optional + enabled = false // optional +) diff --git a/docs/examples/kotlin/messaging/delete-provider.md b/docs/examples/kotlin/messaging/delete-provider.md new file mode 100644 index 0000000..c437e34 --- /dev/null +++ b/docs/examples/kotlin/messaging/delete-provider.md @@ -0,0 +1,14 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.deleteProvider( + providerId = "<PROVIDER_ID>" +) diff --git a/docs/examples/kotlin/messaging/delete-subscriber.md b/docs/examples/kotlin/messaging/delete-subscriber.md new file mode 100644 index 0000000..51012d8 --- /dev/null +++ b/docs/examples/kotlin/messaging/delete-subscriber.md @@ -0,0 +1,15 @@ +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("5df5acd0d48c2") // Your project ID + .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + +val messaging = Messaging(client) + +val response = messaging.deleteSubscriber( + topicId = "<TOPIC_ID>", + subscriberId = "<SUBSCRIBER_ID>" +) diff --git a/docs/examples/kotlin/messaging/delete-topic.md b/docs/examples/kotlin/messaging/delete-topic.md new file mode 100644 index 0000000..83b460d --- /dev/null +++ b/docs/examples/kotlin/messaging/delete-topic.md @@ -0,0 +1,14 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.deleteTopic( + topicId = "<TOPIC_ID>" +) diff --git a/docs/examples/kotlin/messaging/delete.md b/docs/examples/kotlin/messaging/delete.md new file mode 100644 index 0000000..f7f400c --- /dev/null +++ b/docs/examples/kotlin/messaging/delete.md @@ -0,0 +1,14 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.delete( + messageId = "<MESSAGE_ID>" +) diff --git a/docs/examples/kotlin/messaging/get-message.md b/docs/examples/kotlin/messaging/get-message.md new file mode 100644 index 0000000..8fbbdc0 --- /dev/null +++ b/docs/examples/kotlin/messaging/get-message.md @@ -0,0 +1,14 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.getMessage( + messageId = "<MESSAGE_ID>" +) diff --git a/docs/examples/kotlin/messaging/get-provider.md b/docs/examples/kotlin/messaging/get-provider.md new file mode 100644 index 0000000..48fdc64 --- /dev/null +++ b/docs/examples/kotlin/messaging/get-provider.md @@ -0,0 +1,14 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.getProvider( + providerId = "<PROVIDER_ID>" +) diff --git a/docs/examples/kotlin/messaging/get-subscriber.md b/docs/examples/kotlin/messaging/get-subscriber.md new file mode 100644 index 0000000..23bae3e --- /dev/null +++ b/docs/examples/kotlin/messaging/get-subscriber.md @@ -0,0 +1,15 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.getSubscriber( + topicId = "<TOPIC_ID>", + subscriberId = "<SUBSCRIBER_ID>" +) diff --git a/docs/examples/kotlin/messaging/get-topic.md b/docs/examples/kotlin/messaging/get-topic.md new file mode 100644 index 0000000..21e5ae7 --- /dev/null +++ b/docs/examples/kotlin/messaging/get-topic.md @@ -0,0 +1,14 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.getTopic( + topicId = "<TOPIC_ID>" +) diff --git a/docs/examples/kotlin/messaging/list-message-logs.md b/docs/examples/kotlin/messaging/list-message-logs.md new file mode 100644 index 0000000..d3062ea --- /dev/null +++ b/docs/examples/kotlin/messaging/list-message-logs.md @@ -0,0 +1,15 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.listMessageLogs( + messageId = "<MESSAGE_ID>", + queries = listOf() // optional +) diff --git a/docs/examples/kotlin/messaging/list-messages.md b/docs/examples/kotlin/messaging/list-messages.md new file mode 100644 index 0000000..ca4ab22 --- /dev/null +++ b/docs/examples/kotlin/messaging/list-messages.md @@ -0,0 +1,15 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.listMessages( + queries = listOf(), // optional + search = "<SEARCH>" // optional +) diff --git a/docs/examples/kotlin/messaging/list-provider-logs.md b/docs/examples/kotlin/messaging/list-provider-logs.md new file mode 100644 index 0000000..51d7723 --- /dev/null +++ b/docs/examples/kotlin/messaging/list-provider-logs.md @@ -0,0 +1,15 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.listProviderLogs( + providerId = "<PROVIDER_ID>", + queries = listOf() // optional +) diff --git a/docs/examples/kotlin/messaging/list-providers.md b/docs/examples/kotlin/messaging/list-providers.md new file mode 100644 index 0000000..2779e86 --- /dev/null +++ b/docs/examples/kotlin/messaging/list-providers.md @@ -0,0 +1,15 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.listProviders( + queries = listOf(), // optional + search = "<SEARCH>" // optional +) diff --git a/docs/examples/kotlin/messaging/list-subscriber-logs.md b/docs/examples/kotlin/messaging/list-subscriber-logs.md new file mode 100644 index 0000000..b331ccb --- /dev/null +++ b/docs/examples/kotlin/messaging/list-subscriber-logs.md @@ -0,0 +1,15 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.listSubscriberLogs( + subscriberId = "<SUBSCRIBER_ID>", + queries = listOf() // optional +) diff --git a/docs/examples/kotlin/messaging/list-subscribers.md b/docs/examples/kotlin/messaging/list-subscribers.md new file mode 100644 index 0000000..d257171 --- /dev/null +++ b/docs/examples/kotlin/messaging/list-subscribers.md @@ -0,0 +1,16 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.listSubscribers( + topicId = "<TOPIC_ID>", + queries = listOf(), // optional + search = "<SEARCH>" // optional +) diff --git a/docs/examples/kotlin/messaging/list-targets.md b/docs/examples/kotlin/messaging/list-targets.md new file mode 100644 index 0000000..415d611 --- /dev/null +++ b/docs/examples/kotlin/messaging/list-targets.md @@ -0,0 +1,15 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.listTargets( + messageId = "<MESSAGE_ID>", + queries = listOf() // optional +) diff --git a/docs/examples/kotlin/messaging/list-topic-logs.md b/docs/examples/kotlin/messaging/list-topic-logs.md new file mode 100644 index 0000000..a9d5d5a --- /dev/null +++ b/docs/examples/kotlin/messaging/list-topic-logs.md @@ -0,0 +1,15 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.listTopicLogs( + topicId = "<TOPIC_ID>", + queries = listOf() // optional +) diff --git a/docs/examples/kotlin/messaging/list-topics.md b/docs/examples/kotlin/messaging/list-topics.md new file mode 100644 index 0000000..ed19b2a --- /dev/null +++ b/docs/examples/kotlin/messaging/list-topics.md @@ -0,0 +1,15 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.listTopics( + queries = listOf(), // optional + search = "<SEARCH>" // optional +) diff --git a/docs/examples/kotlin/messaging/update-apns-provider.md b/docs/examples/kotlin/messaging/update-apns-provider.md new file mode 100644 index 0000000..52e03d8 --- /dev/null +++ b/docs/examples/kotlin/messaging/update-apns-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateApnsProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", // optional + enabled = false, // optional + authKey = "<AUTH_KEY>", // optional + authKeyId = "<AUTH_KEY_ID>", // optional + teamId = "<TEAM_ID>", // optional + bundleId = "<BUNDLE_ID>", // optional + sandbox = false // optional +) diff --git a/docs/examples/kotlin/messaging/update-email.md b/docs/examples/kotlin/messaging/update-email.md new file mode 100644 index 0000000..fe85992 --- /dev/null +++ b/docs/examples/kotlin/messaging/update-email.md @@ -0,0 +1,24 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateEmail( + messageId = "<MESSAGE_ID>", + topics = listOf(), // optional + users = listOf(), // optional + targets = listOf(), // optional + subject = "<SUBJECT>", // optional + content = "<CONTENT>", // optional + draft = false, // optional + html = false, // optional + cc = listOf(), // optional + bcc = listOf(), // optional + scheduledAt = "" // optional +) diff --git a/docs/examples/kotlin/messaging/update-fcm-provider.md b/docs/examples/kotlin/messaging/update-fcm-provider.md new file mode 100644 index 0000000..b64f48a --- /dev/null +++ b/docs/examples/kotlin/messaging/update-fcm-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateFcmProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", // optional + enabled = false, // optional + serviceAccountJSON = mapOf( "a" to "b" ) // optional +) diff --git a/docs/examples/kotlin/messaging/update-mailgun-provider.md b/docs/examples/kotlin/messaging/update-mailgun-provider.md new file mode 100644 index 0000000..1ad9e35 --- /dev/null +++ b/docs/examples/kotlin/messaging/update-mailgun-provider.md @@ -0,0 +1,23 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateMailgunProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", // optional + apiKey = "<API_KEY>", // optional + domain = "<DOMAIN>", // optional + isEuRegion = false, // optional + enabled = false, // optional + fromName = "<FROM_NAME>", // optional + fromEmail = "email@example.com", // optional + replyToName = "<REPLY_TO_NAME>", // optional + replyToEmail = "<REPLY_TO_EMAIL>" // optional +) diff --git a/docs/examples/kotlin/messaging/update-msg91provider.md b/docs/examples/kotlin/messaging/update-msg91provider.md new file mode 100644 index 0000000..4e30528 --- /dev/null +++ b/docs/examples/kotlin/messaging/update-msg91provider.md @@ -0,0 +1,19 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateMsg91Provider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", // optional + enabled = false, // optional + senderId = "<SENDER_ID>", // optional + authKey = "<AUTH_KEY>", // optional + from = "<FROM>" // optional +) diff --git a/docs/examples/kotlin/messaging/update-push.md b/docs/examples/kotlin/messaging/update-push.md new file mode 100644 index 0000000..4469e10 --- /dev/null +++ b/docs/examples/kotlin/messaging/update-push.md @@ -0,0 +1,29 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updatePush( + messageId = "<MESSAGE_ID>", + topics = listOf(), // optional + users = listOf(), // optional + targets = listOf(), // optional + title = "<TITLE>", // optional + body = "<BODY>", // optional + data = mapOf( "a" to "b" ), // optional + action = "<ACTION>", // optional + image = "[ID1:ID2]", // optional + icon = "<ICON>", // optional + sound = "<SOUND>", // optional + color = "<COLOR>", // optional + tag = "<TAG>", // optional + badge = 0, // optional + draft = false, // optional + scheduledAt = "" // optional +) diff --git a/docs/examples/kotlin/messaging/update-sendgrid-provider.md b/docs/examples/kotlin/messaging/update-sendgrid-provider.md new file mode 100644 index 0000000..cb8a9ce --- /dev/null +++ b/docs/examples/kotlin/messaging/update-sendgrid-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateSendgridProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", // optional + enabled = false, // optional + apiKey = "<API_KEY>", // optional + fromName = "<FROM_NAME>", // optional + fromEmail = "email@example.com", // optional + replyToName = "<REPLY_TO_NAME>", // optional + replyToEmail = "<REPLY_TO_EMAIL>" // optional +) diff --git a/docs/examples/kotlin/messaging/update-sms.md b/docs/examples/kotlin/messaging/update-sms.md new file mode 100644 index 0000000..752cf26 --- /dev/null +++ b/docs/examples/kotlin/messaging/update-sms.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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateSms( + messageId = "<MESSAGE_ID>", + topics = listOf(), // optional + users = listOf(), // optional + targets = listOf(), // optional + content = "<CONTENT>", // optional + draft = false, // optional + scheduledAt = "" // optional +) diff --git a/docs/examples/kotlin/messaging/update-smtp-provider.md b/docs/examples/kotlin/messaging/update-smtp-provider.md new file mode 100644 index 0000000..40e466c --- /dev/null +++ b/docs/examples/kotlin/messaging/update-smtp-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateSmtpProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", // optional + host = "<HOST>", // optional + port = 1, // optional + username = "<USERNAME>", // optional + password = "<PASSWORD>", // optional + encryption = "none", // optional + autoTLS = false, // optional + mailer = "<MAILER>", // optional + fromName = "<FROM_NAME>", // optional + fromEmail = "email@example.com", // optional + replyToName = "<REPLY_TO_NAME>", // optional + replyToEmail = "<REPLY_TO_EMAIL>", // optional + enabled = false // optional +) diff --git a/docs/examples/kotlin/messaging/update-telesign-provider.md b/docs/examples/kotlin/messaging/update-telesign-provider.md new file mode 100644 index 0000000..601d676 --- /dev/null +++ b/docs/examples/kotlin/messaging/update-telesign-provider.md @@ -0,0 +1,19 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateTelesignProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", // optional + enabled = false, // optional + customerId = "<CUSTOMER_ID>", // optional + apiKey = "<API_KEY>", // optional + from = "<FROM>" // optional +) diff --git a/docs/examples/kotlin/messaging/update-textmagic-provider.md b/docs/examples/kotlin/messaging/update-textmagic-provider.md new file mode 100644 index 0000000..d16de03 --- /dev/null +++ b/docs/examples/kotlin/messaging/update-textmagic-provider.md @@ -0,0 +1,19 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateTextmagicProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", // optional + enabled = false, // optional + username = "<USERNAME>", // optional + apiKey = "<API_KEY>", // optional + from = "<FROM>" // optional +) diff --git a/docs/examples/kotlin/messaging/update-topic.md b/docs/examples/kotlin/messaging/update-topic.md new file mode 100644 index 0000000..9a20026 --- /dev/null +++ b/docs/examples/kotlin/messaging/update-topic.md @@ -0,0 +1,16 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateTopic( + topicId = "<TOPIC_ID>", + name = "<NAME>", // optional + subscribe = listOf("any") // optional +) diff --git a/docs/examples/kotlin/messaging/update-twilio-provider.md b/docs/examples/kotlin/messaging/update-twilio-provider.md new file mode 100644 index 0000000..bfd2775 --- /dev/null +++ b/docs/examples/kotlin/messaging/update-twilio-provider.md @@ -0,0 +1,19 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateTwilioProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", // optional + enabled = false, // optional + accountSid = "<ACCOUNT_SID>", // optional + authToken = "<AUTH_TOKEN>", // optional + from = "<FROM>" // optional +) diff --git a/docs/examples/kotlin/messaging/update-vonage-provider.md b/docs/examples/kotlin/messaging/update-vonage-provider.md new file mode 100644 index 0000000..209aef0 --- /dev/null +++ b/docs/examples/kotlin/messaging/update-vonage-provider.md @@ -0,0 +1,19 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateVonageProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", // optional + enabled = false, // optional + apiKey = "<API_KEY>", // optional + apiSecret = "<API_SECRET>", // optional + from = "<FROM>" // optional +) diff --git a/docs/examples/kotlin/storage/create-bucket.md b/docs/examples/kotlin/storage/create-bucket.md index 27d73ff..08419ef 100644 --- a/docs/examples/kotlin/storage/create-bucket.md +++ b/docs/examples/kotlin/storage/create-bucket.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Storage -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,14 @@ val client = Client(context) val storage = Storage(client) val response = storage.createBucket( - bucketId = "[BUCKET_ID]", - name = "[NAME]", + bucketId = "<BUCKET_ID>", + name = "<NAME>", + permissions = listOf("read("any")"), // optional + fileSecurity = false, // optional + enabled = false, // optional + maximumFileSize = 1, // optional + allowedFileExtensions = listOf(), // optional + compression = "none", // optional + encryption = false, // optional + antivirus = false // optional ) diff --git a/docs/examples/kotlin/storage/create-file.md b/docs/examples/kotlin/storage/create-file.md index 1bdf5e4..8789d17 100644 --- a/docs/examples/kotlin/storage/create-file.md +++ b/docs/examples/kotlin/storage/create-file.md @@ -1,16 +1,18 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.models.InputFile import io.appwrite.services.Storage -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val storage = Storage(client) val response = storage.createFile( - bucketId = "[BUCKET_ID]", - fileId = "[FILE_ID]", + bucketId = "<BUCKET_ID>", + fileId = "<FILE_ID>", file = InputFile.fromPath("file.png"), + permissions = listOf("read("any")") // optional ) diff --git a/docs/examples/kotlin/storage/delete-bucket.md b/docs/examples/kotlin/storage/delete-bucket.md index 3730a05..5209db7 100644 --- a/docs/examples/kotlin/storage/delete-bucket.md +++ b/docs/examples/kotlin/storage/delete-bucket.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Storage -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,5 +10,5 @@ val client = Client(context) val storage = Storage(client) val response = storage.deleteBucket( - bucketId = "[BUCKET_ID]" + bucketId = "<BUCKET_ID>" ) diff --git a/docs/examples/kotlin/storage/delete-file.md b/docs/examples/kotlin/storage/delete-file.md index dabf805..c26d900 100644 --- a/docs/examples/kotlin/storage/delete-file.md +++ b/docs/examples/kotlin/storage/delete-file.md @@ -1,14 +1,15 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Storage -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val storage = Storage(client) val response = storage.deleteFile( - bucketId = "[BUCKET_ID]", - fileId = "[FILE_ID]" + bucketId = "<BUCKET_ID>", + fileId = "<FILE_ID>" ) diff --git a/docs/examples/kotlin/storage/get-bucket.md b/docs/examples/kotlin/storage/get-bucket.md index 0c7fcc1..c8e007b 100644 --- a/docs/examples/kotlin/storage/get-bucket.md +++ b/docs/examples/kotlin/storage/get-bucket.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Storage -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,5 +10,5 @@ val client = Client(context) val storage = Storage(client) val response = storage.getBucket( - bucketId = "[BUCKET_ID]" + bucketId = "<BUCKET_ID>" ) diff --git a/docs/examples/kotlin/storage/get-file-download.md b/docs/examples/kotlin/storage/get-file-download.md index 6c3c1fb..0635561 100644 --- a/docs/examples/kotlin/storage/get-file-download.md +++ b/docs/examples/kotlin/storage/get-file-download.md @@ -1,14 +1,15 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Storage -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val storage = Storage(client) val result = storage.getFileDownload( - bucketId = "[BUCKET_ID]", - fileId = "[FILE_ID]" + bucketId = "<BUCKET_ID>", + fileId = "<FILE_ID>" ) diff --git a/docs/examples/kotlin/storage/get-file-preview.md b/docs/examples/kotlin/storage/get-file-preview.md index 372416e..3362bb0 100644 --- a/docs/examples/kotlin/storage/get-file-preview.md +++ b/docs/examples/kotlin/storage/get-file-preview.md @@ -1,14 +1,26 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Storage -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val storage = Storage(client) val result = storage.getFilePreview( - bucketId = "[BUCKET_ID]", - fileId = "[FILE_ID]", + bucketId = "<BUCKET_ID>", + fileId = "<FILE_ID>", + width = 0, // optional + height = 0, // optional + gravity = "center", // optional + quality = 0, // optional + borderWidth = 0, // optional + borderColor = "", // optional + borderRadius = 0, // optional + opacity = 0, // optional + rotation = -360, // optional + background = "", // optional + output = "jpg" // optional ) diff --git a/docs/examples/kotlin/storage/get-file-view.md b/docs/examples/kotlin/storage/get-file-view.md index 4b23cfc..4005a6d 100644 --- a/docs/examples/kotlin/storage/get-file-view.md +++ b/docs/examples/kotlin/storage/get-file-view.md @@ -1,14 +1,15 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Storage -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val storage = Storage(client) val result = storage.getFileView( - bucketId = "[BUCKET_ID]", - fileId = "[FILE_ID]" + bucketId = "<BUCKET_ID>", + fileId = "<FILE_ID>" ) diff --git a/docs/examples/kotlin/storage/get-file.md b/docs/examples/kotlin/storage/get-file.md index 211713c..5fc6d67 100644 --- a/docs/examples/kotlin/storage/get-file.md +++ b/docs/examples/kotlin/storage/get-file.md @@ -1,14 +1,15 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Storage -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val storage = Storage(client) val response = storage.getFile( - bucketId = "[BUCKET_ID]", - fileId = "[FILE_ID]" + bucketId = "<BUCKET_ID>", + fileId = "<FILE_ID>" ) diff --git a/docs/examples/kotlin/storage/list-buckets.md b/docs/examples/kotlin/storage/list-buckets.md index 8c4c7bd..942490e 100644 --- a/docs/examples/kotlin/storage/list-buckets.md +++ b/docs/examples/kotlin/storage/list-buckets.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Storage -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,4 +10,6 @@ val client = Client(context) val storage = Storage(client) val response = storage.listBuckets( + queries = listOf(), // optional + search = "<SEARCH>" // optional ) diff --git a/docs/examples/kotlin/storage/list-files.md b/docs/examples/kotlin/storage/list-files.md index 5243ed7..50fcda6 100644 --- a/docs/examples/kotlin/storage/list-files.md +++ b/docs/examples/kotlin/storage/list-files.md @@ -1,13 +1,16 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Storage -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val storage = Storage(client) val response = storage.listFiles( - bucketId = "[BUCKET_ID]", + bucketId = "<BUCKET_ID>", + queries = listOf(), // optional + search = "<SEARCH>" // optional ) diff --git a/docs/examples/kotlin/storage/update-bucket.md b/docs/examples/kotlin/storage/update-bucket.md index 3de3b54..45bcf39 100644 --- a/docs/examples/kotlin/storage/update-bucket.md +++ b/docs/examples/kotlin/storage/update-bucket.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Storage -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,14 @@ val client = Client(context) val storage = Storage(client) val response = storage.updateBucket( - bucketId = "[BUCKET_ID]", - name = "[NAME]", + bucketId = "<BUCKET_ID>", + name = "<NAME>", + permissions = listOf("read("any")"), // optional + fileSecurity = false, // optional + enabled = false, // optional + maximumFileSize = 1, // optional + allowedFileExtensions = listOf(), // optional + compression = "none", // optional + encryption = false, // optional + antivirus = false // optional ) diff --git a/docs/examples/kotlin/storage/update-file.md b/docs/examples/kotlin/storage/update-file.md index 3d7fb9a..05fb981 100644 --- a/docs/examples/kotlin/storage/update-file.md +++ b/docs/examples/kotlin/storage/update-file.md @@ -1,14 +1,17 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Storage -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val storage = Storage(client) val response = storage.updateFile( - bucketId = "[BUCKET_ID]", - fileId = "[FILE_ID]", + bucketId = "<BUCKET_ID>", + fileId = "<FILE_ID>", + name = "<NAME>", // optional + permissions = listOf("read("any")") // optional ) diff --git a/docs/examples/kotlin/teams/create-membership.md b/docs/examples/kotlin/teams/create-membership.md index b37a453..59cd67e 100644 --- a/docs/examples/kotlin/teams/create-membership.md +++ b/docs/examples/kotlin/teams/create-membership.md @@ -1,14 +1,20 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Teams -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val teams = Teams(client) val response = teams.createMembership( - teamId = "[TEAM_ID]", + teamId = "<TEAM_ID>", roles = listOf(), + email = "email@example.com", // optional + userId = "<USER_ID>", // optional + phone = "+12065550100", // optional + url = "https://example.com", // optional + name = "<NAME>" // optional ) diff --git a/docs/examples/kotlin/teams/create.md b/docs/examples/kotlin/teams/create.md index 9e080a1..9b1ceaa 100644 --- a/docs/examples/kotlin/teams/create.md +++ b/docs/examples/kotlin/teams/create.md @@ -1,14 +1,16 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Teams -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val teams = Teams(client) val response = teams.create( - teamId = "[TEAM_ID]", - name = "[NAME]", + teamId = "<TEAM_ID>", + name = "<NAME>", + roles = listOf() // optional ) diff --git a/docs/examples/kotlin/teams/delete-membership.md b/docs/examples/kotlin/teams/delete-membership.md index 16e73e4..7f703a6 100644 --- a/docs/examples/kotlin/teams/delete-membership.md +++ b/docs/examples/kotlin/teams/delete-membership.md @@ -1,14 +1,15 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Teams -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val teams = Teams(client) val response = teams.deleteMembership( - teamId = "[TEAM_ID]", - membershipId = "[MEMBERSHIP_ID]" + teamId = "<TEAM_ID>", + membershipId = "<MEMBERSHIP_ID>" ) diff --git a/docs/examples/kotlin/teams/delete.md b/docs/examples/kotlin/teams/delete.md index c015a77..678182b 100644 --- a/docs/examples/kotlin/teams/delete.md +++ b/docs/examples/kotlin/teams/delete.md @@ -1,13 +1,14 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Teams -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val teams = Teams(client) val response = teams.delete( - teamId = "[TEAM_ID]" + teamId = "<TEAM_ID>" ) diff --git a/docs/examples/kotlin/teams/get-membership.md b/docs/examples/kotlin/teams/get-membership.md index 4f2bed3..860ded7 100644 --- a/docs/examples/kotlin/teams/get-membership.md +++ b/docs/examples/kotlin/teams/get-membership.md @@ -1,14 +1,15 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Teams -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val teams = Teams(client) val response = teams.getMembership( - teamId = "[TEAM_ID]", - membershipId = "[MEMBERSHIP_ID]" + teamId = "<TEAM_ID>", + membershipId = "<MEMBERSHIP_ID>" ) diff --git a/docs/examples/kotlin/teams/get-prefs.md b/docs/examples/kotlin/teams/get-prefs.md index 1bfcf07..331d3c3 100644 --- a/docs/examples/kotlin/teams/get-prefs.md +++ b/docs/examples/kotlin/teams/get-prefs.md @@ -1,13 +1,14 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Teams -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val teams = Teams(client) val response = teams.getPrefs( - teamId = "[TEAM_ID]" + teamId = "<TEAM_ID>" ) diff --git a/docs/examples/kotlin/teams/get.md b/docs/examples/kotlin/teams/get.md index 402aeb1..dfd0a53 100644 --- a/docs/examples/kotlin/teams/get.md +++ b/docs/examples/kotlin/teams/get.md @@ -1,13 +1,14 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Teams -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val teams = Teams(client) val response = teams.get( - teamId = "[TEAM_ID]" + teamId = "<TEAM_ID>" ) diff --git a/docs/examples/kotlin/teams/list-memberships.md b/docs/examples/kotlin/teams/list-memberships.md index e9eae80..8f94247 100644 --- a/docs/examples/kotlin/teams/list-memberships.md +++ b/docs/examples/kotlin/teams/list-memberships.md @@ -1,13 +1,16 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Teams -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val teams = Teams(client) val response = teams.listMemberships( - teamId = "[TEAM_ID]", + teamId = "<TEAM_ID>", + queries = listOf(), // optional + search = "<SEARCH>" // optional ) diff --git a/docs/examples/kotlin/teams/list.md b/docs/examples/kotlin/teams/list.md index aa10ca5..6d40484 100644 --- a/docs/examples/kotlin/teams/list.md +++ b/docs/examples/kotlin/teams/list.md @@ -1,12 +1,15 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Teams -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val teams = Teams(client) val response = teams.list( + queries = listOf(), // optional + search = "<SEARCH>" // optional ) diff --git a/docs/examples/kotlin/teams/update-membership-status.md b/docs/examples/kotlin/teams/update-membership-status.md index 7fa6bd8..d72eace 100644 --- a/docs/examples/kotlin/teams/update-membership-status.md +++ b/docs/examples/kotlin/teams/update-membership-status.md @@ -1,16 +1,17 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Teams -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val teams = Teams(client) val response = teams.updateMembershipStatus( - teamId = "[TEAM_ID]", - membershipId = "[MEMBERSHIP_ID]", - userId = "[USER_ID]", - secret = "[SECRET]" + teamId = "<TEAM_ID>", + membershipId = "<MEMBERSHIP_ID>", + userId = "<USER_ID>", + secret = "<SECRET>" ) diff --git a/docs/examples/kotlin/teams/update-membership.md b/docs/examples/kotlin/teams/update-membership.md index 9ca3a30..61b3622 100644 --- a/docs/examples/kotlin/teams/update-membership.md +++ b/docs/examples/kotlin/teams/update-membership.md @@ -1,15 +1,16 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Teams -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val teams = Teams(client) val response = teams.updateMembership( - teamId = "[TEAM_ID]", - membershipId = "[MEMBERSHIP_ID]", + teamId = "<TEAM_ID>", + membershipId = "<MEMBERSHIP_ID>", roles = listOf() ) diff --git a/docs/examples/kotlin/teams/update-name.md b/docs/examples/kotlin/teams/update-name.md index d717c37..cfa5022 100644 --- a/docs/examples/kotlin/teams/update-name.md +++ b/docs/examples/kotlin/teams/update-name.md @@ -1,14 +1,15 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Teams -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + .setSession("") // The user session to authenticate with val teams = Teams(client) val response = teams.updateName( - teamId = "[TEAM_ID]", - name = "[NAME]" + teamId = "<TEAM_ID>", + name = "<NAME>" ) diff --git a/docs/examples/kotlin/teams/update-prefs.md b/docs/examples/kotlin/teams/update-prefs.md index 62fc925..60bb17f 100644 --- a/docs/examples/kotlin/teams/update-prefs.md +++ b/docs/examples/kotlin/teams/update-prefs.md @@ -1,14 +1,15 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Teams -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID - .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token + .setSession("") // The user session to authenticate with val teams = Teams(client) val response = teams.updatePrefs( - teamId = "[TEAM_ID]", + teamId = "<TEAM_ID>", prefs = mapOf( "a" to "b" ) ) diff --git a/docs/examples/kotlin/users/create-argon2user.md b/docs/examples/kotlin/users/create-argon2user.md index 438363a..47e9e34 100644 --- a/docs/examples/kotlin/users/create-argon2user.md +++ b/docs/examples/kotlin/users/create-argon2user.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,7 +10,8 @@ val client = Client(context) val users = Users(client) val response = users.createArgon2User( - userId = "[USER_ID]", + userId = "<USER_ID>", email = "email@example.com", password = "password", + name = "<NAME>" // optional ) diff --git a/docs/examples/kotlin/users/create-bcrypt-user.md b/docs/examples/kotlin/users/create-bcrypt-user.md index 977782c..938c90d 100644 --- a/docs/examples/kotlin/users/create-bcrypt-user.md +++ b/docs/examples/kotlin/users/create-bcrypt-user.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,7 +10,8 @@ val client = Client(context) val users = Users(client) val response = users.createBcryptUser( - userId = "[USER_ID]", + userId = "<USER_ID>", email = "email@example.com", password = "password", + name = "<NAME>" // optional ) diff --git a/docs/examples/kotlin/users/create-m-d5user.md b/docs/examples/kotlin/users/create-m-d5user.md index 6d6451f..cadc7e5 100644 --- a/docs/examples/kotlin/users/create-m-d5user.md +++ b/docs/examples/kotlin/users/create-m-d5user.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,7 +10,8 @@ val client = Client(context) val users = Users(client) val response = users.createMD5User( - userId = "[USER_ID]", + userId = "<USER_ID>", email = "email@example.com", password = "password", + name = "<NAME>" // optional ) diff --git a/docs/examples/kotlin/users/create-mfa-recovery-codes.md b/docs/examples/kotlin/users/create-mfa-recovery-codes.md new file mode 100644 index 0000000..cd63135 --- /dev/null +++ b/docs/examples/kotlin/users/create-mfa-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val users = Users(client) + +val response = users.createMfaRecoveryCodes( + userId = "<USER_ID>" +) diff --git a/docs/examples/kotlin/users/create-p-h-pass-user.md b/docs/examples/kotlin/users/create-p-h-pass-user.md index c50b2c1..e473698 100644 --- a/docs/examples/kotlin/users/create-p-h-pass-user.md +++ b/docs/examples/kotlin/users/create-p-h-pass-user.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,7 +10,8 @@ val client = Client(context) val users = Users(client) val response = users.createPHPassUser( - userId = "[USER_ID]", + userId = "<USER_ID>", email = "email@example.com", password = "password", + name = "<NAME>" // optional ) diff --git a/docs/examples/kotlin/users/create-s-h-a-user.md b/docs/examples/kotlin/users/create-s-h-a-user.md index 708935c..f169d38 100644 --- a/docs/examples/kotlin/users/create-s-h-a-user.md +++ b/docs/examples/kotlin/users/create-s-h-a-user.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,7 +10,9 @@ val client = Client(context) val users = Users(client) val response = users.createSHAUser( - userId = "[USER_ID]", + userId = "<USER_ID>", email = "email@example.com", password = "password", + passwordVersion = "sha1", // optional + name = "<NAME>" // optional ) diff --git a/docs/examples/kotlin/users/create-scrypt-modified-user.md b/docs/examples/kotlin/users/create-scrypt-modified-user.md index d49f7db..738de12 100644 --- a/docs/examples/kotlin/users/create-scrypt-modified-user.md +++ b/docs/examples/kotlin/users/create-scrypt-modified-user.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,10 +10,11 @@ val client = Client(context) val users = Users(client) val response = users.createScryptModifiedUser( - userId = "[USER_ID]", + userId = "<USER_ID>", email = "email@example.com", password = "password", - passwordSalt = "[PASSWORD_SALT]", - passwordSaltSeparator = "[PASSWORD_SALT_SEPARATOR]", - passwordSignerKey = "[PASSWORD_SIGNER_KEY]", + passwordSalt = "<PASSWORD_SALT>", + passwordSaltSeparator = "<PASSWORD_SALT_SEPARATOR>", + passwordSignerKey = "<PASSWORD_SIGNER_KEY>", + name = "<NAME>" // optional ) diff --git a/docs/examples/kotlin/users/create-scrypt-user.md b/docs/examples/kotlin/users/create-scrypt-user.md index aa006fb..9a547bd 100644 --- a/docs/examples/kotlin/users/create-scrypt-user.md +++ b/docs/examples/kotlin/users/create-scrypt-user.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,12 +10,13 @@ val client = Client(context) val users = Users(client) val response = users.createScryptUser( - userId = "[USER_ID]", + userId = "<USER_ID>", email = "email@example.com", password = "password", - passwordSalt = "[PASSWORD_SALT]", + passwordSalt = "<PASSWORD_SALT>", passwordCpu = 0, passwordMemory = 0, passwordParallel = 0, passwordLength = 0, + name = "<NAME>" // optional ) diff --git a/docs/examples/kotlin/users/create-session.md b/docs/examples/kotlin/users/create-session.md new file mode 100644 index 0000000..0eed0ce --- /dev/null +++ b/docs/examples/kotlin/users/create-session.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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val users = Users(client) + +val response = users.createSession( + userId = "<USER_ID>" +) diff --git a/docs/examples/kotlin/users/create-target.md b/docs/examples/kotlin/users/create-target.md new file mode 100644 index 0000000..a683cb0 --- /dev/null +++ b/docs/examples/kotlin/users/create-target.md @@ -0,0 +1,20 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users +import io.appwrite.enums.MessagingProviderType + +val client = Client() + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val users = Users(client) + +val response = users.createTarget( + userId = "<USER_ID>", + targetId = "<TARGET_ID>", + providerType = MessagingProviderType.EMAIL, + identifier = "<IDENTIFIER>", + providerId = "<PROVIDER_ID>", // optional + name = "<NAME>" // optional +) diff --git a/docs/examples/kotlin/users/create-token.md b/docs/examples/kotlin/users/create-token.md new file mode 100644 index 0000000..0d39bcc --- /dev/null +++ b/docs/examples/kotlin/users/create-token.md @@ -0,0 +1,16 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val users = Users(client) + +val response = users.createToken( + userId = "<USER_ID>", + length = 4, // optional + expire = 60 // optional +) diff --git a/docs/examples/kotlin/users/create.md b/docs/examples/kotlin/users/create.md index ae319d8..8983f6f 100644 --- a/docs/examples/kotlin/users/create.md +++ b/docs/examples/kotlin/users/create.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,5 +10,9 @@ val client = Client(context) val users = Users(client) val response = users.create( - userId = "[USER_ID]", + userId = "<USER_ID>", + email = "email@example.com", // optional + phone = "+12065550100", // optional + password = "", // optional + name = "<NAME>" // optional ) diff --git a/docs/examples/kotlin/users/delete-identity.md b/docs/examples/kotlin/users/delete-identity.md index 7b4de82..59e927e 100644 --- a/docs/examples/kotlin/users/delete-identity.md +++ b/docs/examples/kotlin/users/delete-identity.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,5 +10,5 @@ val client = Client(context) val users = Users(client) val response = users.deleteIdentity( - identityId = "[IDENTITY_ID]" + identityId = "<IDENTITY_ID>" ) diff --git a/docs/examples/kotlin/users/delete-mfa-authenticator.md b/docs/examples/kotlin/users/delete-mfa-authenticator.md new file mode 100644 index 0000000..56df063 --- /dev/null +++ b/docs/examples/kotlin/users/delete-mfa-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val users = Users(client) + +val response = users.deleteMfaAuthenticator( + userId = "<USER_ID>", + type = AuthenticatorType.TOTP +) diff --git a/docs/examples/kotlin/users/delete-session.md b/docs/examples/kotlin/users/delete-session.md index f3a0264..c9fffad 100644 --- a/docs/examples/kotlin/users/delete-session.md +++ b/docs/examples/kotlin/users/delete-session.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,6 @@ val client = Client(context) val users = Users(client) val response = users.deleteSession( - userId = "[USER_ID]", - sessionId = "[SESSION_ID]" + userId = "<USER_ID>", + sessionId = "<SESSION_ID>" ) diff --git a/docs/examples/kotlin/users/delete-sessions.md b/docs/examples/kotlin/users/delete-sessions.md index 5c0070c..51b92ea 100644 --- a/docs/examples/kotlin/users/delete-sessions.md +++ b/docs/examples/kotlin/users/delete-sessions.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,5 +10,5 @@ val client = Client(context) val users = Users(client) val response = users.deleteSessions( - userId = "[USER_ID]" + userId = "<USER_ID>" ) diff --git a/docs/examples/kotlin/users/delete-target.md b/docs/examples/kotlin/users/delete-target.md new file mode 100644 index 0000000..50e641d --- /dev/null +++ b/docs/examples/kotlin/users/delete-target.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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val users = Users(client) + +val response = users.deleteTarget( + userId = "<USER_ID>", + targetId = "<TARGET_ID>" +) diff --git a/docs/examples/kotlin/users/delete.md b/docs/examples/kotlin/users/delete.md index 30ee8f3..508e72e 100644 --- a/docs/examples/kotlin/users/delete.md +++ b/docs/examples/kotlin/users/delete.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,5 +10,5 @@ val client = Client(context) val users = Users(client) val response = users.delete( - userId = "[USER_ID]" + userId = "<USER_ID>" ) diff --git a/docs/examples/kotlin/users/get-mfa-recovery-codes.md b/docs/examples/kotlin/users/get-mfa-recovery-codes.md new file mode 100644 index 0000000..e2e7554 --- /dev/null +++ b/docs/examples/kotlin/users/get-mfa-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val users = Users(client) + +val response = users.getMfaRecoveryCodes( + userId = "<USER_ID>" +) diff --git a/docs/examples/kotlin/users/get-prefs.md b/docs/examples/kotlin/users/get-prefs.md index 564489c..b89f0fd 100644 --- a/docs/examples/kotlin/users/get-prefs.md +++ b/docs/examples/kotlin/users/get-prefs.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,5 +10,5 @@ val client = Client(context) val users = Users(client) val response = users.getPrefs( - userId = "[USER_ID]" + userId = "<USER_ID>" ) diff --git a/docs/examples/kotlin/users/get-target.md b/docs/examples/kotlin/users/get-target.md new file mode 100644 index 0000000..cd89cb7 --- /dev/null +++ b/docs/examples/kotlin/users/get-target.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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val users = Users(client) + +val response = users.getTarget( + userId = "<USER_ID>", + targetId = "<TARGET_ID>" +) diff --git a/docs/examples/kotlin/users/get.md b/docs/examples/kotlin/users/get.md index fd7e4b7..9f296b5 100644 --- a/docs/examples/kotlin/users/get.md +++ b/docs/examples/kotlin/users/get.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,5 +10,5 @@ val client = Client(context) val users = Users(client) val response = users.get( - userId = "[USER_ID]" + userId = "<USER_ID>" ) diff --git a/docs/examples/kotlin/users/list-identities.md b/docs/examples/kotlin/users/list-identities.md index 0135fb1..4e13335 100644 --- a/docs/examples/kotlin/users/list-identities.md +++ b/docs/examples/kotlin/users/list-identities.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,4 +10,6 @@ val client = Client(context) val users = Users(client) val response = users.listIdentities( + queries = listOf(), // optional + search = "<SEARCH>" // optional ) diff --git a/docs/examples/kotlin/users/list-logs.md b/docs/examples/kotlin/users/list-logs.md index 6910075..3c5ece2 100644 --- a/docs/examples/kotlin/users/list-logs.md +++ b/docs/examples/kotlin/users/list-logs.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,5 +10,6 @@ val client = Client(context) val users = Users(client) val response = users.listLogs( - userId = "[USER_ID]", + userId = "<USER_ID>", + queries = listOf() // optional ) diff --git a/docs/examples/kotlin/users/list-memberships.md b/docs/examples/kotlin/users/list-memberships.md index 316889e..498644c 100644 --- a/docs/examples/kotlin/users/list-memberships.md +++ b/docs/examples/kotlin/users/list-memberships.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,5 +10,5 @@ val client = Client(context) val users = Users(client) val response = users.listMemberships( - userId = "[USER_ID]" + userId = "<USER_ID>" ) diff --git a/docs/examples/kotlin/users/list-mfa-factors.md b/docs/examples/kotlin/users/list-mfa-factors.md new file mode 100644 index 0000000..162a66b --- /dev/null +++ b/docs/examples/kotlin/users/list-mfa-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val users = Users(client) + +val response = users.listMfaFactors( + userId = "<USER_ID>" +) diff --git a/docs/examples/kotlin/users/list-sessions.md b/docs/examples/kotlin/users/list-sessions.md index 1d7e950..a213355 100644 --- a/docs/examples/kotlin/users/list-sessions.md +++ b/docs/examples/kotlin/users/list-sessions.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,5 +10,5 @@ val client = Client(context) val users = Users(client) val response = users.listSessions( - userId = "[USER_ID]" + userId = "<USER_ID>" ) diff --git a/docs/examples/kotlin/users/list-targets.md b/docs/examples/kotlin/users/list-targets.md new file mode 100644 index 0000000..d2eb67f --- /dev/null +++ b/docs/examples/kotlin/users/list-targets.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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val users = Users(client) + +val response = users.listTargets( + userId = "<USER_ID>", + queries = listOf() // optional +) diff --git a/docs/examples/kotlin/users/list.md b/docs/examples/kotlin/users/list.md index e973a26..8744fec 100644 --- a/docs/examples/kotlin/users/list.md +++ b/docs/examples/kotlin/users/list.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,4 +10,6 @@ val client = Client(context) val users = Users(client) val response = users.list( + queries = listOf(), // optional + search = "<SEARCH>" // optional ) diff --git a/docs/examples/kotlin/users/update-email-verification.md b/docs/examples/kotlin/users/update-email-verification.md index b4f97bb..ea2e7c5 100644 --- a/docs/examples/kotlin/users/update-email-verification.md +++ b/docs/examples/kotlin/users/update-email-verification.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,6 @@ val client = Client(context) val users = Users(client) val response = users.updateEmailVerification( - userId = "[USER_ID]", + userId = "<USER_ID>", emailVerification = false ) diff --git a/docs/examples/kotlin/users/update-email.md b/docs/examples/kotlin/users/update-email.md index c6dfaef..27f1437 100644 --- a/docs/examples/kotlin/users/update-email.md +++ b/docs/examples/kotlin/users/update-email.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,6 @@ val client = Client(context) val users = Users(client) val response = users.updateEmail( - userId = "[USER_ID]", + userId = "<USER_ID>", email = "email@example.com" ) diff --git a/docs/examples/kotlin/users/update-labels.md b/docs/examples/kotlin/users/update-labels.md index 4e869f8..0414183 100644 --- a/docs/examples/kotlin/users/update-labels.md +++ b/docs/examples/kotlin/users/update-labels.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,6 @@ val client = Client(context) val users = Users(client) val response = users.updateLabels( - userId = "[USER_ID]", + userId = "<USER_ID>", labels = listOf() ) diff --git a/docs/examples/kotlin/users/update-mfa-recovery-codes.md b/docs/examples/kotlin/users/update-mfa-recovery-codes.md new file mode 100644 index 0000000..723599f --- /dev/null +++ b/docs/examples/kotlin/users/update-mfa-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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val users = Users(client) + +val response = users.updateMfaRecoveryCodes( + userId = "<USER_ID>" +) diff --git a/docs/examples/kotlin/users/update-mfa.md b/docs/examples/kotlin/users/update-mfa.md new file mode 100644 index 0000000..50e9255 --- /dev/null +++ b/docs/examples/kotlin/users/update-mfa.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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val users = Users(client) + +val response = users.updateMfa( + userId = "<USER_ID>", + mfa = false +) diff --git a/docs/examples/kotlin/users/update-name.md b/docs/examples/kotlin/users/update-name.md index 1d46c7a..96db1f9 100644 --- a/docs/examples/kotlin/users/update-name.md +++ b/docs/examples/kotlin/users/update-name.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,6 @@ val client = Client(context) val users = Users(client) val response = users.updateName( - userId = "[USER_ID]", - name = "[NAME]" + userId = "<USER_ID>", + name = "<NAME>" ) diff --git a/docs/examples/kotlin/users/update-password.md b/docs/examples/kotlin/users/update-password.md index f96158f..00fd47f 100644 --- a/docs/examples/kotlin/users/update-password.md +++ b/docs/examples/kotlin/users/update-password.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,6 @@ val client = Client(context) val users = Users(client) val response = users.updatePassword( - userId = "[USER_ID]", + userId = "<USER_ID>", password = "" ) diff --git a/docs/examples/kotlin/users/update-phone-verification.md b/docs/examples/kotlin/users/update-phone-verification.md index 909803b..9b311aa 100644 --- a/docs/examples/kotlin/users/update-phone-verification.md +++ b/docs/examples/kotlin/users/update-phone-verification.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,6 @@ val client = Client(context) val users = Users(client) val response = users.updatePhoneVerification( - userId = "[USER_ID]", + userId = "<USER_ID>", phoneVerification = false ) diff --git a/docs/examples/kotlin/users/update-phone.md b/docs/examples/kotlin/users/update-phone.md index 073dd66..1442662 100644 --- a/docs/examples/kotlin/users/update-phone.md +++ b/docs/examples/kotlin/users/update-phone.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,6 @@ val client = Client(context) val users = Users(client) val response = users.updatePhone( - userId = "[USER_ID]", + userId = "<USER_ID>", number = "+12065550100" ) diff --git a/docs/examples/kotlin/users/update-prefs.md b/docs/examples/kotlin/users/update-prefs.md index 127035c..d2e7041 100644 --- a/docs/examples/kotlin/users/update-prefs.md +++ b/docs/examples/kotlin/users/update-prefs.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,6 @@ val client = Client(context) val users = Users(client) val response = users.updatePrefs( - userId = "[USER_ID]", + userId = "<USER_ID>", prefs = mapOf( "a" to "b" ) ) diff --git a/docs/examples/kotlin/users/update-status.md b/docs/examples/kotlin/users/update-status.md index 5899ed3..e568cc9 100644 --- a/docs/examples/kotlin/users/update-status.md +++ b/docs/examples/kotlin/users/update-status.md @@ -1,7 +1,8 @@ import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback import io.appwrite.services.Users -val client = Client(context) +val client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key @@ -9,6 +10,6 @@ val client = Client(context) val users = Users(client) val response = users.updateStatus( - userId = "[USER_ID]", + userId = "<USER_ID>", status = false ) diff --git a/docs/examples/kotlin/users/update-target.md b/docs/examples/kotlin/users/update-target.md new file mode 100644 index 0000000..9326748 --- /dev/null +++ b/docs/examples/kotlin/users/update-target.md @@ -0,0 +1,18 @@ +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("5df5acd0d48c2") // Your project ID + .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + +val users = Users(client) + +val response = users.updateTarget( + userId = "<USER_ID>", + targetId = "<TARGET_ID>", + identifier = "<IDENTIFIER>", // optional + providerId = "<PROVIDER_ID>", // optional + name = "<NAME>" // optional +) diff --git a/src/main/kotlin/io/appwrite/Client.kt b/src/main/kotlin/io/appwrite/Client.kt index 9ed5471..b65eacc 100644 --- a/src/main/kotlin/io/appwrite/Client.kt +++ b/src/main/kotlin/io/appwrite/Client.kt @@ -1,10 +1,8 @@ package io.appwrite -import com.google.gson.GsonBuilder -import com.google.gson.reflect.TypeToken import io.appwrite.exceptions.AppwriteException import io.appwrite.extensions.fromJson -import io.appwrite.json.PreciseNumberAdapter +import io.appwrite.extensions.toJson import io.appwrite.models.InputFile import io.appwrite.models.UploadProgress import kotlinx.coroutines.CoroutineScope @@ -34,7 +32,7 @@ import kotlin.coroutines.CoroutineContext import kotlin.coroutines.resume class Client @JvmOverloads constructor( - var endPoint: String = "https://HOSTNAME/v1", + var endPoint: String = "https://cloud.appwrite.io/v1", private var selfSigned: Boolean = false ) : CoroutineScope { @@ -47,13 +45,10 @@ class Client @JvmOverloads constructor( private val job = Job() - private val gson = GsonBuilder().registerTypeAdapter( - object : TypeToken<Map<String, Any>>(){}.type, - PreciseNumberAdapter() - ).create() - lateinit var http: OkHttpClient + lateinit var httpForRedirect: OkHttpClient + private val headers: MutableMap<String, String> val config: MutableMap<String, String> @@ -62,12 +57,14 @@ class Client @JvmOverloads constructor( init { headers = mutableMapOf( "content-type" to "application/json", - "user-agent" to "AppwriteKotlinSDK/4.1.0 ${System.getProperty("http.agent")}", + "user-agent" to "AppwriteKotlinSDK/5.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 "4.1.0", "x-appwrite-response-format" to "1.4.0" + "x-sdk-version" to "5.0.0", + "x-appwrite-response-format" to "1.5.0", ) + config = mutableMapOf() setSelfSigned(selfSigned) @@ -131,6 +128,36 @@ class Client @JvmOverloads constructor( return this } + /** + * Set Session + * + * The user session to authenticate with + * + * @param {string} session + * + * @return this + */ + fun setSession(value: String): Client { + config["session"] = value + addHeader("x-appwrite-session", value) + return this + } + + /** + * Set ForwardedUserAgent + * + * The user agent string of the client that made the request + * + * @param {string} forwardeduseragent + * + * @return this + */ + fun setForwardedUserAgent(value: String): Client { + config["forwardedUserAgent"] = value + addHeader("x-forwarded-user-agent", value) + return this + } + /** * Set self Signed * @@ -146,6 +173,7 @@ class Client @JvmOverloads constructor( if (!selfSigned) { http = builder.build() + httpForRedirect = builder.followRedirects(false).build() return this } @@ -208,24 +236,22 @@ class Client @JvmOverloads constructor( } /** - * Send the HTTP request - * + * Prepare the HTTP request + * * @param method * @param path * @param headers * @param params * - * @return [T] + * @return [Request] */ @Throws(AppwriteException::class) - suspend fun <T> call( + suspend fun prepareRequest( method: String, path: String, headers: Map<String, String> = mapOf(), params: Map<String, Any?> = mapOf(), - responseType: Class<T>, - converter: ((Any) -> T)? = null - ): T { + ): Request { val filteredParams = params.filterValues { it != null } val requestHeaders = this.headers.toHeaders().newBuilder() @@ -254,13 +280,12 @@ class Client @JvmOverloads constructor( } } } - val request = Request.Builder() + + return Request.Builder() .url(httpBuilder.build()) .headers(requestHeaders) .get() .build() - - return awaitResponse(request, responseType, converter) } val body = if (MultipartBody.FORM.toString() == headers["content-type"]) { @@ -287,19 +312,63 @@ class Client @JvmOverloads constructor( } builder.build() } else { - gson.toJson(filteredParams) + filteredParams + .toJson() .toRequestBody("application/json".toMediaType()) } - val request = Request.Builder() + return Request.Builder() .url(httpBuilder.build()) .headers(requestHeaders) .method(method, body) .build() + } + /** + * Send the HTTP request + * + * @param method + * @param path + * @param headers + * @param params + * + * @return [T] + */ + @Throws(AppwriteException::class) + suspend fun <T> call( + method: String, + path: String, + headers: Map<String, String> = mapOf(), + params: Map<String, Any?> = mapOf(), + responseType: Class<T>, + converter: ((Any) -> T)? = null + ): T { + val request = prepareRequest(method, path, headers, params) return awaitResponse(request, responseType, converter) } + /** + * Send the HTTP request + * + * @param method + * @param path + * @param headers + * @param params + * + * @return [T] + */ + @Throws(AppwriteException::class) + suspend fun redirect( + method: String, + path: String, + headers: Map<String, String> = mapOf(), + params: Map<String, Any?> = mapOf(), + ): String { + val request = prepareRequest(method, path, headers, params) + val response = awaitRedirect(request) + return response.header("Location") ?: "" + } + /** * Upload a file in chunks * @@ -425,6 +494,54 @@ class Client @JvmOverloads constructor( return converter(result as Map<String, Any>) } + /** + * Await Redirect + * + * @param request + * @param responseType + + * @return [Response] + */ + @Throws(AppwriteException::class) + private suspend fun awaitRedirect( + request: Request + ) = suspendCancellableCoroutine<Response> { + httpForRedirect.newCall(request).enqueue(object : Callback { + override fun onFailure(call: Call, e: IOException) { + if (it.isCancelled) { + return + } + it.cancel(e) + } + + @Suppress("UNCHECKED_CAST") + override fun onResponse(call: Call, response: Response) { + if (response.code < 300 || response.code >= 400) { + val body = response.body!! + .charStream() + .buffered() + .use(BufferedReader::readText) + + val error = if (response.headers["content-type"]?.contains("application/json") == true) { + val map = body.fromJson<Map<String, Any>>() + + AppwriteException( + map["message"] as? String ?: "", + (map["code"] as Number).toInt(), + map["type"] as? String ?: "", + body + ) + } else { + AppwriteException(body, response.code) + } + it.cancel(error) + return + } + it.resume(response) + } + }) + } + /** * Await Response * @@ -457,10 +574,8 @@ class Client @JvmOverloads constructor( .use(BufferedReader::readText) val error = if (response.headers["content-type"]?.contains("application/json") == true) { - val map = gson.fromJson<Map<String, Any>>( - body, - object : TypeToken<Map<String, Any>>(){}.type - ) + val map = body.fromJson<Map<String, Any>>() + AppwriteException( map["message"] as? String ?: "", (map["code"] as Number).toInt(), @@ -499,10 +614,7 @@ class Client @JvmOverloads constructor( it.resume(true as T) return } - val map = gson.fromJson<Map<String, Any>>( - body, - object : TypeToken<Map<String, Any>>(){}.type - ) + val map = body.fromJson<Map<String, Any>>() it.resume( converter?.invoke(map) ?: map as T ) diff --git a/src/main/kotlin/io/appwrite/Query.kt b/src/main/kotlin/io/appwrite/Query.kt index 7957865..6efbb11 100644 --- a/src/main/kotlin/io/appwrite/Query.kt +++ b/src/main/kotlin/io/appwrite/Query.kt @@ -1,60 +1,65 @@ package io.appwrite -class Query { - companion object { - fun equal(attribute: String, value: Any) = addQuery(attribute, "equal", value) +import io.appwrite.extensions.toJson +import io.appwrite.extensions.fromJson - fun notEqual(attribute: String, value: Any) = Query.addQuery(attribute, "notEqual", value) +class Query( + val method: String, + val attribute: String? = null, + val values: List<Any>? = null, +) { + override fun toString() = this.toJson() - fun lessThan(attribute: String, value: Any) = Query.addQuery(attribute, "lessThan", value) + companion object { + fun equal(attribute: String, value: Any) = Query("equal", attribute, parseValue(value)).toJson() - fun lessThanEqual(attribute: String, value: Any) = Query.addQuery(attribute, "lessThanEqual", value) + fun notEqual(attribute: String, value: Any) = Query("notEqual", attribute, parseValue(value)).toJson() - fun greaterThan(attribute: String, value: Any) = Query.addQuery(attribute, "greaterThan", value) + fun lessThan(attribute: String, value: Any) = Query("lessThan", attribute, parseValue(value)).toJson() - fun greaterThanEqual(attribute: String, value: Any) = Query.addQuery(attribute, "greaterThanEqual", value) - - fun search(attribute: String, value: String) = Query.addQuery(attribute, "search", value) + fun lessThanEqual(attribute: String, value: Any) = Query("lessThanEqual", attribute, parseValue(value)).toJson() - fun isNull(attribute: String) = "isNull(\"${attribute}\")" + fun greaterThan(attribute: String, value: Any) = Query("greaterThan", attribute, parseValue(value)).toJson() - fun isNotNull(attribute: String) = "isNotNull(\"${attribute}\")" + fun greaterThanEqual(attribute: String, value: Any) = Query("greaterThanEqual", attribute, parseValue(value)).toJson() - fun between(attribute: String, start: Int, end: Int) = "between(\"${attribute}\", ${start}, ${end})" + fun search(attribute: String, value: String) = Query("search", attribute, listOf(value)).toJson() - fun between(attribute: String, start: Double, end: Double) = "between(\"${attribute}\", ${start}, ${end})" + fun isNull(attribute: String) = Query("isNull", attribute).toJson() - fun between(attribute: String, start: String, end: String) = "between(\"${attribute}\", \"${start}\", \"${end}\")" + fun isNotNull(attribute: String) = Query("isNotNull", attribute).toJson() - fun startsWith(attribute: String, value: String) = Query.addQuery(attribute, "startsWith", value) + fun between(attribute: String, start: Any, end: Any) = Query("between", attribute, listOf(start, end)).toJson() - fun endsWith(attribute: String, value: String) = Query.addQuery(attribute, "endsWith", value) + fun startsWith(attribute: String, value: String) = Query("startsWith", attribute, listOf(value)).toJson() - fun select(attributes: List<String>) = "select([${attributes.joinToString(",") { "\"$it\"" }}])" + fun endsWith(attribute: String, value: String) = Query("endsWith", attribute, listOf(value)).toJson() - fun orderAsc(attribute: String) = "orderAsc(\"${attribute}\")" + fun select(attributes: List<String>) = Query("select", null, attributes).toJson() - fun orderDesc(attribute: String) = "orderDesc(\"${attribute}\")" + fun orderAsc(attribute: String) = Query("orderAsc", attribute).toJson() - fun cursorBefore(documentId: String) = "cursorBefore(\"${documentId}\")" + fun orderDesc(attribute: String) = Query("orderDesc", attribute).toJson() - fun cursorAfter(documentId: String) = "cursorAfter(\"${documentId}\")" + fun cursorBefore(documentId: String) = Query("cursorBefore", null, listOf(documentId)).toJson() - fun limit(limit: Int) = "limit(${limit})" + fun cursorAfter(documentId: String) = Query("cursorAfter", null, listOf(documentId)).toJson() - fun offset(offset: Int) = "offset(${offset})" + fun limit(limit: Int) = Query("limit", null, listOf(limit)).toJson() - private fun addQuery(attribute: String, method: String, value: Any): String { - return when (value) { - is List<*> -> "${method}(\"${attribute}\", [${value.map{it -> parseValues(it!!)}.joinToString(",")}])" - else -> "${method}(\"${attribute}\", [${Query.parseValues(value)}])" - } - } - private fun parseValues(value: Any): String { - return when (value) { - is String -> "\"${value}\"" - else -> "${value}" - } + fun offset(offset: Int) = Query("offset", null, listOf(offset)).toJson() + + fun contains(attribute: String, value: Any) = Query("contains", attribute, parseValue(value)).toJson() + + fun or(queries: List<String>) = Query("or", null, queries.map { it.fromJson<Query>() }).toJson() + + fun and(queries: List<String>) = Query("and", null, queries.map { it.fromJson<Query>() }).toJson() + + private fun parseValue(value: Any): List<Any> { + return when (value) { + is List<*> -> value as List<Any> + else -> listOf(value) + } + } } - } -} +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/AuthenticationFactor.kt b/src/main/kotlin/io/appwrite/enums/AuthenticationFactor.kt new file mode 100644 index 0000000..cf294ca --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/AuthenticationFactor.kt @@ -0,0 +1,16 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class AuthenticationFactor(val value: String) { + @SerializedName("email") + EMAIL("email"), + @SerializedName("phone") + PHONE("phone"), + @SerializedName("totp") + TOTP("totp"), + @SerializedName("recoverycode") + RECOVERYCODE("recoverycode"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/AuthenticatorType.kt b/src/main/kotlin/io/appwrite/enums/AuthenticatorType.kt new file mode 100644 index 0000000..a7d37ae --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/AuthenticatorType.kt @@ -0,0 +1,10 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class AuthenticatorType(val value: String) { + @SerializedName("totp") + TOTP("totp"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/Browser.kt b/src/main/kotlin/io/appwrite/enums/Browser.kt new file mode 100644 index 0000000..9800111 --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/Browser.kt @@ -0,0 +1,36 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class Browser(val value: String) { + @SerializedName("aa") + AVANT_BROWSER("aa"), + @SerializedName("an") + ANDROID_WEBVIEW_BETA("an"), + @SerializedName("ch") + GOOGLE_CHROME("ch"), + @SerializedName("ci") + GOOGLE_CHROME_IOS("ci"), + @SerializedName("cm") + GOOGLE_CHROME_MOBILE("cm"), + @SerializedName("cr") + CHROMIUM("cr"), + @SerializedName("ff") + MOZILLA_FIREFOX("ff"), + @SerializedName("sf") + SAFARI("sf"), + @SerializedName("mf") + MOBILE_SAFARI("mf"), + @SerializedName("ps") + MICROSOFT_EDGE("ps"), + @SerializedName("oi") + MICROSOFT_EDGE_IOS("oi"), + @SerializedName("om") + OPERA_MINI("om"), + @SerializedName("op") + OPERA("op"), + @SerializedName("on") + OPERA_NEXT("on"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/Compression.kt b/src/main/kotlin/io/appwrite/enums/Compression.kt new file mode 100644 index 0000000..e420a07 --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/Compression.kt @@ -0,0 +1,14 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class Compression(val value: String) { + @SerializedName("none") + NONE("none"), + @SerializedName("gzip") + GZIP("gzip"), + @SerializedName("zstd") + ZSTD("zstd"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/CreditCard.kt b/src/main/kotlin/io/appwrite/enums/CreditCard.kt new file mode 100644 index 0000000..7224778 --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/CreditCard.kt @@ -0,0 +1,40 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class CreditCard(val value: String) { + @SerializedName("amex") + AMERICAN_EXPRESS("amex"), + @SerializedName("argencard") + ARGENCARD("argencard"), + @SerializedName("cabal") + CABAL("cabal"), + @SerializedName("censosud") + CONSOSUD("censosud"), + @SerializedName("diners") + DINERS_CLUB("diners"), + @SerializedName("discover") + DISCOVER("discover"), + @SerializedName("elo") + ELO("elo"), + @SerializedName("hipercard") + HIPERCARD("hipercard"), + @SerializedName("jcb") + JCB("jcb"), + @SerializedName("mastercard") + MASTERCARD("mastercard"), + @SerializedName("naranja") + NARANJA("naranja"), + @SerializedName("targeta-shopping") + TARJETA_SHOPPING("targeta-shopping"), + @SerializedName("union-china-pay") + UNION_CHINA_PAY("union-china-pay"), + @SerializedName("visa") + VISA("visa"), + @SerializedName("mir") + MIR("mir"), + @SerializedName("maestro") + MAESTRO("maestro"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/ExecutionMethod.kt b/src/main/kotlin/io/appwrite/enums/ExecutionMethod.kt new file mode 100644 index 0000000..946fdb3 --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/ExecutionMethod.kt @@ -0,0 +1,20 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class ExecutionMethod(val value: String) { + @SerializedName("GET") + GET("GET"), + @SerializedName("POST") + POST("POST"), + @SerializedName("PUT") + PUT("PUT"), + @SerializedName("PATCH") + PATCH("PATCH"), + @SerializedName("DELETE") + DELETE("DELETE"), + @SerializedName("OPTIONS") + OPTIONS("OPTIONS"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/Flag.kt b/src/main/kotlin/io/appwrite/enums/Flag.kt new file mode 100644 index 0000000..d389103 --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/Flag.kt @@ -0,0 +1,396 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class Flag(val value: String) { + @SerializedName("af") + AFGHANISTAN("af"), + @SerializedName("ao") + ANGOLA("ao"), + @SerializedName("al") + ALBANIA("al"), + @SerializedName("ad") + ANDORRA("ad"), + @SerializedName("ae") + UNITED_ARAB_EMIRATES("ae"), + @SerializedName("ar") + ARGENTINA("ar"), + @SerializedName("am") + ARMENIA("am"), + @SerializedName("ag") + ANTIGUA_AND_BARBUDA("ag"), + @SerializedName("au") + AUSTRALIA("au"), + @SerializedName("at") + AUSTRIA("at"), + @SerializedName("az") + AZERBAIJAN("az"), + @SerializedName("bi") + BURUNDI("bi"), + @SerializedName("be") + BELGIUM("be"), + @SerializedName("bj") + BENIN("bj"), + @SerializedName("bf") + BURKINA_FASO("bf"), + @SerializedName("bd") + BANGLADESH("bd"), + @SerializedName("bg") + BULGARIA("bg"), + @SerializedName("bh") + BAHRAIN("bh"), + @SerializedName("bs") + BAHAMAS("bs"), + @SerializedName("ba") + BOSNIA_AND_HERZEGOVINA("ba"), + @SerializedName("by") + BELARUS("by"), + @SerializedName("bz") + BELIZE("bz"), + @SerializedName("bo") + BOLIVIA("bo"), + @SerializedName("br") + BRAZIL("br"), + @SerializedName("bb") + BARBADOS("bb"), + @SerializedName("bn") + BRUNEI_DARUSSALAM("bn"), + @SerializedName("bt") + BHUTAN("bt"), + @SerializedName("bw") + BOTSWANA("bw"), + @SerializedName("cf") + CENTRAL_AFRICAN_REPUBLIC("cf"), + @SerializedName("ca") + CANADA("ca"), + @SerializedName("ch") + SWITZERLAND("ch"), + @SerializedName("cl") + CHILE("cl"), + @SerializedName("cn") + CHINA("cn"), + @SerializedName("ci") + COTE_DIVOIRE("ci"), + @SerializedName("cm") + CAMEROON("cm"), + @SerializedName("cd") + DEMOCRATIC_REPUBLIC_OF_THE_CONGO("cd"), + @SerializedName("cg") + REPUBLIC_OF_THE_CONGO("cg"), + @SerializedName("co") + COLOMBIA("co"), + @SerializedName("km") + COMOROS("km"), + @SerializedName("cv") + CAPE_VERDE("cv"), + @SerializedName("cr") + COSTA_RICA("cr"), + @SerializedName("cu") + CUBA("cu"), + @SerializedName("cy") + CYPRUS("cy"), + @SerializedName("cz") + CZECH_REPUBLIC("cz"), + @SerializedName("de") + GERMANY("de"), + @SerializedName("dj") + DJIBOUTI("dj"), + @SerializedName("dm") + DOMINICA("dm"), + @SerializedName("dk") + DENMARK("dk"), + @SerializedName("do") + DOMINICAN_REPUBLIC("do"), + @SerializedName("dz") + ALGERIA("dz"), + @SerializedName("ec") + ECUADOR("ec"), + @SerializedName("eg") + EGYPT("eg"), + @SerializedName("er") + ERITREA("er"), + @SerializedName("es") + SPAIN("es"), + @SerializedName("ee") + ESTONIA("ee"), + @SerializedName("et") + ETHIOPIA("et"), + @SerializedName("fi") + FINLAND("fi"), + @SerializedName("fj") + FIJI("fj"), + @SerializedName("fr") + FRANCE("fr"), + @SerializedName("fm") + MICRONESIA_FEDERATED_STATES_OF("fm"), + @SerializedName("ga") + GABON("ga"), + @SerializedName("gb") + UNITED_KINGDOM("gb"), + @SerializedName("ge") + GEORGIA("ge"), + @SerializedName("gh") + GHANA("gh"), + @SerializedName("gn") + GUINEA("gn"), + @SerializedName("gm") + GAMBIA("gm"), + @SerializedName("gw") + GUINEA_BISSAU("gw"), + @SerializedName("gq") + EQUATORIAL_GUINEA("gq"), + @SerializedName("gr") + GREECE("gr"), + @SerializedName("gd") + GRENADA("gd"), + @SerializedName("gt") + GUATEMALA("gt"), + @SerializedName("gy") + GUYANA("gy"), + @SerializedName("hn") + HONDURAS("hn"), + @SerializedName("hr") + CROATIA("hr"), + @SerializedName("ht") + HAITI("ht"), + @SerializedName("hu") + HUNGARY("hu"), + @SerializedName("id") + INDONESIA("id"), + @SerializedName("in") + INDIA("in"), + @SerializedName("ie") + IRELAND("ie"), + @SerializedName("ir") + IRAN_ISLAMIC_REPUBLIC_OF("ir"), + @SerializedName("iq") + IRAQ("iq"), + @SerializedName("is") + ICELAND("is"), + @SerializedName("il") + ISRAEL("il"), + @SerializedName("it") + ITALY("it"), + @SerializedName("jm") + JAMAICA("jm"), + @SerializedName("jo") + JORDAN("jo"), + @SerializedName("jp") + JAPAN("jp"), + @SerializedName("kz") + KAZAKHSTAN("kz"), + @SerializedName("ke") + KENYA("ke"), + @SerializedName("kg") + KYRGYZSTAN("kg"), + @SerializedName("kh") + CAMBODIA("kh"), + @SerializedName("ki") + KIRIBATI("ki"), + @SerializedName("kn") + SAINT_KITTS_AND_NEVIS("kn"), + @SerializedName("kr") + SOUTH_KOREA("kr"), + @SerializedName("kw") + KUWAIT("kw"), + @SerializedName("la") + LAO_PEOPLES_DEMOCRATIC_REPUBLIC("la"), + @SerializedName("lb") + LEBANON("lb"), + @SerializedName("lr") + LIBERIA("lr"), + @SerializedName("ly") + LIBYA("ly"), + @SerializedName("lc") + SAINT_LUCIA("lc"), + @SerializedName("li") + LIECHTENSTEIN("li"), + @SerializedName("lk") + SRI_LANKA("lk"), + @SerializedName("ls") + LESOTHO("ls"), + @SerializedName("lt") + LITHUANIA("lt"), + @SerializedName("lu") + LUXEMBOURG("lu"), + @SerializedName("lv") + LATVIA("lv"), + @SerializedName("ma") + MOROCCO("ma"), + @SerializedName("mc") + MONACO("mc"), + @SerializedName("md") + MOLDOVA("md"), + @SerializedName("mg") + MADAGASCAR("mg"), + @SerializedName("mv") + MALDIVES("mv"), + @SerializedName("mx") + MEXICO("mx"), + @SerializedName("mh") + MARSHALL_ISLANDS("mh"), + @SerializedName("mk") + NORTH_MACEDONIA("mk"), + @SerializedName("ml") + MALI("ml"), + @SerializedName("mt") + MALTA("mt"), + @SerializedName("mm") + MYANMAR("mm"), + @SerializedName("me") + MONTENEGRO("me"), + @SerializedName("mn") + MONGOLIA("mn"), + @SerializedName("mz") + MOZAMBIQUE("mz"), + @SerializedName("mr") + MAURITANIA("mr"), + @SerializedName("mu") + MAURITIUS("mu"), + @SerializedName("mw") + MALAWI("mw"), + @SerializedName("my") + MALAYSIA("my"), + @SerializedName("na") + NAMIBIA("na"), + @SerializedName("ne") + NIGER("ne"), + @SerializedName("ng") + NIGERIA("ng"), + @SerializedName("ni") + NICARAGUA("ni"), + @SerializedName("nl") + NETHERLANDS("nl"), + @SerializedName("no") + NORWAY("no"), + @SerializedName("np") + NEPAL("np"), + @SerializedName("nr") + NAURU("nr"), + @SerializedName("nz") + NEW_ZEALAND("nz"), + @SerializedName("om") + OMAN("om"), + @SerializedName("pk") + PAKISTAN("pk"), + @SerializedName("pa") + PANAMA("pa"), + @SerializedName("pe") + PERU("pe"), + @SerializedName("ph") + PHILIPPINES("ph"), + @SerializedName("pw") + PALAU("pw"), + @SerializedName("pg") + PAPUA_NEW_GUINEA("pg"), + @SerializedName("pl") + POLAND("pl"), + @SerializedName("kp") + NORTH_KOREA("kp"), + @SerializedName("pt") + PORTUGAL("pt"), + @SerializedName("py") + PARAGUAY("py"), + @SerializedName("qa") + QATAR("qa"), + @SerializedName("ro") + ROMANIA("ro"), + @SerializedName("ru") + RUSSIA("ru"), + @SerializedName("rw") + RWANDA("rw"), + @SerializedName("sa") + SAUDI_ARABIA("sa"), + @SerializedName("sd") + SUDAN("sd"), + @SerializedName("sn") + SENEGAL("sn"), + @SerializedName("sg") + SINGAPORE("sg"), + @SerializedName("sb") + SOLOMON_ISLANDS("sb"), + @SerializedName("sl") + SIERRA_LEONE("sl"), + @SerializedName("sv") + EL_SALVADOR("sv"), + @SerializedName("sm") + SAN_MARINO("sm"), + @SerializedName("so") + SOMALIA("so"), + @SerializedName("rs") + SERBIA("rs"), + @SerializedName("ss") + SOUTH_SUDAN("ss"), + @SerializedName("st") + SAO_TOME_AND_PRINCIPE("st"), + @SerializedName("sr") + SURINAME("sr"), + @SerializedName("sk") + SLOVAKIA("sk"), + @SerializedName("si") + SLOVENIA("si"), + @SerializedName("se") + SWEDEN("se"), + @SerializedName("sz") + ESWATINI("sz"), + @SerializedName("sc") + SEYCHELLES("sc"), + @SerializedName("sy") + SYRIA("sy"), + @SerializedName("td") + CHAD("td"), + @SerializedName("tg") + TOGO("tg"), + @SerializedName("th") + THAILAND("th"), + @SerializedName("tj") + TAJIKISTAN("tj"), + @SerializedName("tm") + TURKMENISTAN("tm"), + @SerializedName("tl") + TIMOR_LESTE("tl"), + @SerializedName("to") + TONGA("to"), + @SerializedName("tt") + TRINIDAD_AND_TOBAGO("tt"), + @SerializedName("tn") + TUNISIA("tn"), + @SerializedName("tr") + TURKEY("tr"), + @SerializedName("tv") + TUVALU("tv"), + @SerializedName("tz") + TANZANIA("tz"), + @SerializedName("ug") + UGANDA("ug"), + @SerializedName("ua") + UKRAINE("ua"), + @SerializedName("uy") + URUGUAY("uy"), + @SerializedName("us") + UNITED_STATES("us"), + @SerializedName("uz") + UZBEKISTAN("uz"), + @SerializedName("va") + VATICAN_CITY("va"), + @SerializedName("vc") + SAINT_VINCENT_AND_THE_GRENADINES("vc"), + @SerializedName("ve") + VENEZUELA("ve"), + @SerializedName("vn") + VIETNAM("vn"), + @SerializedName("vu") + VANUATU("vu"), + @SerializedName("ws") + SAMOA("ws"), + @SerializedName("ye") + YEMEN("ye"), + @SerializedName("za") + SOUTH_AFRICA("za"), + @SerializedName("zm") + ZAMBIA("zm"), + @SerializedName("zw") + ZIMBABWE("zw"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/ImageFormat.kt b/src/main/kotlin/io/appwrite/enums/ImageFormat.kt new file mode 100644 index 0000000..c6a3b0f --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/ImageFormat.kt @@ -0,0 +1,18 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class ImageFormat(val value: String) { + @SerializedName("jpg") + JPG("jpg"), + @SerializedName("jpeg") + JPEG("jpeg"), + @SerializedName("gif") + GIF("gif"), + @SerializedName("png") + PNG("png"), + @SerializedName("webp") + WEBP("webp"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/ImageGravity.kt b/src/main/kotlin/io/appwrite/enums/ImageGravity.kt new file mode 100644 index 0000000..45f8d88 --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/ImageGravity.kt @@ -0,0 +1,26 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class ImageGravity(val value: String) { + @SerializedName("center") + CENTER("center"), + @SerializedName("top-left") + TOP_LEFT("top-left"), + @SerializedName("top") + TOP("top"), + @SerializedName("top-right") + TOP_RIGHT("top-right"), + @SerializedName("left") + LEFT("left"), + @SerializedName("right") + RIGHT("right"), + @SerializedName("bottom-left") + BOTTOM_LEFT("bottom-left"), + @SerializedName("bottom") + BOTTOM("bottom"), + @SerializedName("bottom-right") + BOTTOM_RIGHT("bottom-right"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/IndexType.kt b/src/main/kotlin/io/appwrite/enums/IndexType.kt new file mode 100644 index 0000000..050f076 --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/IndexType.kt @@ -0,0 +1,14 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class IndexType(val value: String) { + @SerializedName("key") + KEY("key"), + @SerializedName("fulltext") + FULLTEXT("fulltext"), + @SerializedName("unique") + UNIQUE("unique"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/MessagingProviderType.kt b/src/main/kotlin/io/appwrite/enums/MessagingProviderType.kt new file mode 100644 index 0000000..7ffc290 --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/MessagingProviderType.kt @@ -0,0 +1,14 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class MessagingProviderType(val value: String) { + @SerializedName("email") + EMAIL("email"), + @SerializedName("sms") + SMS("sms"), + @SerializedName("push") + PUSH("push"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/Name.kt b/src/main/kotlin/io/appwrite/enums/Name.kt new file mode 100644 index 0000000..2d4368b --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/Name.kt @@ -0,0 +1,34 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class Name(val value: String) { + @SerializedName("v1-database") + V1_DATABASE("v1-database"), + @SerializedName("v1-deletes") + V1_DELETES("v1-deletes"), + @SerializedName("v1-audits") + V1_AUDITS("v1-audits"), + @SerializedName("v1-mails") + V1_MAILS("v1-mails"), + @SerializedName("v1-functions") + V1_FUNCTIONS("v1-functions"), + @SerializedName("v1-usage") + V1_USAGE("v1-usage"), + @SerializedName("v1-usage-dump") + V1_USAGE_DUMP("v1-usage-dump"), + @SerializedName("webhooksv1") + WEBHOOKSV1("webhooksv1"), + @SerializedName("v1-certificates") + V1_CERTIFICATES("v1-certificates"), + @SerializedName("v1-builds") + V1_BUILDS("v1-builds"), + @SerializedName("v1-messaging") + V1_MESSAGING("v1-messaging"), + @SerializedName("v1-migrations") + V1_MIGRATIONS("v1-migrations"), + @SerializedName("hamsterv1") + HAMSTERV1("hamsterv1"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/OAuthProvider.kt b/src/main/kotlin/io/appwrite/enums/OAuthProvider.kt new file mode 100644 index 0000000..dc1b9b3 --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/OAuthProvider.kt @@ -0,0 +1,86 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class OAuthProvider(val value: String) { + @SerializedName("amazon") + AMAZON("amazon"), + @SerializedName("apple") + APPLE("apple"), + @SerializedName("auth0") + AUTH0("auth0"), + @SerializedName("authentik") + AUTHENTIK("authentik"), + @SerializedName("autodesk") + AUTODESK("autodesk"), + @SerializedName("bitbucket") + BITBUCKET("bitbucket"), + @SerializedName("bitly") + BITLY("bitly"), + @SerializedName("box") + BOX("box"), + @SerializedName("dailymotion") + DAILYMOTION("dailymotion"), + @SerializedName("discord") + DISCORD("discord"), + @SerializedName("disqus") + DISQUS("disqus"), + @SerializedName("dropbox") + DROPBOX("dropbox"), + @SerializedName("etsy") + ETSY("etsy"), + @SerializedName("facebook") + FACEBOOK("facebook"), + @SerializedName("github") + GITHUB("github"), + @SerializedName("gitlab") + GITLAB("gitlab"), + @SerializedName("google") + GOOGLE("google"), + @SerializedName("linkedin") + LINKEDIN("linkedin"), + @SerializedName("microsoft") + MICROSOFT("microsoft"), + @SerializedName("notion") + NOTION("notion"), + @SerializedName("oidc") + OIDC("oidc"), + @SerializedName("okta") + OKTA("okta"), + @SerializedName("paypal") + PAYPAL("paypal"), + @SerializedName("paypalSandbox") + PAYPALSANDBOX("paypalSandbox"), + @SerializedName("podio") + PODIO("podio"), + @SerializedName("salesforce") + SALESFORCE("salesforce"), + @SerializedName("slack") + SLACK("slack"), + @SerializedName("spotify") + SPOTIFY("spotify"), + @SerializedName("stripe") + STRIPE("stripe"), + @SerializedName("tradeshift") + TRADESHIFT("tradeshift"), + @SerializedName("tradeshiftBox") + TRADESHIFTBOX("tradeshiftBox"), + @SerializedName("twitch") + TWITCH("twitch"), + @SerializedName("wordpress") + WORDPRESS("wordpress"), + @SerializedName("yahoo") + YAHOO("yahoo"), + @SerializedName("yammer") + YAMMER("yammer"), + @SerializedName("yandex") + YANDEX("yandex"), + @SerializedName("zoho") + ZOHO("zoho"), + @SerializedName("zoom") + ZOOM("zoom"), + @SerializedName("mock") + MOCK("mock"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/PasswordHash.kt b/src/main/kotlin/io/appwrite/enums/PasswordHash.kt new file mode 100644 index 0000000..58faa19 --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/PasswordHash.kt @@ -0,0 +1,30 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class PasswordHash(val value: String) { + @SerializedName("sha1") + SHA1("sha1"), + @SerializedName("sha224") + SHA224("sha224"), + @SerializedName("sha256") + SHA256("sha256"), + @SerializedName("sha384") + SHA384("sha384"), + @SerializedName("sha512/224") + SHA512_224("sha512/224"), + @SerializedName("sha512/256") + SHA512_256("sha512/256"), + @SerializedName("sha512") + SHA512("sha512"), + @SerializedName("sha3-224") + SHA3_224("sha3-224"), + @SerializedName("sha3-256") + SHA3_256("sha3-256"), + @SerializedName("sha3-384") + SHA3_384("sha3-384"), + @SerializedName("sha3-512") + SHA3_512("sha3-512"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/RelationMutate.kt b/src/main/kotlin/io/appwrite/enums/RelationMutate.kt new file mode 100644 index 0000000..381f385 --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/RelationMutate.kt @@ -0,0 +1,14 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class RelationMutate(val value: String) { + @SerializedName("cascade") + CASCADE("cascade"), + @SerializedName("restrict") + RESTRICT("restrict"), + @SerializedName("setNull") + SETNULL("setNull"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/RelationshipType.kt b/src/main/kotlin/io/appwrite/enums/RelationshipType.kt new file mode 100644 index 0000000..1119d79 --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/RelationshipType.kt @@ -0,0 +1,16 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class RelationshipType(val value: String) { + @SerializedName("oneToOne") + ONETOONE("oneToOne"), + @SerializedName("manyToOne") + MANYTOONE("manyToOne"), + @SerializedName("manyToMany") + MANYTOMANY("manyToMany"), + @SerializedName("oneToMany") + ONETOMANY("oneToMany"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/Runtime.kt b/src/main/kotlin/io/appwrite/enums/Runtime.kt new file mode 100644 index 0000000..b47b827 --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/Runtime.kt @@ -0,0 +1,96 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class Runtime(val value: String) { + @SerializedName("node-14.5") + NODE_14_5("node-14.5"), + @SerializedName("node-16.0") + NODE_16_0("node-16.0"), + @SerializedName("node-18.0") + NODE_18_0("node-18.0"), + @SerializedName("node-19.0") + NODE_19_0("node-19.0"), + @SerializedName("node-20.0") + NODE_20_0("node-20.0"), + @SerializedName("node-21.0") + NODE_21_0("node-21.0"), + @SerializedName("php-8.0") + PHP_8_0("php-8.0"), + @SerializedName("php-8.1") + PHP_8_1("php-8.1"), + @SerializedName("php-8.2") + PHP_8_2("php-8.2"), + @SerializedName("php-8.3") + PHP_8_3("php-8.3"), + @SerializedName("ruby-3.0") + RUBY_3_0("ruby-3.0"), + @SerializedName("ruby-3.1") + RUBY_3_1("ruby-3.1"), + @SerializedName("ruby-3.2") + RUBY_3_2("ruby-3.2"), + @SerializedName("ruby-3.3") + RUBY_3_3("ruby-3.3"), + @SerializedName("python-3.8") + PYTHON_3_8("python-3.8"), + @SerializedName("python-3.9") + PYTHON_3_9("python-3.9"), + @SerializedName("python-3.10") + PYTHON_3_10("python-3.10"), + @SerializedName("python-3.11") + PYTHON_3_11("python-3.11"), + @SerializedName("python-3.12") + PYTHON_3_12("python-3.12"), + @SerializedName("deno-1.40") + DENO_1_40("deno-1.40"), + @SerializedName("dart-2.15") + DART_2_15("dart-2.15"), + @SerializedName("dart-2.16") + DART_2_16("dart-2.16"), + @SerializedName("dart-2.17") + DART_2_17("dart-2.17"), + @SerializedName("dart-2.18") + DART_2_18("dart-2.18"), + @SerializedName("dart-3.0") + DART_3_0("dart-3.0"), + @SerializedName("dart-3.1") + DART_3_1("dart-3.1"), + @SerializedName("dart-3.3") + DART_3_3("dart-3.3"), + @SerializedName("dotnet-3.1") + DOTNET_3_1("dotnet-3.1"), + @SerializedName("dotnet-6.0") + DOTNET_6_0("dotnet-6.0"), + @SerializedName("dotnet-7.0") + DOTNET_7_0("dotnet-7.0"), + @SerializedName("java-8.0") + JAVA_8_0("java-8.0"), + @SerializedName("java-11.0") + JAVA_11_0("java-11.0"), + @SerializedName("java-17.0") + JAVA_17_0("java-17.0"), + @SerializedName("java-18.0") + JAVA_18_0("java-18.0"), + @SerializedName("java-21.0") + JAVA_21_0("java-21.0"), + @SerializedName("swift-5.5") + SWIFT_5_5("swift-5.5"), + @SerializedName("swift-5.8") + SWIFT_5_8("swift-5.8"), + @SerializedName("swift-5.9") + SWIFT_5_9("swift-5.9"), + @SerializedName("kotlin-1.6") + KOTLIN_1_6("kotlin-1.6"), + @SerializedName("kotlin-1.8") + KOTLIN_1_8("kotlin-1.8"), + @SerializedName("kotlin-1.9") + KOTLIN_1_9("kotlin-1.9"), + @SerializedName("cpp-17") + CPP_17("cpp-17"), + @SerializedName("cpp-20") + CPP_20("cpp-20"), + @SerializedName("bun-1.0") + BUN_1_0("bun-1.0"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/SmtpEncryption.kt b/src/main/kotlin/io/appwrite/enums/SmtpEncryption.kt new file mode 100644 index 0000000..427edc7 --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/SmtpEncryption.kt @@ -0,0 +1,14 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class SmtpEncryption(val value: String) { + @SerializedName("none") + NONE("none"), + @SerializedName("ssl") + SSL("ssl"), + @SerializedName("tls") + TLS("tls"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/extensions/JsonExtensions.kt b/src/main/kotlin/io/appwrite/extensions/JsonExtensions.kt index 444a77d..06d9940 100644 --- a/src/main/kotlin/io/appwrite/extensions/JsonExtensions.kt +++ b/src/main/kotlin/io/appwrite/extensions/JsonExtensions.kt @@ -1,8 +1,14 @@ package io.appwrite.extensions import com.google.gson.Gson - -val gson = Gson() +import com.google.gson.GsonBuilder +import com.google.gson.ToNumberPolicy +import com.google.gson.reflect.TypeToken + +val gson: Gson = GsonBuilder() + .setNumberToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .create() fun Any.toJson(): String = gson.toJson(this) diff --git a/src/main/kotlin/io/appwrite/json/PreciseNumberAdapter.kt b/src/main/kotlin/io/appwrite/json/PreciseNumberAdapter.kt deleted file mode 100644 index 6d408ac..0000000 --- a/src/main/kotlin/io/appwrite/json/PreciseNumberAdapter.kt +++ /dev/null @@ -1,64 +0,0 @@ -package io.appwrite.json - -import com.google.gson.Gson -import com.google.gson.TypeAdapter -import com.google.gson.stream.JsonReader -import com.google.gson.stream.JsonToken.* -import com.google.gson.stream.JsonWriter -import java.io.IOException - -internal class PreciseNumberAdapter : TypeAdapter<Any?>() { - - private val delegate = Gson() - .getAdapter(Any::class.java) - - @Throws(IOException::class) - override fun write(out: JsonWriter?, value: Any?) { - delegate.write(out, value) - } - - @Throws(IOException::class) - override fun read(input: JsonReader): Any? { - return when (input.peek()) { - BEGIN_ARRAY -> { - val list = mutableListOf<Any?>() - input.beginArray() - while (input.hasNext()) { - list.add(read(input)) - } - input.endArray() - list - } - BEGIN_OBJECT -> { - val map = mutableMapOf<String, Any?>() - input.beginObject() - while (input.hasNext()) { - map[input.nextName()] = read(input) - } - input.endObject() - map - } - STRING -> { - input.nextString() - } - NUMBER -> { - val numberString = input.nextString() - if (numberString.indexOf('.') != -1) { - numberString.toDouble() - } else { - numberString.toLong() - } - } - BOOLEAN -> { - input.nextBoolean() - } - NULL -> { - input.nextNull() - null - } - else -> { - throw IllegalStateException() - } - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/HealthCertificate.kt b/src/main/kotlin/io/appwrite/models/HealthCertificate.kt new file mode 100644 index 0000000..baa9101 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/HealthCertificate.kt @@ -0,0 +1,70 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Health Certificate + */ +data class HealthCertificate( + /** + * Certificate name + */ + @SerializedName("name") + val name: String, + + /** + * Subject SN + */ + @SerializedName("subjectSN") + val subjectSN: String, + + /** + * Issuer organisation + */ + @SerializedName("issuerOrganisation") + val issuerOrganisation: String, + + /** + * Valid from + */ + @SerializedName("validFrom") + val validFrom: String, + + /** + * Valid to + */ + @SerializedName("validTo") + val validTo: String, + + /** + * Signature type SN + */ + @SerializedName("signatureTypeSN") + val signatureTypeSN: String, + +) { + fun toMap(): Map<String, Any> = mapOf( + "name" to name as Any, + "subjectSN" to subjectSN as Any, + "issuerOrganisation" to issuerOrganisation as Any, + "validFrom" to validFrom as Any, + "validTo" to validTo as Any, + "signatureTypeSN" to signatureTypeSN as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map<String, Any>, + ) = HealthCertificate( + name = map["name"] as String, + subjectSN = map["subjectSN"] as String, + issuerOrganisation = map["issuerOrganisation"] as String, + validFrom = map["validFrom"] as String, + validTo = map["validTo"] as String, + signatureTypeSN = map["signatureTypeSN"] as String, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/Jwt.kt b/src/main/kotlin/io/appwrite/models/Jwt.kt new file mode 100644 index 0000000..f55c103 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/Jwt.kt @@ -0,0 +1,30 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * JWT + */ +data class Jwt( + /** + * JWT encoded string. + */ + @SerializedName("jwt") + val jwt: String, + +) { + fun toMap(): Map<String, Any> = mapOf( + "jwt" to jwt as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map<String, Any>, + ) = Jwt( + jwt = map["jwt"] as String, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/Membership.kt b/src/main/kotlin/io/appwrite/models/Membership.kt index 96a364f..17ab303 100644 --- a/src/main/kotlin/io/appwrite/models/Membership.kt +++ b/src/main/kotlin/io/appwrite/models/Membership.kt @@ -73,6 +73,12 @@ data class Membership( @SerializedName("confirm") val confirm: Boolean, + /** + * Multi factor authentication status, true if the user has MFA enabled or false otherwise. + */ + @SerializedName("mfa") + val mfa: Boolean, + /** * User list of roles */ @@ -92,6 +98,7 @@ data class Membership( "invited" to invited as Any, "joined" to joined as Any, "confirm" to confirm as Any, + "mfa" to mfa as Any, "roles" to roles as Any, ) @@ -112,6 +119,7 @@ data class Membership( invited = map["invited"] as String, joined = map["joined"] as String, confirm = map["confirm"] as Boolean, + mfa = map["mfa"] as Boolean, roles = map["roles"] as List<Any>, ) } diff --git a/src/main/kotlin/io/appwrite/models/Message.kt b/src/main/kotlin/io/appwrite/models/Message.kt new file mode 100644 index 0000000..4550dd5 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/Message.kt @@ -0,0 +1,126 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Message + */ +data class Message( + /** + * Message ID. + */ + @SerializedName("\$id") + val id: String, + + /** + * Message creation time in ISO 8601 format. + */ + @SerializedName("\$createdAt") + val createdAt: String, + + /** + * Message update date in ISO 8601 format. + */ + @SerializedName("\$updatedAt") + val updatedAt: String, + + /** + * Message provider type. + */ + @SerializedName("providerType") + val providerType: String, + + /** + * Topic IDs set as recipients. + */ + @SerializedName("topics") + val topics: List<Any>, + + /** + * User IDs set as recipients. + */ + @SerializedName("users") + val users: List<Any>, + + /** + * Target IDs set as recipients. + */ + @SerializedName("targets") + val targets: List<Any>, + + /** + * The scheduled time for message. + */ + @SerializedName("scheduledAt") + var scheduledAt: String?, + + /** + * The time when the message was delivered. + */ + @SerializedName("deliveredAt") + var deliveredAt: String?, + + /** + * Delivery errors if any. + */ + @SerializedName("deliveryErrors") + var deliveryErrors: List<Any>?, + + /** + * Number of recipients the message was delivered to. + */ + @SerializedName("deliveredTotal") + val deliveredTotal: Long, + + /** + * Data of the message. + */ + @SerializedName("data") + val data: Any, + + /** + * Status of delivery. + */ + @SerializedName("status") + val status: String, + +) { + fun toMap(): Map<String, Any> = mapOf( + "\$id" to id as Any, + "\$createdAt" to createdAt as Any, + "\$updatedAt" to updatedAt as Any, + "providerType" to providerType as Any, + "topics" to topics as Any, + "users" to users as Any, + "targets" to targets as Any, + "scheduledAt" to scheduledAt as Any, + "deliveredAt" to deliveredAt as Any, + "deliveryErrors" to deliveryErrors as Any, + "deliveredTotal" to deliveredTotal as Any, + "data" to data as Any, + "status" to status as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map<String, Any>, + ) = Message( + id = map["\$id"] as String, + createdAt = map["\$createdAt"] as String, + updatedAt = map["\$updatedAt"] as String, + providerType = map["providerType"] as String, + topics = map["topics"] as List<Any>, + users = map["users"] as List<Any>, + targets = map["targets"] as List<Any>, + scheduledAt = map["scheduledAt"] as? String?, + deliveredAt = map["deliveredAt"] as? String?, + deliveryErrors = map["deliveryErrors"] as? List<Any>?, + deliveredTotal = (map["deliveredTotal"] as Number).toLong(), + data = map["data"] as Any, + status = map["status"] as String, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/MessageList.kt b/src/main/kotlin/io/appwrite/models/MessageList.kt new file mode 100644 index 0000000..85e4a1b --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/MessageList.kt @@ -0,0 +1,38 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Message list + */ +data class MessageList( + /** + * Total number of messages documents that matched your query. + */ + @SerializedName("total") + val total: Long, + + /** + * List of messages. + */ + @SerializedName("messages") + val messages: List<Message>, + +) { + fun toMap(): Map<String, Any> = mapOf( + "total" to total as Any, + "messages" to messages.map { it.toMap() } as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map<String, Any>, + ) = MessageList( + total = (map["total"] as Number).toLong(), + messages = (map["messages"] as List<Map<String, Any>>).map { Message.from(map = it) }, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/MfaChallenge.kt b/src/main/kotlin/io/appwrite/models/MfaChallenge.kt new file mode 100644 index 0000000..82b1d18 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/MfaChallenge.kt @@ -0,0 +1,54 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * MFA Challenge + */ +data class MfaChallenge( + /** + * Token ID. + */ + @SerializedName("\$id") + val id: String, + + /** + * Token creation date in ISO 8601 format. + */ + @SerializedName("\$createdAt") + val createdAt: String, + + /** + * User ID. + */ + @SerializedName("userId") + val userId: String, + + /** + * Token expiration date in ISO 8601 format. + */ + @SerializedName("expire") + val expire: String, + +) { + fun toMap(): Map<String, Any> = mapOf( + "\$id" to id as Any, + "\$createdAt" to createdAt as Any, + "userId" to userId as Any, + "expire" to expire as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map<String, Any>, + ) = MfaChallenge( + id = map["\$id"] as String, + createdAt = map["\$createdAt"] as String, + userId = map["userId"] as String, + expire = map["expire"] as String, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/MfaFactors.kt b/src/main/kotlin/io/appwrite/models/MfaFactors.kt new file mode 100644 index 0000000..904a10b --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/MfaFactors.kt @@ -0,0 +1,46 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * MFAFactors + */ +data class MfaFactors( + /** + * TOTP + */ + @SerializedName("totp") + val totp: Boolean, + + /** + * Phone + */ + @SerializedName("phone") + val phone: Boolean, + + /** + * Email + */ + @SerializedName("email") + val email: Boolean, + +) { + fun toMap(): Map<String, Any> = mapOf( + "totp" to totp as Any, + "phone" to phone as Any, + "email" to email as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map<String, Any>, + ) = MfaFactors( + totp = map["totp"] as Boolean, + phone = map["phone"] as Boolean, + email = map["email"] as Boolean, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/MfaRecoveryCodes.kt b/src/main/kotlin/io/appwrite/models/MfaRecoveryCodes.kt new file mode 100644 index 0000000..ad8bc45 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/MfaRecoveryCodes.kt @@ -0,0 +1,30 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * MFA Recovery Codes + */ +data class MfaRecoveryCodes( + /** + * Recovery codes. + */ + @SerializedName("recoveryCodes") + val recoveryCodes: List<Any>, + +) { + fun toMap(): Map<String, Any> = mapOf( + "recoveryCodes" to recoveryCodes as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map<String, Any>, + ) = MfaRecoveryCodes( + recoveryCodes = map["recoveryCodes"] as List<Any>, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/MfaType.kt b/src/main/kotlin/io/appwrite/models/MfaType.kt new file mode 100644 index 0000000..9c784a9 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/MfaType.kt @@ -0,0 +1,38 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * MFAType + */ +data class MfaType( + /** + * Secret token used for TOTP factor. + */ + @SerializedName("secret") + val secret: String, + + /** + * URI for authenticator apps. + */ + @SerializedName("uri") + val uri: String, + +) { + fun toMap(): Map<String, Any> = mapOf( + "secret" to secret as Any, + "uri" to uri as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map<String, Any>, + ) = MfaType( + secret = map["secret"] as String, + uri = map["uri"] as String, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/Provider.kt b/src/main/kotlin/io/appwrite/models/Provider.kt new file mode 100644 index 0000000..32837d0 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/Provider.kt @@ -0,0 +1,94 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Provider + */ +data class Provider( + /** + * Provider ID. + */ + @SerializedName("\$id") + val id: String, + + /** + * Provider creation time in ISO 8601 format. + */ + @SerializedName("\$createdAt") + val createdAt: String, + + /** + * Provider update date in ISO 8601 format. + */ + @SerializedName("\$updatedAt") + val updatedAt: String, + + /** + * The name for the provider instance. + */ + @SerializedName("name") + val name: String, + + /** + * The name of the provider service. + */ + @SerializedName("provider") + val provider: String, + + /** + * Is provider enabled? + */ + @SerializedName("enabled") + val enabled: Boolean, + + /** + * Type of provider. + */ + @SerializedName("type") + val type: String, + + /** + * Provider credentials. + */ + @SerializedName("credentials") + val credentials: Any, + + /** + * Provider options. + */ + @SerializedName("options") + var options: Any?, + +) { + fun toMap(): Map<String, Any> = mapOf( + "\$id" to id as Any, + "\$createdAt" to createdAt as Any, + "\$updatedAt" to updatedAt as Any, + "name" to name as Any, + "provider" to provider as Any, + "enabled" to enabled as Any, + "type" to type as Any, + "credentials" to credentials as Any, + "options" to options as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map<String, Any>, + ) = Provider( + id = map["\$id"] as String, + createdAt = map["\$createdAt"] as String, + updatedAt = map["\$updatedAt"] as String, + name = map["name"] as String, + provider = map["provider"] as String, + enabled = map["enabled"] as Boolean, + type = map["type"] as String, + credentials = map["credentials"] as Any, + options = map["options"] as? Any?, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ProviderList.kt b/src/main/kotlin/io/appwrite/models/ProviderList.kt new file mode 100644 index 0000000..113ba67 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/ProviderList.kt @@ -0,0 +1,38 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Provider list + */ +data class ProviderList( + /** + * Total number of providers documents that matched your query. + */ + @SerializedName("total") + val total: Long, + + /** + * List of providers. + */ + @SerializedName("providers") + val providers: List<Provider>, + +) { + fun toMap(): Map<String, Any> = mapOf( + "total" to total as Any, + "providers" to providers.map { it.toMap() } as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map<String, Any>, + ) = ProviderList( + total = (map["total"] as Number).toLong(), + providers = (map["providers"] as List<Map<String, Any>>).map { Provider.from(map = it) }, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/Session.kt b/src/main/kotlin/io/appwrite/models/Session.kt index 7674d72..1eaed4d 100644 --- a/src/main/kotlin/io/appwrite/models/Session.kt +++ b/src/main/kotlin/io/appwrite/models/Session.kt @@ -157,6 +157,24 @@ data class Session( @SerializedName("current") val current: Boolean, + /** + * Returns a list of active session factors. + */ + @SerializedName("factors") + val factors: List<Any>, + + /** + * Secret used to authenticate the user. Only included if the request was made with an API key + */ + @SerializedName("secret") + val secret: String, + + /** + * Most recent date in ISO 8601 format when the session successfully passed MFA challenge. + */ + @SerializedName("mfaUpdatedAt") + val mfaUpdatedAt: String, + ) { fun toMap(): Map<String, Any> = mapOf( "\$id" to id as Any, @@ -184,6 +202,9 @@ data class Session( "countryCode" to countryCode as Any, "countryName" to countryName as Any, "current" to current as Any, + "factors" to factors as Any, + "secret" to secret as Any, + "mfaUpdatedAt" to mfaUpdatedAt as Any, ) companion object { @@ -217,6 +238,9 @@ data class Session( countryCode = map["countryCode"] as String, countryName = map["countryName"] as String, current = map["current"] as Boolean, + factors = map["factors"] as List<Any>, + secret = map["secret"] as String, + mfaUpdatedAt = map["mfaUpdatedAt"] as String, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/Subscriber.kt b/src/main/kotlin/io/appwrite/models/Subscriber.kt new file mode 100644 index 0000000..1920691 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/Subscriber.kt @@ -0,0 +1,94 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Subscriber + */ +data class Subscriber( + /** + * Subscriber ID. + */ + @SerializedName("\$id") + val id: String, + + /** + * Subscriber creation time in ISO 8601 format. + */ + @SerializedName("\$createdAt") + val createdAt: String, + + /** + * Subscriber update date in ISO 8601 format. + */ + @SerializedName("\$updatedAt") + val updatedAt: String, + + /** + * Target ID. + */ + @SerializedName("targetId") + val targetId: String, + + /** + * Target. + */ + @SerializedName("target") + val target: Target, + + /** + * Topic ID. + */ + @SerializedName("userId") + val userId: String, + + /** + * User Name. + */ + @SerializedName("userName") + val userName: String, + + /** + * Topic ID. + */ + @SerializedName("topicId") + val topicId: String, + + /** + * The target provider type. Can be one of the following: `email`, `sms` or `push`. + */ + @SerializedName("providerType") + val providerType: String, + +) { + fun toMap(): Map<String, Any> = mapOf( + "\$id" to id as Any, + "\$createdAt" to createdAt as Any, + "\$updatedAt" to updatedAt as Any, + "targetId" to targetId as Any, + "target" to target.toMap() as Any, + "userId" to userId as Any, + "userName" to userName as Any, + "topicId" to topicId as Any, + "providerType" to providerType as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map<String, Any>, + ) = Subscriber( + id = map["\$id"] as String, + createdAt = map["\$createdAt"] as String, + updatedAt = map["\$updatedAt"] as String, + targetId = map["targetId"] as String, + target = Target.from(map = map["target"] as Map<String, Any>), + userId = map["userId"] as String, + userName = map["userName"] as String, + topicId = map["topicId"] as String, + providerType = map["providerType"] as String, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/SubscriberList.kt b/src/main/kotlin/io/appwrite/models/SubscriberList.kt new file mode 100644 index 0000000..87181a3 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/SubscriberList.kt @@ -0,0 +1,38 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Subscriber list + */ +data class SubscriberList( + /** + * Total number of subscribers documents that matched your query. + */ + @SerializedName("total") + val total: Long, + + /** + * List of subscribers. + */ + @SerializedName("subscribers") + val subscribers: List<Subscriber>, + +) { + fun toMap(): Map<String, Any> = mapOf( + "total" to total as Any, + "subscribers" to subscribers.map { it.toMap() } as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map<String, Any>, + ) = SubscriberList( + total = (map["total"] as Number).toLong(), + subscribers = (map["subscribers"] as List<Map<String, Any>>).map { Subscriber.from(map = it) }, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/Target.kt b/src/main/kotlin/io/appwrite/models/Target.kt new file mode 100644 index 0000000..bd4d207 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/Target.kt @@ -0,0 +1,86 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Target + */ +data class Target( + /** + * Target ID. + */ + @SerializedName("\$id") + val id: String, + + /** + * Target creation time in ISO 8601 format. + */ + @SerializedName("\$createdAt") + val createdAt: String, + + /** + * Target update date in ISO 8601 format. + */ + @SerializedName("\$updatedAt") + val updatedAt: String, + + /** + * Target Name. + */ + @SerializedName("name") + val name: String, + + /** + * User ID. + */ + @SerializedName("userId") + val userId: String, + + /** + * Provider ID. + */ + @SerializedName("providerId") + var providerId: String?, + + /** + * The target provider type. Can be one of the following: `email`, `sms` or `push`. + */ + @SerializedName("providerType") + val providerType: String, + + /** + * The target identifier. + */ + @SerializedName("identifier") + val identifier: String, + +) { + fun toMap(): Map<String, Any> = mapOf( + "\$id" to id as Any, + "\$createdAt" to createdAt as Any, + "\$updatedAt" to updatedAt as Any, + "name" to name as Any, + "userId" to userId as Any, + "providerId" to providerId as Any, + "providerType" to providerType as Any, + "identifier" to identifier as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map<String, Any>, + ) = Target( + id = map["\$id"] as String, + createdAt = map["\$createdAt"] as String, + updatedAt = map["\$updatedAt"] as String, + name = map["name"] as String, + userId = map["userId"] as String, + providerId = map["providerId"] as? String?, + providerType = map["providerType"] as String, + identifier = map["identifier"] as String, + ) + } +} \ 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 new file mode 100644 index 0000000..01470c8 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/TargetList.kt @@ -0,0 +1,38 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Target list + */ +data class TargetList( + /** + * Total number of targets documents that matched your query. + */ + @SerializedName("total") + val total: Long, + + /** + * List of targets. + */ + @SerializedName("targets") + val targets: List<Target>, + +) { + fun toMap(): Map<String, Any> = mapOf( + "total" to total as Any, + "targets" to targets.map { it.toMap() } as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map<String, Any>, + ) = TargetList( + total = (map["total"] as Number).toLong(), + targets = (map["targets"] as List<Map<String, Any>>).map { Target.from(map = it) }, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/Token.kt b/src/main/kotlin/io/appwrite/models/Token.kt index 8c0f0e0..e36d060 100644 --- a/src/main/kotlin/io/appwrite/models/Token.kt +++ b/src/main/kotlin/io/appwrite/models/Token.kt @@ -37,6 +37,12 @@ data class Token( @SerializedName("expire") val expire: String, + /** + * Security phrase of a token. Empty if security phrase was not requested when creating a token. It includes randomly generated phrase which is also sent in the external resource such as email. + */ + @SerializedName("phrase") + val phrase: String, + ) { fun toMap(): Map<String, Any> = mapOf( "\$id" to id as Any, @@ -44,6 +50,7 @@ data class Token( "userId" to userId as Any, "secret" to secret as Any, "expire" to expire as Any, + "phrase" to phrase as Any, ) companion object { @@ -57,6 +64,7 @@ data class Token( userId = map["userId"] as String, secret = map["secret"] as String, expire = map["expire"] as String, + phrase = map["phrase"] as String, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/Topic.kt b/src/main/kotlin/io/appwrite/models/Topic.kt new file mode 100644 index 0000000..82f59f1 --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/Topic.kt @@ -0,0 +1,86 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Topic + */ +data class Topic( + /** + * Topic ID. + */ + @SerializedName("\$id") + val id: String, + + /** + * Topic creation time in ISO 8601 format. + */ + @SerializedName("\$createdAt") + val createdAt: String, + + /** + * Topic update date in ISO 8601 format. + */ + @SerializedName("\$updatedAt") + val updatedAt: String, + + /** + * The name of the topic. + */ + @SerializedName("name") + val name: String, + + /** + * Total count of email subscribers subscribed to the topic. + */ + @SerializedName("emailTotal") + val emailTotal: Long, + + /** + * Total count of SMS subscribers subscribed to the topic. + */ + @SerializedName("smsTotal") + val smsTotal: Long, + + /** + * Total count of push subscribers subscribed to the topic. + */ + @SerializedName("pushTotal") + val pushTotal: Long, + + /** + * Subscribe permissions. + */ + @SerializedName("subscribe") + val subscribe: List<Any>, + +) { + fun toMap(): Map<String, Any> = mapOf( + "\$id" to id as Any, + "\$createdAt" to createdAt as Any, + "\$updatedAt" to updatedAt as Any, + "name" to name as Any, + "emailTotal" to emailTotal as Any, + "smsTotal" to smsTotal as Any, + "pushTotal" to pushTotal as Any, + "subscribe" to subscribe as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map<String, Any>, + ) = Topic( + id = map["\$id"] as String, + createdAt = map["\$createdAt"] as String, + updatedAt = map["\$updatedAt"] as String, + name = map["name"] as String, + emailTotal = (map["emailTotal"] as Number).toLong(), + smsTotal = (map["smsTotal"] as Number).toLong(), + pushTotal = (map["pushTotal"] as Number).toLong(), + subscribe = map["subscribe"] as List<Any>, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/TopicList.kt b/src/main/kotlin/io/appwrite/models/TopicList.kt new file mode 100644 index 0000000..7173fec --- /dev/null +++ b/src/main/kotlin/io/appwrite/models/TopicList.kt @@ -0,0 +1,38 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Topic list + */ +data class TopicList( + /** + * Total number of topics documents that matched your query. + */ + @SerializedName("total") + val total: Long, + + /** + * List of topics. + */ + @SerializedName("topics") + val topics: List<Topic>, + +) { + fun toMap(): Map<String, Any> = mapOf( + "total" to total as Any, + "topics" to topics.map { it.toMap() } as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map<String, Any>, + ) = TopicList( + total = (map["total"] as Number).toLong(), + topics = (map["topics"] as List<Map<String, Any>>).map { Topic.from(map = it) }, + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/User.kt b/src/main/kotlin/io/appwrite/models/User.kt index 9bf7eb4..095467a 100644 --- a/src/main/kotlin/io/appwrite/models/User.kt +++ b/src/main/kotlin/io/appwrite/models/User.kt @@ -97,12 +97,24 @@ data class User<T>( @SerializedName("phoneVerification") val phoneVerification: Boolean, + /** + * Multi factor authentication status. + */ + @SerializedName("mfa") + val mfa: Boolean, + /** * User preferences as a key-value object */ @SerializedName("prefs") val prefs: Preferences<T>, + /** + * A user-owned message receiver. A single user may have multiple e.g. emails, phones, and a browser. Each target is registered with a single provider. + */ + @SerializedName("targets") + val targets: List<Target>, + /** * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. */ @@ -126,7 +138,9 @@ data class User<T>( "phone" to phone as Any, "emailVerification" to emailVerification as Any, "phoneVerification" to phoneVerification as Any, + "mfa" to mfa as Any, "prefs" to prefs.toMap() as Any, + "targets" to targets.map { it.toMap() } as Any, "accessedAt" to accessedAt as Any, ) @@ -147,7 +161,9 @@ data class User<T>( phone: String, emailVerification: Boolean, phoneVerification: Boolean, + mfa: Boolean, prefs: Preferences<Map<String, Any>>, + targets: List<Target>, accessedAt: String, ) = User<Map<String, Any>>( id, @@ -165,7 +181,9 @@ data class User<T>( phone, emailVerification, phoneVerification, + mfa, prefs, + targets, accessedAt, ) @@ -189,7 +207,9 @@ data class User<T>( phone = map["phone"] as String, emailVerification = map["emailVerification"] as Boolean, phoneVerification = map["phoneVerification"] as Boolean, + mfa = map["mfa"] as Boolean, prefs = Preferences.from(map = map["prefs"] as Map<String, Any>, nestedType), + targets = (map["targets"] as List<Map<String, Any>>).map { Target.from(map = it) }, accessedAt = map["accessedAt"] as String, ) } diff --git a/src/main/kotlin/io/appwrite/services/Account.kt b/src/main/kotlin/io/appwrite/services/Account.kt index b60437f..6532ae4 100644 --- a/src/main/kotlin/io/appwrite/services/Account.kt +++ b/src/main/kotlin/io/appwrite/services/Account.kt @@ -2,6 +2,7 @@ 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 @@ -10,9 +11,7 @@ import java.io.File /** * The Account service allows you to authenticate and manage a user account. **/ -class Account : Service { - - public constructor (client: Client) : super(client) { } +class Account(client: Client) : Service(client) { /** * Get account @@ -58,6 +57,76 @@ class Account : Service { nestedType = classOf(), ) + /** + * Create account + * + * Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession). + * + * @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 email User email. + * @param password New user password. Must be between 8 and 256 chars. + * @param name User name. Max length: 128 chars. + * @return [io.appwrite.models.User<T>] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun <T> create( + userId: String, + email: String, + password: String, + name: String? = null, + nestedType: Class<T>, + ): io.appwrite.models.User<T> { + val apiPath = "/account" + + val apiParams = mutableMapOf<String, Any?>( + "userId" to userId, + "email" to email, + "password" to password, + "name" to name, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.User<T> = { + io.appwrite.models.User.from(map = it as Map<String, Any>, nestedType) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Create account + * + * Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession). + * + * @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 email User email. + * @param password New user password. Must be between 8 and 256 chars. + * @param name User name. Max length: 128 chars. + * @return [io.appwrite.models.User<T>] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun create( + userId: String, + email: String, + password: String, + name: String? = null, + ): io.appwrite.models.User<Map<String, Any>> = create( + userId, + email, + password, + name, + nestedType = classOf(), + ) + /** * Update email * @@ -125,7 +194,7 @@ class Account : Service { @JvmOverloads @Throws(AppwriteException::class) suspend fun listIdentities( - queries: String? = null, + queries: List<String>? = null, ): io.appwrite.models.IdentityList { val apiPath = "/account/identities" @@ -149,7 +218,7 @@ class Account : Service { } /** - * Delete Identity + * Delete identity * * Delete an identity by its unique ID. * @@ -177,6 +246,36 @@ class Account : Service { ) } + /** + * Create JWT + * + * Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame. + * + * @return [io.appwrite.models.Jwt] + */ + @Throws(AppwriteException::class) + suspend fun createJWT( + ): io.appwrite.models.Jwt { + val apiPath = "/account/jwt" + + val apiParams = mutableMapOf<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Jwt = { + io.appwrite.models.Jwt.from(map = it as Map<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Jwt::class.java, + converter, + ) + } + /** * List logs * @@ -212,22 +311,22 @@ class Account : Service { } /** - * Update name + * Update MFA * - * Update currently logged in user account name. + * Enable or disable MFA on an account. * - * @param name User name. Max length: 128 chars. + * @param mfa Enable or disable MFA. * @return [io.appwrite.models.User<T>] */ @Throws(AppwriteException::class) - suspend fun <T> updateName( - name: String, + suspend fun <T> updateMFA( + mfa: Boolean, nestedType: Class<T>, ): io.appwrite.models.User<T> { - val apiPath = "/account/name" + val apiPath = "/account/mfa" val apiParams = mutableMapOf<String, Any?>( - "name" to name, + "mfa" to mfa, ) val apiHeaders = mutableMapOf( "content-type" to "application/json", @@ -246,99 +345,74 @@ class Account : Service { } /** - * Update name + * Update MFA * - * Update currently logged in user account name. + * Enable or disable MFA on an account. * - * @param name User name. Max length: 128 chars. + * @param mfa Enable or disable MFA. * @return [io.appwrite.models.User<T>] */ @Throws(AppwriteException::class) - suspend fun updateName( - name: String, - ): io.appwrite.models.User<Map<String, Any>> = updateName( - name, + suspend fun updateMFA( + mfa: Boolean, + ): io.appwrite.models.User<Map<String, Any>> = updateMFA( + mfa, nestedType = classOf(), ) /** - * Update password + * Add Authenticator * - * Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional. + * Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator) method. * - * @param password New user password. Must be at least 8 chars. - * @param oldPassword Current user password. Must be at least 8 chars. - * @return [io.appwrite.models.User<T>] + * @param type Type of authenticator. Must be `totp` + * @return [io.appwrite.models.MfaType] */ - @JvmOverloads @Throws(AppwriteException::class) - suspend fun <T> updatePassword( - password: String, - oldPassword: String? = null, - nestedType: Class<T>, - ): io.appwrite.models.User<T> { - val apiPath = "/account/password" + 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<String, Any?>( - "password" to password, - "oldPassword" to oldPassword, ) val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - val converter: (Any) -> io.appwrite.models.User<T> = { - io.appwrite.models.User.from(map = it as Map<String, Any>, nestedType) + val converter: (Any) -> io.appwrite.models.MfaType = { + io.appwrite.models.MfaType.from(map = it as Map<String, Any>) } return client.call( - "PATCH", + "POST", apiPath, apiHeaders, apiParams, - responseType = classOf(), + responseType = io.appwrite.models.MfaType::class.java, converter, ) } /** - * Update password - * - * Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional. - * - * @param password New user password. Must be at least 8 chars. - * @param oldPassword Current user password. Must be at least 8 chars. - * @return [io.appwrite.models.User<T>] - */ - @JvmOverloads - @Throws(AppwriteException::class) - suspend fun updatePassword( - password: String, - oldPassword: String? = null, - ): io.appwrite.models.User<Map<String, Any>> = updatePassword( - password, - oldPassword, - nestedType = classOf(), - ) - - /** - * Update phone + * Verify Authenticator * - * 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. + * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#addAuthenticator) method. * - * @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. + * @param type Type of authenticator. + * @param otp Valid verification token. * @return [io.appwrite.models.User<T>] */ @Throws(AppwriteException::class) - suspend fun <T> updatePhone( - phone: String, - password: String, + suspend fun <T> updateMfaAuthenticator( + type: io.appwrite.enums.AuthenticatorType, + otp: String, nestedType: Class<T>, ): io.appwrite.models.User<T> { - val apiPath = "/account/phone" + val apiPath = "/account/mfa/authenticators/{type}" + .replace("{type}", type.value) val apiParams = mutableMapOf<String, Any?>( - "phone" to phone, - "password" to password, + "otp" to otp, ) val apiHeaders = mutableMapOf( "content-type" to "application/json", @@ -347,7 +421,7 @@ class Account : Service { io.appwrite.models.User.from(map = it as Map<String, Any>, nestedType) } return client.call( - "PATCH", + "PUT", apiPath, apiHeaders, apiParams, @@ -357,47 +431,53 @@ class Account : Service { } /** - * Update phone + * Verify Authenticator * - * 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. + * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#addAuthenticator) method. * - * @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. + * @param type Type of authenticator. + * @param otp Valid verification token. * @return [io.appwrite.models.User<T>] */ @Throws(AppwriteException::class) - suspend fun updatePhone( - phone: String, - password: String, - ): io.appwrite.models.User<Map<String, Any>> = updatePhone( - phone, - password, + suspend fun updateMfaAuthenticator( + type: io.appwrite.enums.AuthenticatorType, + otp: String, + ): io.appwrite.models.User<Map<String, Any>> = updateMfaAuthenticator( + type, + otp, nestedType = classOf(), ) /** - * Get account preferences + * Delete Authenticator * - * Get the preferences as a key-value object for the currently logged in user. + * Delete an authenticator for a user by ID. * - * @return [io.appwrite.models.Preferences<T>] + * @param type Type of authenticator. + * @param otp Valid verification token. + * @return [io.appwrite.models.User<T>] */ @Throws(AppwriteException::class) - suspend fun <T> getPrefs( + suspend fun <T> deleteMfaAuthenticator( + type: io.appwrite.enums.AuthenticatorType, + otp: String, nestedType: Class<T>, - ): io.appwrite.models.Preferences<T> { - val apiPath = "/account/prefs" + ): io.appwrite.models.User<T> { + val apiPath = "/account/mfa/authenticators/{type}" + .replace("{type}", type.value) val apiParams = mutableMapOf<String, Any?>( + "otp" to otp, ) val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - val converter: (Any) -> io.appwrite.models.Preferences<T> = { - io.appwrite.models.Preferences.from(map = it as Map<String, Any>, nestedType) + val converter: (Any) -> io.appwrite.models.User<T> = { + io.appwrite.models.User.from(map = it as Map<String, Any>, nestedType) } return client.call( - "GET", + "DELETE", apiPath, apiHeaders, apiParams, @@ -407,172 +487,568 @@ class Account : Service { } /** - * Get account preferences + * Delete Authenticator * - * Get the preferences as a key-value object for the currently logged in user. + * Delete an authenticator for a user by ID. * - * @return [io.appwrite.models.Preferences<T>] + * @param type Type of authenticator. + * @param otp Valid verification token. + * @return [io.appwrite.models.User<T>] */ @Throws(AppwriteException::class) - suspend fun getPrefs( - ): io.appwrite.models.Preferences<Map<String, Any>> = getPrefs( + suspend fun deleteMfaAuthenticator( + type: io.appwrite.enums.AuthenticatorType, + otp: String, + ): io.appwrite.models.User<Map<String, Any>> = deleteMfaAuthenticator( + type, + otp, nestedType = classOf(), ) /** - * Update preferences + * Create 2FA Challenge * - * Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. + * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. * - * @param prefs Prefs key-value JSON object. - * @return [io.appwrite.models.User<T>] + * @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 <T> updatePrefs( - prefs: Any, - nestedType: Class<T>, - ): io.appwrite.models.User<T> { - val apiPath = "/account/prefs" + suspend fun createMfaChallenge( + factor: io.appwrite.enums.AuthenticationFactor, + ): io.appwrite.models.MfaChallenge { + val apiPath = "/account/mfa/challenge" val apiParams = mutableMapOf<String, Any?>( - "prefs" to prefs, + "factor" to factor, ) val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - val converter: (Any) -> io.appwrite.models.User<T> = { - io.appwrite.models.User.from(map = it as Map<String, Any>, nestedType) + val converter: (Any) -> io.appwrite.models.MfaChallenge = { + io.appwrite.models.MfaChallenge.from(map = it as Map<String, Any>) } return client.call( - "PATCH", + "POST", apiPath, apiHeaders, apiParams, - responseType = classOf(), + responseType = io.appwrite.models.MfaChallenge::class.java, converter, ) } /** - * Update preferences - * - * Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. - * - * @param prefs Prefs key-value JSON object. - * @return [io.appwrite.models.User<T>] - */ - @Throws(AppwriteException::class) - suspend fun updatePrefs( - prefs: Any, - ): io.appwrite.models.User<Map<String, Any>> = updatePrefs( - prefs, - nestedType = classOf(), - ) - - /** - * Create password recovery + * Create MFA Challenge (confirmation) * - * 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. + * 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 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. - * @return [io.appwrite.models.Token] + * @param challengeId ID of the challenge. + * @param otp Valid verification token. + * @return [Any] */ @Throws(AppwriteException::class) - suspend fun createRecovery( - email: String, - url: String, - ): io.appwrite.models.Token { - val apiPath = "/account/recovery" + suspend fun updateMfaChallenge( + challengeId: String, + otp: String, + ): Any { + val apiPath = "/account/mfa/challenge" val apiParams = mutableMapOf<String, Any?>( - "email" to email, - "url" to url, + "challengeId" to challengeId, + "otp" to otp, ) val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - val converter: (Any) -> io.appwrite.models.Token = { - io.appwrite.models.Token.from(map = it as Map<String, Any>) - } return client.call( - "POST", + "PUT", apiPath, apiHeaders, apiParams, - responseType = io.appwrite.models.Token::class.java, - converter, + responseType = Any::class.java, ) } /** - * Create password recovery (confirmation) + * List Factors * - * 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. + * List the factors available on the account to be used as a MFA challange. * - * @param userId User ID. - * @param secret Valid reset token. - * @param password New user password. Must be at least 8 chars. - * @param passwordAgain Repeat new user password. Must be at least 8 chars. - * @return [io.appwrite.models.Token] + * @return [io.appwrite.models.MfaFactors] */ @Throws(AppwriteException::class) - suspend fun updateRecovery( - userId: String, - secret: String, - password: String, - passwordAgain: String, - ): io.appwrite.models.Token { - val apiPath = "/account/recovery" + suspend fun listMfaFactors( + ): io.appwrite.models.MfaFactors { + val apiPath = "/account/mfa/factors" val apiParams = mutableMapOf<String, Any?>( - "userId" to userId, - "secret" to secret, - "password" to password, - "passwordAgain" to passwordAgain, ) val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - val converter: (Any) -> io.appwrite.models.Token = { - io.appwrite.models.Token.from(map = it as Map<String, Any>) + val converter: (Any) -> io.appwrite.models.MfaFactors = { + io.appwrite.models.MfaFactors.from(map = it as Map<String, Any>) } return client.call( - "PUT", + "GET", apiPath, apiHeaders, apiParams, - responseType = io.appwrite.models.Token::class.java, + responseType = io.appwrite.models.MfaFactors::class.java, converter, ) } /** - * List sessions + * Get MFA Recovery Codes * - * Get the list of active sessions across different devices for the currently logged in user. + * 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.SessionList] + * @return [io.appwrite.models.MfaRecoveryCodes] */ @Throws(AppwriteException::class) - suspend fun listSessions( - ): io.appwrite.models.SessionList { - val apiPath = "/account/sessions" + suspend fun getMfaRecoveryCodes( + ): io.appwrite.models.MfaRecoveryCodes { + val apiPath = "/account/mfa/recovery-codes" val apiParams = mutableMapOf<String, Any?>( ) val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - val converter: (Any) -> io.appwrite.models.SessionList = { - io.appwrite.models.SessionList.from(map = it as Map<String, Any>) + val converter: (Any) -> io.appwrite.models.MfaRecoveryCodes = { + io.appwrite.models.MfaRecoveryCodes.from(map = it as Map<String, Any>) } return client.call( "GET", apiPath, apiHeaders, apiParams, - responseType = io.appwrite.models.SessionList::class.java, + responseType = io.appwrite.models.MfaRecoveryCodes::class.java, + converter, + ) + } + + /** + * Create MFA Recovery Codes + * + * 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<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.MfaRecoveryCodes = { + io.appwrite.models.MfaRecoveryCodes.from(map = it as Map<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.MfaRecoveryCodes::class.java, + converter, + ) + } + + /** + * Regenerate MFA Recovery Codes + * + * 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<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.MfaRecoveryCodes = { + io.appwrite.models.MfaRecoveryCodes.from(map = it as Map<String, Any>) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.MfaRecoveryCodes::class.java, + converter, + ) + } + + /** + * Update name + * + * Update currently logged in user account name. + * + * @param name User name. Max length: 128 chars. + * @return [io.appwrite.models.User<T>] + */ + @Throws(AppwriteException::class) + suspend fun <T> updateName( + name: String, + nestedType: Class<T>, + ): io.appwrite.models.User<T> { + val apiPath = "/account/name" + + val apiParams = mutableMapOf<String, Any?>( + "name" to name, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.User<T> = { + io.appwrite.models.User.from(map = it as Map<String, Any>, nestedType) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Update name + * + * Update currently logged in user account name. + * + * @param name User name. Max length: 128 chars. + * @return [io.appwrite.models.User<T>] + */ + @Throws(AppwriteException::class) + suspend fun updateName( + name: String, + ): io.appwrite.models.User<Map<String, Any>> = updateName( + name, + nestedType = classOf(), + ) + + /** + * Update password + * + * Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional. + * + * @param password New user password. Must be at least 8 chars. + * @param oldPassword Current user password. Must be at least 8 chars. + * @return [io.appwrite.models.User<T>] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun <T> updatePassword( + password: String, + oldPassword: String? = null, + nestedType: Class<T>, + ): io.appwrite.models.User<T> { + val apiPath = "/account/password" + + val apiParams = mutableMapOf<String, Any?>( + "password" to password, + "oldPassword" to oldPassword, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.User<T> = { + io.appwrite.models.User.from(map = it as Map<String, Any>, nestedType) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Update password + * + * Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional. + * + * @param password New user password. Must be at least 8 chars. + * @param oldPassword Current user password. Must be at least 8 chars. + * @return [io.appwrite.models.User<T>] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updatePassword( + password: String, + oldPassword: String? = null, + ): io.appwrite.models.User<Map<String, Any>> = updatePassword( + password, + oldPassword, + nestedType = classOf(), + ) + + /** + * Update phone + * + * 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. + * @return [io.appwrite.models.User<T>] + */ + @Throws(AppwriteException::class) + suspend fun <T> updatePhone( + phone: String, + password: String, + nestedType: Class<T>, + ): io.appwrite.models.User<T> { + val apiPath = "/account/phone" + + val apiParams = mutableMapOf<String, Any?>( + "phone" to phone, + "password" to password, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.User<T> = { + io.appwrite.models.User.from(map = it as Map<String, Any>, nestedType) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Update phone + * + * 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. + * @return [io.appwrite.models.User<T>] + */ + @Throws(AppwriteException::class) + suspend fun updatePhone( + phone: String, + password: String, + ): io.appwrite.models.User<Map<String, Any>> = updatePhone( + phone, + password, + nestedType = classOf(), + ) + + /** + * Get account preferences + * + * Get the preferences as a key-value object for the currently logged in user. + * + * @return [io.appwrite.models.Preferences<T>] + */ + @Throws(AppwriteException::class) + suspend fun <T> getPrefs( + nestedType: Class<T>, + ): io.appwrite.models.Preferences<T> { + val apiPath = "/account/prefs" + + val apiParams = mutableMapOf<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Preferences<T> = { + io.appwrite.models.Preferences.from(map = it as Map<String, Any>, nestedType) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Get account preferences + * + * Get the preferences as a key-value object for the currently logged in user. + * + * @return [io.appwrite.models.Preferences<T>] + */ + @Throws(AppwriteException::class) + suspend fun getPrefs( + ): io.appwrite.models.Preferences<Map<String, Any>> = getPrefs( + nestedType = classOf(), + ) + + /** + * Update preferences + * + * Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. + * + * @param prefs Prefs key-value JSON object. + * @return [io.appwrite.models.User<T>] + */ + @Throws(AppwriteException::class) + suspend fun <T> updatePrefs( + prefs: Any, + nestedType: Class<T>, + ): io.appwrite.models.User<T> { + val apiPath = "/account/prefs" + + val apiParams = mutableMapOf<String, Any?>( + "prefs" to prefs, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.User<T> = { + io.appwrite.models.User.from(map = it as Map<String, Any>, nestedType) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Update preferences + * + * Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. + * + * @param prefs Prefs key-value JSON object. + * @return [io.appwrite.models.User<T>] + */ + @Throws(AppwriteException::class) + suspend fun updatePrefs( + prefs: Any, + ): io.appwrite.models.User<Map<String, Any>> = updatePrefs( + prefs, + nestedType = classOf(), + ) + + /** + * Create password recovery + * + * 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. + * @return [io.appwrite.models.Token] + */ + @Throws(AppwriteException::class) + suspend fun createRecovery( + email: String, + url: String, + ): io.appwrite.models.Token { + val apiPath = "/account/recovery" + + val apiParams = mutableMapOf<String, Any?>( + "email" to email, + "url" to url, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Token = { + io.appwrite.models.Token.from(map = it as Map<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Token::class.java, + converter, + ) + } + + /** + * Create password recovery (confirmation) + * + * 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. + * @param password New user password. Must be between 8 and 256 chars. + * @return [io.appwrite.models.Token] + */ + @Throws(AppwriteException::class) + suspend fun updateRecovery( + userId: String, + secret: String, + password: String, + ): io.appwrite.models.Token { + val apiPath = "/account/recovery" + + val apiParams = mutableMapOf<String, Any?>( + "userId" to userId, + "secret" to secret, + "password" to password, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Token = { + io.appwrite.models.Token.from(map = it as Map<String, Any>) + } + return client.call( + "PUT", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Token::class.java, + converter, + ) + } + + /** + * List sessions + * + * Get the list of active sessions across different devices for the currently logged in user. + * + * @return [io.appwrite.models.SessionList] + */ + @Throws(AppwriteException::class) + suspend fun listSessions( + ): io.appwrite.models.SessionList { + val apiPath = "/account/sessions" + + val apiParams = mutableMapOf<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.SessionList = { + io.appwrite.models.SessionList.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.SessionList::class.java, converter, ) } @@ -580,26 +1056,200 @@ class Account : Service { /** * Delete sessions * - * Delete all sessions from the user account and remove any sessions cookies from the end client. + * Delete all sessions from the user account and remove any sessions cookies from the end client. + * + * @return [Any] + */ + @Throws(AppwriteException::class) + suspend fun deleteSessions( + ): Any { + val apiPath = "/account/sessions" + + val apiParams = mutableMapOf<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + return client.call( + "DELETE", + apiPath, + apiHeaders, + apiParams, + responseType = Any::class.java, + ) + } + + /** + * Create anonymous session + * + * Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its [email and password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail) or create an [OAuth2 session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session). * - * @return [Any] + * @return [io.appwrite.models.Session] */ @Throws(AppwriteException::class) - suspend fun deleteSessions( - ): Any { - val apiPath = "/account/sessions" + suspend fun createAnonymousSession( + ): io.appwrite.models.Session { + val apiPath = "/account/sessions/anonymous" val apiParams = mutableMapOf<String, Any?>( ) val apiHeaders = mutableMapOf( "content-type" to "application/json", ) + val converter: (Any) -> io.appwrite.models.Session = { + io.appwrite.models.Session.from(map = it as Map<String, Any>) + } return client.call( - "DELETE", + "POST", apiPath, apiHeaders, apiParams, - responseType = Any::class.java, + responseType = io.appwrite.models.Session::class.java, + converter, + ) + } + + /** + * Create email password session + * + * 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. + * @return [io.appwrite.models.Session] + */ + @Throws(AppwriteException::class) + suspend fun createEmailPasswordSession( + email: String, + password: String, + ): io.appwrite.models.Session { + val apiPath = "/account/sessions/email" + + val apiParams = mutableMapOf<String, Any?>( + "email" to email, + "password" to password, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Session = { + io.appwrite.models.Session.from(map = it as Map<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Session::class.java, + converter, + ) + } + + /** + * Update magic URL session + * + * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. + * + * @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 secret Valid verification token. + * @return [io.appwrite.models.Session] + */ + @Throws(AppwriteException::class) + suspend fun updateMagicURLSession( + userId: String, + secret: String, + ): io.appwrite.models.Session { + val apiPath = "/account/sessions/magic-url" + + val apiParams = mutableMapOf<String, Any?>( + "userId" to userId, + "secret" to secret, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Session = { + io.appwrite.models.Session.from(map = it as Map<String, Any>) + } + return client.call( + "PUT", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Session::class.java, + converter, + ) + } + + /** + * Update phone session + * + * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. + * + * @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 secret Valid verification token. + * @return [io.appwrite.models.Session] + */ + @Throws(AppwriteException::class) + suspend fun updatePhoneSession( + userId: String, + secret: String, + ): io.appwrite.models.Session { + val apiPath = "/account/sessions/phone" + + val apiParams = mutableMapOf<String, Any?>( + "userId" to userId, + "secret" to secret, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Session = { + io.appwrite.models.Session.from(map = it as Map<String, Any>) + } + return client.call( + "PUT", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Session::class.java, + converter, + ) + } + + /** + * Create session + * + * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. + * + * @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 secret Secret of a token generated by login methods. For example, the `createMagicURLToken` or `createPhoneToken` methods. + * @return [io.appwrite.models.Session] + */ + @Throws(AppwriteException::class) + suspend fun createSession( + userId: String, + secret: String, + ): io.appwrite.models.Session { + val apiPath = "/account/sessions/token" + + val apiParams = mutableMapOf<String, Any?>( + "userId" to userId, + "secret" to secret, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Session = { + io.appwrite.models.Session.from(map = it as Map<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Session::class.java, + converter, ) } @@ -637,9 +1287,9 @@ class Account : Service { } /** - * Update OAuth session (refresh tokens) + * Update session * - * Access tokens have limited lifespan and expire to mitigate security risks. If session was created using an OAuth provider, this route can be used to "refresh" the access token. + * 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] @@ -742,6 +1392,163 @@ class Account : Service { nestedType = classOf(), ) + /** + * Create email token (OTP) + * + * 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). + * + * @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 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] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createEmailToken( + userId: String, + email: String, + phrase: Boolean? = null, + ): io.appwrite.models.Token { + val apiPath = "/account/tokens/email" + + val apiParams = mutableMapOf<String, Any?>( + "userId" to userId, + "email" to email, + "phrase" to phrase, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Token = { + io.appwrite.models.Token.from(map = it as Map<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Token::class.java, + converter, + ) + } + + /** + * Create magic URL token + * + * 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. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appwrite instance by default.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 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. + * @return [io.appwrite.models.Token] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createMagicURLToken( + userId: String, + email: String, + url: String? = null, + phrase: Boolean? = null, + ): io.appwrite.models.Token { + val apiPath = "/account/tokens/magic-url" + + val apiParams = mutableMapOf<String, Any?>( + "userId" to userId, + "email" to email, + "url" to url, + "phrase" to phrase, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Token = { + io.appwrite.models.Token.from(map = it as Map<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Token::class.java, + converter, + ) + } + + /** + * Create OAuth2 token + * + * 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, 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. + * @param failure URL to redirect back to your app after a failed 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. + * @param scopes A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. + * @return [String] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createOAuth2Token( + provider: io.appwrite.enums.OAuthProvider, + success: String? = null, + failure: String? = null, + scopes: List<String>? = null, + ): String { + val apiPath = "/account/tokens/oauth2/{provider}" + .replace("{provider}", provider.value) + + val apiParams = mutableMapOf<String, Any?>( + "success" to success, + "failure" to failure, + "scopes" to scopes, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + return client.redirect( + "GET", + apiPath, + apiHeaders, + apiParams + ) + } + + /** + * Create phone token + * + * 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 phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @return [io.appwrite.models.Token] + */ + @Throws(AppwriteException::class) + suspend fun createPhoneToken( + userId: String, + phone: String, + ): io.appwrite.models.Token { + val apiPath = "/account/tokens/phone" + + val apiParams = mutableMapOf<String, Any?>( + "userId" to userId, + "phone" to phone, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Token = { + io.appwrite.models.Token.from(map = it as Map<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Token::class.java, + converter, + ) + } + /** * Create email verification * diff --git a/src/main/kotlin/io/appwrite/services/Avatars.kt b/src/main/kotlin/io/appwrite/services/Avatars.kt index f0f6e24..6e97bcf 100644 --- a/src/main/kotlin/io/appwrite/services/Avatars.kt +++ b/src/main/kotlin/io/appwrite/services/Avatars.kt @@ -2,6 +2,7 @@ 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 @@ -12,9 +13,7 @@ import java.io.File /** * The Avatars service aims to help you complete everyday tasks related to your app image, icons, and avatars. **/ -class Avatars : Service { - - public constructor (client: Client) : super(client) { } +class Avatars(client: Client) : Service(client) { /** * Get browser icon @@ -30,19 +29,22 @@ class Avatars : Service { @JvmOverloads @Throws(AppwriteException::class) suspend fun getBrowser( - code: String, + code: io.appwrite.enums.Browser, width: Long? = null, height: Long? = null, quality: Long? = null, ): ByteArray { val apiPath = "/avatars/browsers/{code}" - .replace("{code}", code) + .replace("{code}", code.value) val apiParams = mutableMapOf<String, Any?>( "width" to width, "height" to height, "quality" to quality, ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) return client.call( "GET", apiPath, @@ -65,19 +67,22 @@ class Avatars : Service { @JvmOverloads @Throws(AppwriteException::class) suspend fun getCreditCard( - code: String, + code: io.appwrite.enums.CreditCard, width: Long? = null, height: Long? = null, quality: Long? = null, ): ByteArray { val apiPath = "/avatars/credit-cards/{code}" - .replace("{code}", code) + .replace("{code}", code.value) val apiParams = mutableMapOf<String, Any?>( "width" to width, "height" to height, "quality" to quality, ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) return client.call( "GET", apiPath, @@ -103,6 +108,9 @@ class Avatars : Service { val apiParams = mutableMapOf<String, Any?>( "url" to url, ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) return client.call( "GET", apiPath, @@ -125,19 +133,22 @@ class Avatars : Service { @JvmOverloads @Throws(AppwriteException::class) suspend fun getFlag( - code: String, + code: io.appwrite.enums.Flag, width: Long? = null, height: Long? = null, quality: Long? = null, ): ByteArray { val apiPath = "/avatars/flags/{code}" - .replace("{code}", code) + .replace("{code}", code.value) val apiParams = mutableMapOf<String, Any?>( "width" to width, "height" to height, "quality" to quality, ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) return client.call( "GET", apiPath, @@ -170,6 +181,9 @@ class Avatars : Service { "width" to width, "height" to height, ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) return client.call( "GET", apiPath, @@ -205,6 +219,9 @@ class Avatars : Service { "height" to height, "background" to background, ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) return client.call( "GET", apiPath, @@ -240,6 +257,9 @@ class Avatars : Service { "margin" to margin, "download" to download, ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) return client.call( "GET", apiPath, diff --git a/src/main/kotlin/io/appwrite/services/Databases.kt b/src/main/kotlin/io/appwrite/services/Databases.kt index 26a3058..0d88d6b 100644 --- a/src/main/kotlin/io/appwrite/services/Databases.kt +++ b/src/main/kotlin/io/appwrite/services/Databases.kt @@ -2,6 +2,7 @@ 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 @@ -10,9 +11,7 @@ import java.io.File /** * The Databases service allows you to create structured collections of documents, query and filter lists of documents **/ -class Databases : Service { - - public constructor (client: Client) : super(client) { } +class Databases(client: Client) : Service(client) { /** * List databases @@ -402,7 +401,7 @@ class Databases : Service { /** * List attributes * - * + * 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). @@ -491,7 +490,7 @@ class Databases : Service { /** * Update boolean attribute * - * + * 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). @@ -536,13 +535,13 @@ class Databases : Service { /** * Create datetime attribute * - * + * 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 key Attribute Key. * @param required Is attribute required? - * @param default Default value for the attribute in ISO 8601 format. Cannot be set when attribute is 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] */ @@ -585,7 +584,7 @@ class Databases : Service { /** * Update dateTime attribute * - * + * 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). @@ -724,12 +723,12 @@ class Databases : Service { /** * Create enum attribute * - * + * Create an enumeration attribute. The `elements` param acts as a white-list of accepted values for this attribute. * * @param databaseId Database ID. * @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param key Attribute Key. - * @param elements Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 4096 characters long. + * @param elements Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long. * @param required Is attribute required? * @param default Default value for attribute when not provided. Cannot be set when attribute is required. * @param array Is attribute an array? @@ -781,7 +780,7 @@ class Databases : Service { * @param databaseId Database ID. * @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param key Attribute Key. - * @param elements Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 4096 characters long. + * @param elements Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long. * @param required Is attribute required? * @param default Default value for attribute when not provided. Cannot be set when attribute is required. * @return [io.appwrite.models.AttributeEnum] @@ -1148,11 +1147,11 @@ class Databases : Service { databaseId: String, collectionId: String, relatedCollectionId: String, - type: String, + type: io.appwrite.enums.RelationshipType, twoWay: Boolean? = null, key: String? = null, twoWayKey: String? = null, - onDelete: String? = null, + onDelete: io.appwrite.enums.RelationMutate? = null, ): io.appwrite.models.AttributeRelationship { val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/relationship" .replace("{databaseId}", databaseId) @@ -1379,7 +1378,7 @@ class Databases : Service { /** * Get attribute * - * + * 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). @@ -1414,7 +1413,7 @@ class Databases : Service { /** * Delete attribute * - * + * 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). @@ -1463,7 +1462,7 @@ class Databases : Service { databaseId: String, collectionId: String, key: String, - onDelete: String? = null, + onDelete: io.appwrite.enums.RelationMutate? = null, ): io.appwrite.models.AttributeRelationship { val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship" .replace("{databaseId}", databaseId) @@ -1637,7 +1636,7 @@ class Databases : Service { * @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 documentId Document ID. - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only method allowed is select. + * @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<T>] */ @JvmOverloads @@ -1681,7 +1680,7 @@ class Databases : Service { * @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 documentId Document ID. - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only method allowed is select. + * @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<T>] */ @JvmOverloads @@ -1813,7 +1812,7 @@ class Databases : Service { /** * List indexes * - * + * List indexes 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). @@ -1853,7 +1852,7 @@ class Databases : Service { /** * Create index * - * + * 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). @@ -1869,7 +1868,7 @@ class Databases : Service { databaseId: String, collectionId: String, key: String, - type: String, + type: io.appwrite.enums.IndexType, attributes: List<String>, orders: List<String>? = null, ): io.appwrite.models.Index { @@ -1902,7 +1901,7 @@ class Databases : Service { /** * Get index * - * + * Get index 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). @@ -1941,7 +1940,7 @@ class Databases : Service { /** * Delete index * - * + * Delete an index. * * @param databaseId Database ID. * @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). diff --git a/src/main/kotlin/io/appwrite/services/Functions.kt b/src/main/kotlin/io/appwrite/services/Functions.kt index b1e188c..3b3761c 100644 --- a/src/main/kotlin/io/appwrite/services/Functions.kt +++ b/src/main/kotlin/io/appwrite/services/Functions.kt @@ -2,6 +2,7 @@ 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 @@ -12,9 +13,7 @@ import java.io.File /** * The Functions Service allows you view, create and manage your Cloud Functions. **/ -class Functions : Service { - - public constructor (client: Client) : super(client) { } +class Functions(client: Client) : Service(client) { /** * List functions @@ -85,7 +84,7 @@ class Functions : Service { suspend fun create( functionId: String, name: String, - runtime: String, + runtime: io.appwrite.enums.Runtime, execute: List<String>? = null, events: List<String>? = null, schedule: String? = null, @@ -235,7 +234,7 @@ class Functions : Service { suspend fun update( functionId: String, name: String, - runtime: String? = null, + runtime: io.appwrite.enums.Runtime? = null, execute: List<String>? = null, events: List<String>? = null, schedule: String? = null, @@ -565,6 +564,9 @@ class Functions : Service { val apiParams = mutableMapOf<String, Any?>( ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) return client.call( "GET", apiPath, @@ -633,7 +635,7 @@ class Functions : Service { body: String? = null, async: Boolean? = null, path: String? = null, - method: String? = null, + method: io.appwrite.enums.ExecutionMethod? = null, headers: Any? = null, ): io.appwrite.models.Execution { val apiPath = "/functions/{functionId}/executions" diff --git a/src/main/kotlin/io/appwrite/services/Graphql.kt b/src/main/kotlin/io/appwrite/services/Graphql.kt index 7561aa5..d8a676c 100644 --- a/src/main/kotlin/io/appwrite/services/Graphql.kt +++ b/src/main/kotlin/io/appwrite/services/Graphql.kt @@ -2,6 +2,7 @@ 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 @@ -10,9 +11,7 @@ import java.io.File /** * The GraphQL API allows you to query and mutate your Appwrite server using GraphQL. **/ -class Graphql : Service { - - public constructor (client: Client) : super(client) { } +class Graphql(client: Client) : Service(client) { /** * GraphQL endpoint diff --git a/src/main/kotlin/io/appwrite/services/Health.kt b/src/main/kotlin/io/appwrite/services/Health.kt index 7652548..a566692 100644 --- a/src/main/kotlin/io/appwrite/services/Health.kt +++ b/src/main/kotlin/io/appwrite/services/Health.kt @@ -2,6 +2,7 @@ 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 @@ -10,9 +11,7 @@ import java.io.File /** * The Health service allows you to both validate and monitor your Appwrite server's health. **/ -class Health : Service { - - public constructor (client: Client) : super(client) { } +class Health(client: Client) : Service(client) { /** * Get HTTP @@ -104,6 +103,40 @@ class Health : Service { ) } + /** + * Get the SSL certificate for a domain + * + * Get the SSL certificate for a domain + * + * @param domain string + * @return [io.appwrite.models.HealthCertificate] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun getCertificate( + domain: String? = null, + ): io.appwrite.models.HealthCertificate { + val apiPath = "/health/certificate" + + val apiParams = mutableMapOf<String, Any?>( + "domain" to domain, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.HealthCertificate = { + io.appwrite.models.HealthCertificate.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.HealthCertificate::class.java, + converter, + ) + } + /** * Get DB * @@ -333,10 +366,47 @@ class Health : Service { ) } + /** + * Get number of failed queue jobs + * + * 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. + * @return [io.appwrite.models.HealthQueue] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun getFailedJobs( + name: io.appwrite.enums.Name, + threshold: Long? = null, + ): io.appwrite.models.HealthQueue { + val apiPath = "/health/queue/failed/{name}" + .replace("{name}", name.value) + + val apiParams = mutableMapOf<String, Any?>( + "threshold" to threshold, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.HealthQueue = { + io.appwrite.models.HealthQueue.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.HealthQueue::class.java, + converter, + ) + } + /** * Get functions queue * - * + * Get the number of function executions that are waiting to be processed in the Appwrite internal queue server. * * @param threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. * @return [io.appwrite.models.HealthQueue] @@ -503,6 +573,74 @@ class Health : Service { ) } + /** + * Get usage queue + * + * Get the number of metrics that are waiting to be processed in the Appwrite internal queue server. + * + * @param threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @return [io.appwrite.models.HealthQueue] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun getQueueUsage( + threshold: Long? = null, + ): io.appwrite.models.HealthQueue { + val apiPath = "/health/queue/usage" + + val apiParams = mutableMapOf<String, Any?>( + "threshold" to threshold, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.HealthQueue = { + io.appwrite.models.HealthQueue.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.HealthQueue::class.java, + converter, + ) + } + + /** + * Get usage dump queue + * + * Get the number of projects containing metrics that are waiting to be processed in the Appwrite internal queue server. + * + * @param threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @return [io.appwrite.models.HealthQueue] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun getQueueUsageDump( + threshold: Long? = null, + ): io.appwrite.models.HealthQueue { + val apiPath = "/health/queue/usage-dump" + + val apiParams = mutableMapOf<String, Any?>( + "threshold" to threshold, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.HealthQueue = { + io.appwrite.models.HealthQueue.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.HealthQueue::class.java, + converter, + ) + } + /** * Get webhooks queue * @@ -537,6 +675,36 @@ class Health : Service { ) } + /** + * Get storage + * + * Check the Appwrite storage device is up and connection is successful. + * + * @return [io.appwrite.models.HealthStatus] + */ + @Throws(AppwriteException::class) + suspend fun getStorage( + ): io.appwrite.models.HealthStatus { + val apiPath = "/health/storage" + + val apiParams = mutableMapOf<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.HealthStatus = { + io.appwrite.models.HealthStatus.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.HealthStatus::class.java, + converter, + ) + } + /** * Get local storage * diff --git a/src/main/kotlin/io/appwrite/services/Locale.kt b/src/main/kotlin/io/appwrite/services/Locale.kt index 4ae1fd1..8059629 100644 --- a/src/main/kotlin/io/appwrite/services/Locale.kt +++ b/src/main/kotlin/io/appwrite/services/Locale.kt @@ -2,6 +2,7 @@ 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 @@ -10,9 +11,7 @@ import java.io.File /** * The Locale service allows you to customize your app based on your users' location. **/ -class Locale : Service { - - public constructor (client: Client) : super(client) { } +class Locale(client: Client) : Service(client) { /** * Get user locale diff --git a/src/main/kotlin/io/appwrite/services/Messaging.kt b/src/main/kotlin/io/appwrite/services/Messaging.kt new file mode 100644 index 0000000..6828c2c --- /dev/null +++ b/src/main/kotlin/io/appwrite/services/Messaging.kt @@ -0,0 +1,2182 @@ +package io.appwrite.services + +import io.appwrite.Client +import io.appwrite.models.* +import io.appwrite.enums.* +import io.appwrite.exceptions.AppwriteException +import io.appwrite.extensions.classOf +import okhttp3.Cookie +import java.io.File + +/** + * The Messaging service allows you to send messages to any provider type (SMTP, push notification, SMS, etc.). +**/ +class Messaging(client: Client) : Service(client) { + + /** + * List messages + * + * Get a list of all messages from the current Appwrite project. + * + * @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: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType + * @param search Search term to filter your list results. Max length: 256 chars. + * @return [io.appwrite.models.MessageList] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun listMessages( + queries: List<String>? = null, + search: String? = null, + ): io.appwrite.models.MessageList { + val apiPath = "/messaging/messages" + + val apiParams = mutableMapOf<String, Any?>( + "queries" to queries, + "search" to search, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.MessageList = { + io.appwrite.models.MessageList.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.MessageList::class.java, + converter, + ) + } + + /** + * Create email + * + * Create a new email 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 subject Email Subject. + * @param content Email Content. + * @param topics List of Topic IDs. + * @param users List of User IDs. + * @param targets List of Targets IDs. + * @param cc Array of target IDs to be added as CC. + * @param bcc Array of target IDs to be added as BCC. + * @param attachments Array of compound bucket IDs to file IDs to be attached to the email. + * @param draft Is message a draft + * @param html Is content of type HTML + * @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 createEmail( + messageId: String, + subject: String, + content: String, + topics: List<String>? = null, + users: List<String>? = null, + targets: List<String>? = null, + cc: List<String>? = null, + bcc: List<String>? = null, + attachments: List<String>? = null, + draft: Boolean? = null, + html: Boolean? = null, + scheduledAt: String? = null, + ): io.appwrite.models.Message { + val apiPath = "/messaging/messages/email" + + val apiParams = mutableMapOf<String, Any?>( + "messageId" to messageId, + "subject" to subject, + "content" to content, + "topics" to topics, + "users" to users, + "targets" to targets, + "cc" to cc, + "bcc" to bcc, + "attachments" to attachments, + "draft" to draft, + "html" to html, + "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<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Message::class.java, + converter, + ) + } + + /** + * Update email + * + * Update an email message by its unique ID. + * + * @param messageId Message ID. + * @param topics List of Topic IDs. + * @param users List of User IDs. + * @param targets List of Targets IDs. + * @param subject Email Subject. + * @param content Email Content. + * @param draft Is message a draft + * @param html Is content of type HTML + * @param cc Array of target IDs to be added as CC. + * @param bcc Array of target IDs to be added as BCC. + * @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 updateEmail( + messageId: String, + topics: List<String>? = null, + users: List<String>? = null, + targets: List<String>? = null, + subject: String? = null, + content: String? = null, + draft: Boolean? = null, + html: Boolean? = null, + cc: List<String>? = null, + bcc: List<String>? = null, + scheduledAt: String? = null, + ): io.appwrite.models.Message { + val apiPath = "/messaging/messages/email/{messageId}" + .replace("{messageId}", messageId) + + val apiParams = mutableMapOf<String, Any?>( + "topics" to topics, + "users" to users, + "targets" to targets, + "subject" to subject, + "content" to content, + "draft" to draft, + "html" to html, + "cc" to cc, + "bcc" to bcc, + "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<String, Any>) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Message::class.java, + converter, + ) + } + + /** + * Create push notification + * + * Create a new push notification. + * + * @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 title Title for push notification. + * @param body Body for push notification. + * @param topics List of Topic IDs. + * @param users List of User IDs. + * @param targets List of Targets IDs. + * @param data Additional Data for push notification. + * @param action Action for push notification. + * @param image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. + * @param icon Icon for push notification. Available only for Android and Web Platform. + * @param sound Sound for push notification. Available only for Android and IOS Platform. + * @param color Color for push notification. Available only for Android Platform. + * @param tag Tag for push notification. Available only for Android Platform. + * @param badge Badge for push notification. Available only for IOS Platform. + * @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 createPush( + messageId: String, + title: String, + body: String, + topics: List<String>? = null, + users: List<String>? = null, + targets: List<String>? = null, + data: Any? = null, + action: String? = null, + image: String? = null, + icon: String? = null, + sound: String? = null, + color: String? = null, + tag: String? = null, + badge: String? = null, + draft: Boolean? = null, + scheduledAt: String? = null, + ): io.appwrite.models.Message { + val apiPath = "/messaging/messages/push" + + val apiParams = mutableMapOf<String, Any?>( + "messageId" to messageId, + "title" to title, + "body" to body, + "topics" to topics, + "users" to users, + "targets" to targets, + "data" to data, + "action" to action, + "image" to image, + "icon" to icon, + "sound" to sound, + "color" to color, + "tag" to tag, + "badge" to badge, + "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<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Message::class.java, + converter, + ) + } + + /** + * Update push notification + * + * Update a push notification by its unique ID. + * + * @param messageId Message ID. + * @param topics List of Topic IDs. + * @param users List of User IDs. + * @param targets List of Targets IDs. + * @param title Title for push notification. + * @param body Body for push notification. + * @param data Additional Data for push notification. + * @param action Action for push notification. + * @param image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. + * @param icon Icon for push notification. Available only for Android and Web platforms. + * @param sound Sound for push notification. Available only for Android and iOS platforms. + * @param color Color for push notification. Available only for Android platforms. + * @param tag Tag for push notification. Available only for Android platforms. + * @param badge Badge for push notification. Available only for iOS platforms. + * @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 updatePush( + messageId: String, + topics: List<String>? = null, + users: List<String>? = null, + targets: List<String>? = null, + title: String? = null, + body: String? = null, + data: Any? = null, + action: String? = null, + image: String? = null, + icon: String? = null, + sound: String? = null, + color: String? = null, + tag: String? = null, + badge: Long? = null, + draft: Boolean? = null, + scheduledAt: String? = null, + ): io.appwrite.models.Message { + val apiPath = "/messaging/messages/push/{messageId}" + .replace("{messageId}", messageId) + + val apiParams = mutableMapOf<String, Any?>( + "topics" to topics, + "users" to users, + "targets" to targets, + "title" to title, + "body" to body, + "data" to data, + "action" to action, + "image" to image, + "icon" to icon, + "sound" to sound, + "color" to color, + "tag" to tag, + "badge" to badge, + "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<String, Any>) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Message::class.java, + converter, + ) + } + + /** + * Create SMS + * + * 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<String>? = null, + users: List<String>? = null, + targets: List<String>? = null, + draft: Boolean? = null, + scheduledAt: String? = null, + ): io.appwrite.models.Message { + val apiPath = "/messaging/messages/sms" + + val apiParams = mutableMapOf<String, Any?>( + "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<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Message::class.java, + converter, + ) + } + + /** + * Update SMS + * + * Update an email message by its unique ID. + * + * @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<String>? = null, + users: List<String>? = null, + targets: List<String>? = 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<String, Any?>( + "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<String, Any>) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Message::class.java, + converter, + ) + } + + /** + * Get message + * + * Get a message by its unique ID. + * + * @param messageId Message ID. + * @return [io.appwrite.models.Message] + */ + @Throws(AppwriteException::class) + suspend fun getMessage( + messageId: String, + ): io.appwrite.models.Message { + val apiPath = "/messaging/messages/{messageId}" + .replace("{messageId}", messageId) + + val apiParams = mutableMapOf<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Message = { + io.appwrite.models.Message.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Message::class.java, + converter, + ) + } + + /** + * Delete message + * + * Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message. + * + * @param messageId Message ID. + * @return [Any] + */ + @Throws(AppwriteException::class) + suspend fun delete( + messageId: String, + ): Any { + val apiPath = "/messaging/messages/{messageId}" + .replace("{messageId}", messageId) + + val apiParams = mutableMapOf<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + return client.call( + "DELETE", + apiPath, + apiHeaders, + apiParams, + responseType = Any::class.java, + ) + } + + /** + * List message logs + * + * Get the message activity logs listed by its unique ID. + * + * @param messageId Message 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). Only supported methods are limit and offset + * @return [io.appwrite.models.LogList] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun listMessageLogs( + messageId: String, + queries: List<String>? = null, + ): io.appwrite.models.LogList { + val apiPath = "/messaging/messages/{messageId}/logs" + .replace("{messageId}", messageId) + + val apiParams = mutableMapOf<String, Any?>( + "queries" to queries, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.LogList = { + io.appwrite.models.LogList.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.LogList::class.java, + converter, + ) + } + + /** + * List message targets + * + * Get a list of the targets associated with a message. + * + * @param messageId Message 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, providerId, identifier, providerType + * @return [io.appwrite.models.TargetList] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun listTargets( + messageId: String, + queries: List<String>? = null, + ): io.appwrite.models.TargetList { + val apiPath = "/messaging/messages/{messageId}/targets" + .replace("{messageId}", messageId) + + val apiParams = mutableMapOf<String, Any?>( + "queries" to queries, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.TargetList = { + io.appwrite.models.TargetList.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.TargetList::class.java, + converter, + ) + } + + /** + * List providers + * + * Get a list of all providers from the current Appwrite project. + * + * @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, provider, type, enabled + * @param search Search term to filter your list results. Max length: 256 chars. + * @return [io.appwrite.models.ProviderList] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun listProviders( + queries: List<String>? = null, + search: String? = null, + ): io.appwrite.models.ProviderList { + val apiPath = "/messaging/providers" + + val apiParams = mutableMapOf<String, Any?>( + "queries" to queries, + "search" to search, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ProviderList = { + io.appwrite.models.ProviderList.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.ProviderList::class.java, + converter, + ) + } + + /** + * Create APNS provider + * + * 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<String, Any?>( + "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<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + + /** + * Update APNS provider + * + * 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<String, Any?>( + "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<String, Any>) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + + /** + * Create FCM provider + * + * 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<String, Any?>( + "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<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + + /** + * Update FCM provider + * + * 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<String, Any?>( + "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<String, Any>) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + + /** + * Create Mailgun provider + * + * Create a new Mailgun 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 apiKey Mailgun API Key. + * @param domain Mailgun Domain. + * @param isEuRegion Set as EU region. + * @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. Reply to name must have reply to email as well. + * @param replyToEmail Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well. + * @param enabled Set as enabled. + * @return [io.appwrite.models.Provider] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createMailgunProvider( + providerId: String, + name: String, + apiKey: String? = null, + domain: String? = null, + isEuRegion: Boolean? = null, + fromName: String? = null, + fromEmail: String? = null, + replyToName: String? = null, + replyToEmail: String? = null, + enabled: Boolean? = null, + ): io.appwrite.models.Provider { + val apiPath = "/messaging/providers/mailgun" + + val apiParams = mutableMapOf<String, Any?>( + "providerId" to providerId, + "name" to name, + "apiKey" to apiKey, + "domain" to domain, + "isEuRegion" to isEuRegion, + "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<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + + /** + * Update Mailgun provider + * + * Update a Mailgun provider by its unique ID. + * + * @param providerId Provider ID. + * @param name Provider name. + * @param apiKey Mailgun API Key. + * @param domain Mailgun Domain. + * @param isEuRegion Set as EU region. + * @param enabled Set as enabled. + * @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. + * @return [io.appwrite.models.Provider] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateMailgunProvider( + providerId: String, + name: String? = null, + apiKey: String? = null, + domain: String? = null, + isEuRegion: Boolean? = null, + enabled: Boolean? = null, + fromName: String? = null, + fromEmail: String? = null, + replyToName: String? = null, + replyToEmail: String? = null, + ): io.appwrite.models.Provider { + val apiPath = "/messaging/providers/mailgun/{providerId}" + .replace("{providerId}", providerId) + + val apiParams = mutableMapOf<String, Any?>( + "name" to name, + "apiKey" to apiKey, + "domain" to domain, + "isEuRegion" to isEuRegion, + "enabled" to enabled, + "fromName" to fromName, + "fromEmail" to fromEmail, + "replyToName" to replyToName, + "replyToEmail" to replyToEmail, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Provider = { + io.appwrite.models.Provider.from(map = it as Map<String, Any>) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + + /** + * Create Msg91 provider + * + * Create a new MSG91 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 from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param senderId Msg91 Sender ID. + * @param authKey Msg91 Auth Key. + * @param enabled Set as enabled. + * @return [io.appwrite.models.Provider] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createMsg91Provider( + providerId: String, + name: String, + from: String? = null, + senderId: String? = null, + authKey: String? = null, + enabled: Boolean? = null, + ): io.appwrite.models.Provider { + val apiPath = "/messaging/providers/msg91" + + val apiParams = mutableMapOf<String, Any?>( + "providerId" to providerId, + "name" to name, + "from" to from, + "senderId" to senderId, + "authKey" to authKey, + "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<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + + /** + * Update Msg91 provider + * + * Update a MSG91 provider by its unique ID. + * + * @param providerId Provider ID. + * @param name Provider name. + * @param enabled Set as enabled. + * @param senderId Msg91 Sender ID. + * @param authKey Msg91 Auth Key. + * @param from Sender number. + * @return [io.appwrite.models.Provider] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateMsg91Provider( + providerId: String, + name: String? = null, + enabled: Boolean? = null, + senderId: String? = null, + authKey: String? = null, + from: String? = null, + ): io.appwrite.models.Provider { + val apiPath = "/messaging/providers/msg91/{providerId}" + .replace("{providerId}", providerId) + + val apiParams = mutableMapOf<String, Any?>( + "name" to name, + "enabled" to enabled, + "senderId" to senderId, + "authKey" to authKey, + "from" to from, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Provider = { + io.appwrite.models.Provider.from(map = it as Map<String, Any>) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + + /** + * Create Sendgrid provider + * + * Create a new Sendgrid 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 apiKey Sendgrid API key. + * @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 createSendgridProvider( + providerId: String, + name: String, + apiKey: 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/sendgrid" + + val apiParams = mutableMapOf<String, Any?>( + "providerId" to providerId, + "name" to name, + "apiKey" to apiKey, + "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<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + + /** + * Update Sendgrid provider + * + * Update a Sendgrid provider by its unique ID. + * + * @param providerId Provider ID. + * @param name Provider name. + * @param enabled Set as enabled. + * @param apiKey Sendgrid API key. + * @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. + * @return [io.appwrite.models.Provider] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateSendgridProvider( + providerId: String, + name: String? = null, + enabled: Boolean? = null, + apiKey: String? = null, + fromName: String? = null, + fromEmail: String? = null, + replyToName: String? = null, + replyToEmail: String? = null, + ): io.appwrite.models.Provider { + val apiPath = "/messaging/providers/sendgrid/{providerId}" + .replace("{providerId}", providerId) + + val apiParams = mutableMapOf<String, Any?>( + "name" to name, + "enabled" to enabled, + "apiKey" to apiKey, + "fromName" to fromName, + "fromEmail" to fromEmail, + "replyToName" to replyToName, + "replyToEmail" to replyToEmail, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Provider = { + io.appwrite.models.Provider.from(map = it as Map<String, Any>) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + + /** + * Create SMTP provider + * + * 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<String, Any?>( + "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<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + + /** + * Update SMTP provider + * + * 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<String, Any?>( + "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<String, Any>) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + + /** + * Create Telesign provider + * + * Create a new Telesign 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 from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param customerId Telesign customer ID. + * @param apiKey Telesign API key. + * @param enabled Set as enabled. + * @return [io.appwrite.models.Provider] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createTelesignProvider( + providerId: String, + name: String, + from: String? = null, + customerId: String? = null, + apiKey: String? = null, + enabled: Boolean? = null, + ): io.appwrite.models.Provider { + val apiPath = "/messaging/providers/telesign" + + val apiParams = mutableMapOf<String, Any?>( + "providerId" to providerId, + "name" to name, + "from" to from, + "customerId" to customerId, + "apiKey" to apiKey, + "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<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + + /** + * Update Telesign provider + * + * Update a Telesign provider by its unique ID. + * + * @param providerId Provider ID. + * @param name Provider name. + * @param enabled Set as enabled. + * @param customerId Telesign customer ID. + * @param apiKey Telesign API key. + * @param from Sender number. + * @return [io.appwrite.models.Provider] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateTelesignProvider( + providerId: String, + name: String? = null, + enabled: Boolean? = null, + customerId: String? = null, + apiKey: String? = null, + from: String? = null, + ): io.appwrite.models.Provider { + val apiPath = "/messaging/providers/telesign/{providerId}" + .replace("{providerId}", providerId) + + val apiParams = mutableMapOf<String, Any?>( + "name" to name, + "enabled" to enabled, + "customerId" to customerId, + "apiKey" to apiKey, + "from" to from, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Provider = { + io.appwrite.models.Provider.from(map = it as Map<String, Any>) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + + /** + * Create Textmagic provider + * + * Create a new Textmagic 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 from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param username Textmagic username. + * @param apiKey Textmagic apiKey. + * @param enabled Set as enabled. + * @return [io.appwrite.models.Provider] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createTextmagicProvider( + providerId: String, + name: String, + from: String? = null, + username: String? = null, + apiKey: String? = null, + enabled: Boolean? = null, + ): io.appwrite.models.Provider { + val apiPath = "/messaging/providers/textmagic" + + val apiParams = mutableMapOf<String, Any?>( + "providerId" to providerId, + "name" to name, + "from" to from, + "username" to username, + "apiKey" to apiKey, + "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<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + + /** + * Update Textmagic provider + * + * Update a Textmagic provider by its unique ID. + * + * @param providerId Provider ID. + * @param name Provider name. + * @param enabled Set as enabled. + * @param username Textmagic username. + * @param apiKey Textmagic apiKey. + * @param from Sender number. + * @return [io.appwrite.models.Provider] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateTextmagicProvider( + providerId: String, + name: String? = null, + enabled: Boolean? = null, + username: String? = null, + apiKey: String? = null, + from: String? = null, + ): io.appwrite.models.Provider { + val apiPath = "/messaging/providers/textmagic/{providerId}" + .replace("{providerId}", providerId) + + val apiParams = mutableMapOf<String, Any?>( + "name" to name, + "enabled" to enabled, + "username" to username, + "apiKey" to apiKey, + "from" to from, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Provider = { + io.appwrite.models.Provider.from(map = it as Map<String, Any>) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + + /** + * Create Twilio provider + * + * Create a new Twilio 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 from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param accountSid Twilio account secret ID. + * @param authToken Twilio authentication token. + * @param enabled Set as enabled. + * @return [io.appwrite.models.Provider] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createTwilioProvider( + providerId: String, + name: String, + from: String? = null, + accountSid: String? = null, + authToken: String? = null, + enabled: Boolean? = null, + ): io.appwrite.models.Provider { + val apiPath = "/messaging/providers/twilio" + + val apiParams = mutableMapOf<String, Any?>( + "providerId" to providerId, + "name" to name, + "from" to from, + "accountSid" to accountSid, + "authToken" to authToken, + "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<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + + /** + * Update Twilio provider + * + * Update a Twilio provider by its unique ID. + * + * @param providerId Provider ID. + * @param name Provider name. + * @param enabled Set as enabled. + * @param accountSid Twilio account secret ID. + * @param authToken Twilio authentication token. + * @param from Sender number. + * @return [io.appwrite.models.Provider] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateTwilioProvider( + providerId: String, + name: String? = null, + enabled: Boolean? = null, + accountSid: String? = null, + authToken: String? = null, + from: String? = null, + ): io.appwrite.models.Provider { + val apiPath = "/messaging/providers/twilio/{providerId}" + .replace("{providerId}", providerId) + + val apiParams = mutableMapOf<String, Any?>( + "name" to name, + "enabled" to enabled, + "accountSid" to accountSid, + "authToken" to authToken, + "from" to from, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Provider = { + io.appwrite.models.Provider.from(map = it as Map<String, Any>) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + + /** + * Create Vonage provider + * + * Create a new Vonage 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 from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param apiKey Vonage API key. + * @param apiSecret Vonage API secret. + * @param enabled Set as enabled. + * @return [io.appwrite.models.Provider] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createVonageProvider( + providerId: String, + name: String, + from: String? = null, + apiKey: String? = null, + apiSecret: String? = null, + enabled: Boolean? = null, + ): io.appwrite.models.Provider { + val apiPath = "/messaging/providers/vonage" + + val apiParams = mutableMapOf<String, Any?>( + "providerId" to providerId, + "name" to name, + "from" to from, + "apiKey" to apiKey, + "apiSecret" to apiSecret, + "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<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + + /** + * Update Vonage provider + * + * Update a Vonage provider by its unique ID. + * + * @param providerId Provider ID. + * @param name Provider name. + * @param enabled Set as enabled. + * @param apiKey Vonage API key. + * @param apiSecret Vonage API secret. + * @param from Sender number. + * @return [io.appwrite.models.Provider] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateVonageProvider( + providerId: String, + name: String? = null, + enabled: Boolean? = null, + apiKey: String? = null, + apiSecret: String? = null, + from: String? = null, + ): io.appwrite.models.Provider { + val apiPath = "/messaging/providers/vonage/{providerId}" + .replace("{providerId}", providerId) + + val apiParams = mutableMapOf<String, Any?>( + "name" to name, + "enabled" to enabled, + "apiKey" to apiKey, + "apiSecret" to apiSecret, + "from" to from, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Provider = { + io.appwrite.models.Provider.from(map = it as Map<String, Any>) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + + /** + * Get provider + * + * Get a provider by its unique ID. + * + * @param providerId Provider ID. + * @return [io.appwrite.models.Provider] + */ + @Throws(AppwriteException::class) + suspend fun getProvider( + providerId: String, + ): io.appwrite.models.Provider { + val apiPath = "/messaging/providers/{providerId}" + .replace("{providerId}", providerId) + + val apiParams = mutableMapOf<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Provider = { + io.appwrite.models.Provider.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Provider::class.java, + converter, + ) + } + + /** + * Delete provider + * + * Delete a provider by its unique ID. + * + * @param providerId Provider ID. + * @return [Any] + */ + @Throws(AppwriteException::class) + suspend fun deleteProvider( + providerId: String, + ): Any { + val apiPath = "/messaging/providers/{providerId}" + .replace("{providerId}", providerId) + + val apiParams = mutableMapOf<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + return client.call( + "DELETE", + apiPath, + apiHeaders, + apiParams, + responseType = Any::class.java, + ) + } + + /** + * List provider logs + * + * Get the provider activity logs listed by its unique ID. + * + * @param providerId Provider 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). Only supported methods are limit and offset + * @return [io.appwrite.models.LogList] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun listProviderLogs( + providerId: String, + queries: List<String>? = null, + ): io.appwrite.models.LogList { + val apiPath = "/messaging/providers/{providerId}/logs" + .replace("{providerId}", providerId) + + val apiParams = mutableMapOf<String, Any?>( + "queries" to queries, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.LogList = { + io.appwrite.models.LogList.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.LogList::class.java, + converter, + ) + } + + /** + * List subscriber logs + * + * Get the subscriber activity logs listed by its unique ID. + * + * @param subscriberId Subscriber 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). Only supported methods are limit and offset + * @return [io.appwrite.models.LogList] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun listSubscriberLogs( + subscriberId: String, + queries: List<String>? = null, + ): io.appwrite.models.LogList { + val apiPath = "/messaging/subscribers/{subscriberId}/logs" + .replace("{subscriberId}", subscriberId) + + val apiParams = mutableMapOf<String, Any?>( + "queries" to queries, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.LogList = { + io.appwrite.models.LogList.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.LogList::class.java, + converter, + ) + } + + /** + * List topics + * + * Get a list of all topics from the current Appwrite project. + * + * @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, description, emailTotal, smsTotal, pushTotal + * @param search Search term to filter your list results. Max length: 256 chars. + * @return [io.appwrite.models.TopicList] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun listTopics( + queries: List<String>? = null, + search: String? = null, + ): io.appwrite.models.TopicList { + val apiPath = "/messaging/topics" + + val apiParams = mutableMapOf<String, Any?>( + "queries" to queries, + "search" to search, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.TopicList = { + io.appwrite.models.TopicList.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.TopicList::class.java, + converter, + ) + } + + /** + * Create topic + * + * Create a new topic. + * + * @param topicId Topic ID. Choose a custom Topic ID or a new Topic ID. + * @param name Topic Name. + * @param subscribe An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. + * @return [io.appwrite.models.Topic] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createTopic( + topicId: String, + name: String, + subscribe: List<String>? = null, + ): io.appwrite.models.Topic { + val apiPath = "/messaging/topics" + + val apiParams = mutableMapOf<String, Any?>( + "topicId" to topicId, + "name" to name, + "subscribe" to subscribe, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Topic = { + io.appwrite.models.Topic.from(map = it as Map<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Topic::class.java, + converter, + ) + } + + /** + * Get topic + * + * Get a topic by its unique ID. + * + * @param topicId Topic ID. + * @return [io.appwrite.models.Topic] + */ + @Throws(AppwriteException::class) + suspend fun getTopic( + topicId: String, + ): io.appwrite.models.Topic { + val apiPath = "/messaging/topics/{topicId}" + .replace("{topicId}", topicId) + + val apiParams = mutableMapOf<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Topic = { + io.appwrite.models.Topic.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Topic::class.java, + converter, + ) + } + + /** + * Update topic + * + * Update a topic by its unique ID. + * + * @param topicId Topic ID. + * @param name Topic Name. + * @param subscribe An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. + * @return [io.appwrite.models.Topic] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateTopic( + topicId: String, + name: String? = null, + subscribe: List<String>? = null, + ): io.appwrite.models.Topic { + val apiPath = "/messaging/topics/{topicId}" + .replace("{topicId}", topicId) + + val apiParams = mutableMapOf<String, Any?>( + "name" to name, + "subscribe" to subscribe, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Topic = { + io.appwrite.models.Topic.from(map = it as Map<String, Any>) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Topic::class.java, + converter, + ) + } + + /** + * Delete topic + * + * Delete a topic by its unique ID. + * + * @param topicId Topic ID. + * @return [Any] + */ + @Throws(AppwriteException::class) + suspend fun deleteTopic( + topicId: String, + ): Any { + val apiPath = "/messaging/topics/{topicId}" + .replace("{topicId}", topicId) + + val apiParams = mutableMapOf<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + return client.call( + "DELETE", + apiPath, + apiHeaders, + apiParams, + responseType = Any::class.java, + ) + } + + /** + * List topic logs + * + * Get the topic activity logs listed by its unique ID. + * + * @param topicId Topic 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). Only supported methods are limit and offset + * @return [io.appwrite.models.LogList] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun listTopicLogs( + topicId: String, + queries: List<String>? = null, + ): io.appwrite.models.LogList { + val apiPath = "/messaging/topics/{topicId}/logs" + .replace("{topicId}", topicId) + + val apiParams = mutableMapOf<String, Any?>( + "queries" to queries, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.LogList = { + io.appwrite.models.LogList.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.LogList::class.java, + converter, + ) + } + + /** + * List subscribers + * + * Get a list of all subscribers from the current Appwrite project. + * + * @param topicId Topic ID. The topic ID subscribed to. + * @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, provider, type, enabled + * @param search Search term to filter your list results. Max length: 256 chars. + * @return [io.appwrite.models.SubscriberList] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun listSubscribers( + topicId: String, + queries: List<String>? = null, + search: String? = null, + ): io.appwrite.models.SubscriberList { + val apiPath = "/messaging/topics/{topicId}/subscribers" + .replace("{topicId}", topicId) + + val apiParams = mutableMapOf<String, Any?>( + "queries" to queries, + "search" to search, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.SubscriberList = { + io.appwrite.models.SubscriberList.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.SubscriberList::class.java, + converter, + ) + } + + /** + * Create subscriber + * + * Create a new subscriber. + * + * @param topicId Topic ID. The topic ID to subscribe to. + * @param subscriberId Subscriber ID. Choose a custom Subscriber ID or a new Subscriber ID. + * @param targetId Target ID. The target ID to link to the specified Topic ID. + * @return [io.appwrite.models.Subscriber] + */ + @Throws(AppwriteException::class) + suspend fun createSubscriber( + topicId: String, + subscriberId: String, + targetId: String, + ): io.appwrite.models.Subscriber { + val apiPath = "/messaging/topics/{topicId}/subscribers" + .replace("{topicId}", topicId) + + val apiParams = mutableMapOf<String, Any?>( + "subscriberId" to subscriberId, + "targetId" to targetId, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Subscriber = { + io.appwrite.models.Subscriber.from(map = it as Map<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Subscriber::class.java, + converter, + ) + } + + /** + * Get subscriber + * + * Get a subscriber by its unique ID. + * + * @param topicId Topic ID. The topic ID subscribed to. + * @param subscriberId Subscriber ID. + * @return [io.appwrite.models.Subscriber] + */ + @Throws(AppwriteException::class) + suspend fun getSubscriber( + topicId: String, + subscriberId: String, + ): io.appwrite.models.Subscriber { + val apiPath = "/messaging/topics/{topicId}/subscribers/{subscriberId}" + .replace("{topicId}", topicId) + .replace("{subscriberId}", subscriberId) + + val apiParams = mutableMapOf<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Subscriber = { + io.appwrite.models.Subscriber.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Subscriber::class.java, + converter, + ) + } + + /** + * Delete subscriber + * + * Delete a subscriber by its unique ID. + * + * @param topicId Topic ID. The topic ID subscribed to. + * @param subscriberId Subscriber ID. + * @return [Any] + */ + @Throws(AppwriteException::class) + suspend fun deleteSubscriber( + topicId: String, + subscriberId: String, + ): Any { + val apiPath = "/messaging/topics/{topicId}/subscribers/{subscriberId}" + .replace("{topicId}", topicId) + .replace("{subscriberId}", subscriberId) + + val apiParams = mutableMapOf<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + return client.call( + "DELETE", + apiPath, + apiHeaders, + apiParams, + responseType = Any::class.java, + ) + } + +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/services/Storage.kt b/src/main/kotlin/io/appwrite/services/Storage.kt index a7b0967..2260e50 100644 --- a/src/main/kotlin/io/appwrite/services/Storage.kt +++ b/src/main/kotlin/io/appwrite/services/Storage.kt @@ -2,6 +2,7 @@ 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 @@ -12,9 +13,7 @@ import java.io.File /** * The Storage service allows you to manage your project files. **/ -class Storage : Service { - - public constructor (client: Client) : super(client) { } +class Storage(client: Client) : Service(client) { /** * List buckets @@ -80,7 +79,7 @@ class Storage : Service { enabled: Boolean? = null, maximumFileSize: Long? = null, allowedFileExtensions: List<String>? = null, - compression: String? = null, + compression: io.appwrite.enums.Compression? = null, encryption: Boolean? = null, antivirus: Boolean? = null, ): io.appwrite.models.Bucket { @@ -174,7 +173,7 @@ class Storage : Service { enabled: Boolean? = null, maximumFileSize: Long? = null, allowedFileExtensions: List<String>? = null, - compression: String? = null, + compression: io.appwrite.enums.Compression? = null, encryption: Boolean? = null, antivirus: Boolean? = null, ): io.appwrite.models.Bucket { @@ -456,6 +455,9 @@ class Storage : Service { val apiParams = mutableMapOf<String, Any?>( ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) return client.call( "GET", apiPath, @@ -491,7 +493,7 @@ class Storage : Service { fileId: String, width: Long? = null, height: Long? = null, - gravity: String? = null, + gravity: io.appwrite.enums.ImageGravity? = null, quality: Long? = null, borderWidth: Long? = null, borderColor: String? = null, @@ -499,7 +501,7 @@ class Storage : Service { opacity: Double? = null, rotation: Long? = null, background: String? = null, - output: String? = null, + output: io.appwrite.enums.ImageFormat? = null, ): ByteArray { val apiPath = "/storage/buckets/{bucketId}/files/{fileId}/preview" .replace("{bucketId}", bucketId) @@ -518,6 +520,9 @@ class Storage : Service { "background" to background, "output" to output, ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) return client.call( "GET", apiPath, @@ -546,6 +551,9 @@ class Storage : Service { val apiParams = mutableMapOf<String, Any?>( ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) return client.call( "GET", apiPath, diff --git a/src/main/kotlin/io/appwrite/services/Teams.kt b/src/main/kotlin/io/appwrite/services/Teams.kt index dd45d82..90180ba 100644 --- a/src/main/kotlin/io/appwrite/services/Teams.kt +++ b/src/main/kotlin/io/appwrite/services/Teams.kt @@ -2,6 +2,7 @@ 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 @@ -10,16 +11,14 @@ import java.io.File /** * The Teams service allows you to group users of your project and to enable them to share read and write access to your project resources **/ -class Teams : Service { - - public constructor (client: Client) : super(client) { } +class Teams(client: Client) : Service(client) { /** * List teams * * Get a list of all the teams in which the current user is a member. You can use the parameters 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, total + * @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, total, billingPlan * @param search Search term to filter your list results. Max length: 256 chars. * @return [io.appwrite.models.TeamList<T>] */ @@ -57,7 +56,7 @@ class Teams : Service { * * Get a list of all the teams in which the current user is a member. You can use the parameters 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, total + * @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, total, billingPlan * @param search Search term to filter your list results. Max length: 256 chars. * @return [io.appwrite.models.TeamList<T>] */ diff --git a/src/main/kotlin/io/appwrite/services/Users.kt b/src/main/kotlin/io/appwrite/services/Users.kt index 37e07cd..5bb87fc 100644 --- a/src/main/kotlin/io/appwrite/services/Users.kt +++ b/src/main/kotlin/io/appwrite/services/Users.kt @@ -2,6 +2,7 @@ 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 @@ -10,16 +11,14 @@ import java.io.File /** * The Users service allows you to manage your project users. **/ -class Users : Service { - - public constructor (client: Client) : super(client) { } +class Users(client: Client) : Service(client) { /** * List users * * 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 + * @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. * @return [io.appwrite.models.UserList<T>] */ @@ -57,7 +56,7 @@ class Users : Service { * * 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 + * @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. * @return [io.appwrite.models.UserList<T>] */ @@ -300,7 +299,7 @@ class Users : Service { @JvmOverloads @Throws(AppwriteException::class) suspend fun listIdentities( - queries: String? = null, + queries: List<String>? = null, search: String? = null, ): io.appwrite.models.IdentityList { val apiPath = "/users/identities" @@ -326,7 +325,7 @@ class Users : Service { } /** - * Delete Identity + * Delete identity * * Delete an identity by its unique ID. * @@ -700,7 +699,7 @@ class Users : Service { userId: String, email: String, password: String, - passwordVersion: String? = null, + passwordVersion: io.appwrite.enums.PasswordHash? = null, name: String? = null, nestedType: Class<T>, ): io.appwrite.models.User<T> { @@ -747,7 +746,7 @@ class Users : Service { userId: String, email: String, password: String, - passwordVersion: String? = null, + passwordVersion: io.appwrite.enums.PasswordHash? = null, name: String? = null, ): io.appwrite.models.User<Map<String, Any>> = createSHAUser( userId, @@ -899,7 +898,7 @@ class Users : Service { * 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 100 labels are allowed, each up to 36 alphanumeric characters long. + * @param labels Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. * @return [io.appwrite.models.User<T>] */ @Throws(AppwriteException::class) @@ -936,7 +935,7 @@ class Users : Service { * 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 100 labels are allowed, each up to 36 alphanumeric characters long. + * @param labels Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. * @return [io.appwrite.models.User<T>] */ @Throws(AppwriteException::class) @@ -1019,6 +1018,250 @@ class Users : Service { ) } + /** + * Update MFA + * + * Enable or disable MFA on a user account. + * + * @param userId User ID. + * @param mfa Enable or disable MFA. + * @return [io.appwrite.models.User<T>] + */ + @Throws(AppwriteException::class) + suspend fun <T> updateMfa( + userId: String, + mfa: Boolean, + nestedType: Class<T>, + ): io.appwrite.models.User<T> { + val apiPath = "/users/{userId}/mfa" + .replace("{userId}", userId) + + val apiParams = mutableMapOf<String, Any?>( + "mfa" to mfa, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.User<T> = { + io.appwrite.models.User.from(map = it as Map<String, Any>, nestedType) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Update MFA + * + * Enable or disable MFA on a user account. + * + * @param userId User ID. + * @param mfa Enable or disable MFA. + * @return [io.appwrite.models.User<T>] + */ + @Throws(AppwriteException::class) + suspend fun updateMfa( + userId: String, + mfa: Boolean, + ): io.appwrite.models.User<Map<String, Any>> = updateMfa( + userId, + mfa, + nestedType = classOf(), + ) + + /** + * Delete Authenticator + * + * Delete an authenticator app. + * + * @param userId User ID. + * @param type Type of authenticator. + * @return [io.appwrite.models.User<T>] + */ + @Throws(AppwriteException::class) + suspend fun <T> deleteMfaAuthenticator( + userId: String, + type: io.appwrite.enums.AuthenticatorType, + nestedType: Class<T>, + ): io.appwrite.models.User<T> { + val apiPath = "/users/{userId}/mfa/authenticators/{type}" + .replace("{userId}", userId) + .replace("{type}", type.value) + + val apiParams = mutableMapOf<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.User<T> = { + io.appwrite.models.User.from(map = it as Map<String, Any>, nestedType) + } + return client.call( + "DELETE", + apiPath, + apiHeaders, + apiParams, + responseType = classOf(), + converter, + ) + } + + /** + * Delete Authenticator + * + * Delete an authenticator app. + * + * @param userId User ID. + * @param type Type of authenticator. + * @return [io.appwrite.models.User<T>] + */ + @Throws(AppwriteException::class) + suspend fun deleteMfaAuthenticator( + userId: String, + type: io.appwrite.enums.AuthenticatorType, + ): io.appwrite.models.User<Map<String, Any>> = deleteMfaAuthenticator( + userId, + type, + nestedType = classOf(), + ) + + /** + * List Factors + * + * 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<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.MfaFactors = { + io.appwrite.models.MfaFactors.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.MfaFactors::class.java, + converter, + ) + } + + /** + * Get MFA Recovery Codes + * + * 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<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.MfaRecoveryCodes = { + io.appwrite.models.MfaRecoveryCodes.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.MfaRecoveryCodes::class.java, + converter, + ) + } + + /** + * Regenerate MFA Recovery Codes + * + * 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<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.MfaRecoveryCodes = { + io.appwrite.models.MfaRecoveryCodes.from(map = it as Map<String, Any>) + } + return client.call( + "PUT", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.MfaRecoveryCodes::class.java, + converter, + ) + } + + /** + * Create MFA Recovery Codes + * + * 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<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.MfaRecoveryCodes = { + io.appwrite.models.MfaRecoveryCodes.from(map = it as Map<String, Any>) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.MfaRecoveryCodes::class.java, + converter, + ) + } + /** * Update name * @@ -1326,6 +1569,39 @@ class Users : Service { ) } + /** + * Create session + * + * 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] + */ + @Throws(AppwriteException::class) + suspend fun createSession( + userId: String, + ): io.appwrite.models.Session { + val apiPath = "/users/{userId}/sessions" + .replace("{userId}", userId) + + val apiParams = mutableMapOf<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Session = { + io.appwrite.models.Session.from(map = it as Map<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Session::class.java, + converter, + ) + } + /** * Delete user sessions * @@ -1443,6 +1719,246 @@ class Users : Service { nestedType = classOf(), ) + /** + * List User Targets + * + * List the messaging targets that are associated with a user. + * + * @param userId User ID. + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels + * @return [io.appwrite.models.TargetList] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun listTargets( + userId: String, + queries: List<String>? = null, + ): io.appwrite.models.TargetList { + val apiPath = "/users/{userId}/targets" + .replace("{userId}", userId) + + val apiParams = mutableMapOf<String, Any?>( + "queries" to queries, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.TargetList = { + io.appwrite.models.TargetList.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.TargetList::class.java, + converter, + ) + } + + /** + * Create User Target + * + * Create a messaging target. + * + * @param userId User ID. + * @param targetId Target 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 providerType The target provider type. Can be one of the following: `email`, `sms` or `push`. + * @param identifier The target identifier (token, email, phone etc.) + * @param providerId Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. + * @param name Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. + * @return [io.appwrite.models.Target] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createTarget( + userId: String, + targetId: String, + providerType: io.appwrite.enums.MessagingProviderType, + identifier: String, + providerId: String? = null, + name: String? = null, + ): io.appwrite.models.Target { + val apiPath = "/users/{userId}/targets" + .replace("{userId}", userId) + + val apiParams = mutableMapOf<String, Any?>( + "targetId" to targetId, + "providerType" to providerType, + "identifier" to identifier, + "providerId" to providerId, + "name" to name, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Target = { + io.appwrite.models.Target.from(map = it as Map<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Target::class.java, + converter, + ) + } + + /** + * Get User Target + * + * Get a user's push notification target by ID. + * + * @param userId User ID. + * @param targetId Target ID. + * @return [io.appwrite.models.Target] + */ + @Throws(AppwriteException::class) + suspend fun getTarget( + userId: String, + targetId: String, + ): io.appwrite.models.Target { + val apiPath = "/users/{userId}/targets/{targetId}" + .replace("{userId}", userId) + .replace("{targetId}", targetId) + + val apiParams = mutableMapOf<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Target = { + io.appwrite.models.Target.from(map = it as Map<String, Any>) + } + return client.call( + "GET", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Target::class.java, + converter, + ) + } + + /** + * Update User target + * + * Update a messaging target. + * + * @param userId User ID. + * @param targetId Target ID. + * @param identifier The target identifier (token, email, phone etc.) + * @param providerId Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. + * @param name Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. + * @return [io.appwrite.models.Target] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun updateTarget( + userId: String, + targetId: String, + identifier: String? = null, + providerId: String? = null, + name: String? = null, + ): io.appwrite.models.Target { + val apiPath = "/users/{userId}/targets/{targetId}" + .replace("{userId}", userId) + .replace("{targetId}", targetId) + + val apiParams = mutableMapOf<String, Any?>( + "identifier" to identifier, + "providerId" to providerId, + "name" to name, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Target = { + io.appwrite.models.Target.from(map = it as Map<String, Any>) + } + return client.call( + "PATCH", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Target::class.java, + converter, + ) + } + + /** + * Delete user target + * + * Delete a messaging target. + * + * @param userId User ID. + * @param targetId Target ID. + * @return [Any] + */ + @Throws(AppwriteException::class) + suspend fun deleteTarget( + userId: String, + targetId: String, + ): Any { + val apiPath = "/users/{userId}/targets/{targetId}" + .replace("{userId}", userId) + .replace("{targetId}", targetId) + + val apiParams = mutableMapOf<String, Any?>( + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + return client.call( + "DELETE", + apiPath, + apiHeaders, + apiParams, + responseType = Any::class.java, + ) + } + + /** + * Create token + * + * Returns a token 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 [PUT /account/sessions/custom](https://appwrite.io/docs/references/cloud/client-web/account#updateCustomSession) endpoint to complete the login process. + * + * @param userId User ID. + * @param length Token length in characters. The default length is 6 characters + * @param expire Token expiration period in seconds. The default expiration is 15 minutes. + * @return [io.appwrite.models.Token] + */ + @JvmOverloads + @Throws(AppwriteException::class) + suspend fun createToken( + userId: String, + length: Long? = null, + expire: Long? = null, + ): io.appwrite.models.Token { + val apiPath = "/users/{userId}/tokens" + .replace("{userId}", userId) + + val apiParams = mutableMapOf<String, Any?>( + "length" to length, + "expire" to expire, + ) + val apiHeaders = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Token = { + io.appwrite.models.Token.from(map = it as Map<String, Any>) + } + return client.call( + "POST", + apiPath, + apiHeaders, + apiParams, + responseType = io.appwrite.models.Token::class.java, + converter, + ) + } + /** * Update email verification *