├── .github └── workflows │ ├── autoclose.yml │ └── publish.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── build.gradle ├── docs └── examples │ ├── java │ ├── account │ │ ├── create-anonymous-session.md │ │ ├── create-email-password-session.md │ │ ├── create-email-token.md │ │ ├── create-j-w-t.md │ │ ├── create-magic-u-r-l-token.md │ │ ├── create-mfa-authenticator.md │ │ ├── create-mfa-challenge.md │ │ ├── create-mfa-recovery-codes.md │ │ ├── create-o-auth2session.md │ │ ├── create-o-auth2token.md │ │ ├── create-phone-token.md │ │ ├── create-phone-verification.md │ │ ├── create-push-target.md │ │ ├── create-recovery.md │ │ ├── create-session.md │ │ ├── create-verification.md │ │ ├── create.md │ │ ├── delete-identity.md │ │ ├── delete-mfa-authenticator.md │ │ ├── delete-push-target.md │ │ ├── delete-session.md │ │ ├── delete-sessions.md │ │ ├── get-mfa-recovery-codes.md │ │ ├── get-prefs.md │ │ ├── get-session.md │ │ ├── get.md │ │ ├── list-identities.md │ │ ├── list-logs.md │ │ ├── list-mfa-factors.md │ │ ├── list-sessions.md │ │ ├── update-email.md │ │ ├── update-m-f-a.md │ │ ├── update-magic-u-r-l-session.md │ │ ├── update-mfa-authenticator.md │ │ ├── update-mfa-challenge.md │ │ ├── update-mfa-recovery-codes.md │ │ ├── update-name.md │ │ ├── update-password.md │ │ ├── update-phone-session.md │ │ ├── update-phone-verification.md │ │ ├── update-phone.md │ │ ├── update-prefs.md │ │ ├── update-push-target.md │ │ ├── update-recovery.md │ │ ├── update-session.md │ │ ├── update-status.md │ │ └── update-verification.md │ ├── avatars │ │ ├── get-browser.md │ │ ├── get-credit-card.md │ │ ├── get-favicon.md │ │ ├── get-flag.md │ │ ├── get-image.md │ │ ├── get-initials.md │ │ └── get-q-r.md │ ├── databases │ │ ├── create-document.md │ │ ├── delete-document.md │ │ ├── get-document.md │ │ ├── list-documents.md │ │ ├── update-document.md │ │ └── upsert-document.md │ ├── functions │ │ ├── create-execution.md │ │ ├── get-execution.md │ │ └── list-executions.md │ ├── graphql │ │ ├── mutation.md │ │ └── query.md │ ├── locale │ │ ├── get.md │ │ ├── list-codes.md │ │ ├── list-continents.md │ │ ├── list-countries-e-u.md │ │ ├── list-countries-phones.md │ │ ├── list-countries.md │ │ ├── list-currencies.md │ │ └── list-languages.md │ ├── messaging │ │ ├── create-subscriber.md │ │ └── delete-subscriber.md │ ├── storage │ │ ├── create-file.md │ │ ├── delete-file.md │ │ ├── get-file-download.md │ │ ├── get-file-preview.md │ │ ├── get-file-view.md │ │ ├── get-file.md │ │ ├── list-files.md │ │ └── update-file.md │ └── teams │ │ ├── create-membership.md │ │ ├── create.md │ │ ├── delete-membership.md │ │ ├── delete.md │ │ ├── get-membership.md │ │ ├── get-prefs.md │ │ ├── get.md │ │ ├── list-memberships.md │ │ ├── list.md │ │ ├── update-membership-status.md │ │ ├── update-membership.md │ │ ├── update-name.md │ │ └── update-prefs.md │ └── kotlin │ ├── account │ ├── create-anonymous-session.md │ ├── create-email-password-session.md │ ├── create-email-token.md │ ├── create-j-w-t.md │ ├── create-magic-u-r-l-token.md │ ├── create-mfa-authenticator.md │ ├── create-mfa-challenge.md │ ├── create-mfa-recovery-codes.md │ ├── create-o-auth2session.md │ ├── create-o-auth2token.md │ ├── create-phone-token.md │ ├── create-phone-verification.md │ ├── create-push-target.md │ ├── create-recovery.md │ ├── create-session.md │ ├── create-verification.md │ ├── create.md │ ├── delete-identity.md │ ├── delete-mfa-authenticator.md │ ├── delete-push-target.md │ ├── delete-session.md │ ├── delete-sessions.md │ ├── get-mfa-recovery-codes.md │ ├── get-prefs.md │ ├── get-session.md │ ├── get.md │ ├── list-identities.md │ ├── list-logs.md │ ├── list-mfa-factors.md │ ├── list-sessions.md │ ├── update-email.md │ ├── update-m-f-a.md │ ├── update-magic-u-r-l-session.md │ ├── update-mfa-authenticator.md │ ├── update-mfa-challenge.md │ ├── update-mfa-recovery-codes.md │ ├── update-name.md │ ├── update-password.md │ ├── update-phone-session.md │ ├── update-phone-verification.md │ ├── update-phone.md │ ├── update-prefs.md │ ├── update-push-target.md │ ├── update-recovery.md │ ├── update-session.md │ ├── update-status.md │ └── update-verification.md │ ├── avatars │ ├── get-browser.md │ ├── get-credit-card.md │ ├── get-favicon.md │ ├── get-flag.md │ ├── get-image.md │ ├── get-initials.md │ └── get-q-r.md │ ├── databases │ ├── create-document.md │ ├── delete-document.md │ ├── get-document.md │ ├── list-documents.md │ ├── update-document.md │ └── upsert-document.md │ ├── functions │ ├── create-execution.md │ ├── get-execution.md │ └── list-executions.md │ ├── graphql │ ├── mutation.md │ └── query.md │ ├── locale │ ├── get.md │ ├── list-codes.md │ ├── list-continents.md │ ├── list-countries-e-u.md │ ├── list-countries-phones.md │ ├── list-countries.md │ ├── list-currencies.md │ └── list-languages.md │ ├── messaging │ ├── create-subscriber.md │ └── delete-subscriber.md │ ├── storage │ ├── create-file.md │ ├── delete-file.md │ ├── get-file-download.md │ ├── get-file-preview.md │ ├── get-file-view.md │ ├── get-file.md │ ├── list-files.md │ └── update-file.md │ └── teams │ ├── create-membership.md │ ├── create.md │ ├── delete-membership.md │ ├── delete.md │ ├── get-membership.md │ ├── get-prefs.md │ ├── get.md │ ├── list-memberships.md │ ├── list.md │ ├── update-membership-status.md │ ├── update-membership.md │ ├── update-name.md │ └── update-prefs.md ├── example ├── .gitignore ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── io │ │ └── appwrite │ │ └── android │ │ ├── MainActivity.kt │ │ ├── services │ │ └── MessagingService.kt │ │ ├── ui │ │ └── accounts │ │ │ ├── AccountsFragment.kt │ │ │ └── AccountsViewModel.kt │ │ └── utils │ │ ├── Client.kt │ │ └── Event.kt │ └── res │ ├── drawable │ ├── ic_launcher_background.xml │ └── ic_launcher_foreground.xml │ ├── layout │ ├── activity_main.xml │ └── fragment_account.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ └── values │ ├── colors.xml │ ├── strings.xml │ └── themes.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library ├── .gitignore ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── io │ └── appwrite │ ├── Client.kt │ ├── ID.kt │ ├── KeepAliveService.kt │ ├── Permission.kt │ ├── Query.kt │ ├── Role.kt │ ├── Service.kt │ ├── WebAuthComponent.kt │ ├── cookies │ ├── Extensions.kt │ ├── InternalCookie.kt │ ├── ListenableCookieJar.kt │ └── stores │ │ ├── InMemoryCookieStore.kt │ │ └── SharedPreferencesCookieStore.kt │ ├── coroutines │ └── Callback.kt │ ├── enums │ ├── AuthenticationFactor.kt │ ├── AuthenticatorType.kt │ ├── Browser.kt │ ├── CreditCard.kt │ ├── ExecutionMethod.kt │ ├── Flag.kt │ ├── ImageFormat.kt │ ├── ImageGravity.kt │ └── OAuthProvider.kt │ ├── exceptions │ └── AppwriteException.kt │ ├── extensions │ ├── CollectionExtensions.kt │ ├── JsonExtensions.kt │ └── TypeExtensions.kt │ ├── models │ ├── AlgoArgon2.kt │ ├── AlgoBcrypt.kt │ ├── AlgoMd5.kt │ ├── AlgoPhpass.kt │ ├── AlgoScrypt.kt │ ├── AlgoScryptModified.kt │ ├── AlgoSha.kt │ ├── Continent.kt │ ├── ContinentList.kt │ ├── Country.kt │ ├── CountryList.kt │ ├── Currency.kt │ ├── CurrencyList.kt │ ├── Document.kt │ ├── DocumentList.kt │ ├── Execution.kt │ ├── ExecutionList.kt │ ├── File.kt │ ├── FileList.kt │ ├── Headers.kt │ ├── Identity.kt │ ├── IdentityList.kt │ ├── InputFile.kt │ ├── Jwt.kt │ ├── Language.kt │ ├── LanguageList.kt │ ├── Locale.kt │ ├── LocaleCode.kt │ ├── LocaleCodeList.kt │ ├── Log.kt │ ├── LogList.kt │ ├── Membership.kt │ ├── MembershipList.kt │ ├── MfaChallenge.kt │ ├── MfaFactors.kt │ ├── MfaRecoveryCodes.kt │ ├── MfaType.kt │ ├── Phone.kt │ ├── PhoneList.kt │ ├── Preferences.kt │ ├── RealtimeModels.kt │ ├── Session.kt │ ├── SessionList.kt │ ├── Subscriber.kt │ ├── Target.kt │ ├── Team.kt │ ├── TeamList.kt │ ├── Token.kt │ ├── UploadProgress.kt │ └── User.kt │ ├── services │ ├── Account.kt │ ├── Avatars.kt │ ├── Databases.kt │ ├── Functions.kt │ ├── Graphql.kt │ ├── Locale.kt │ ├── Messaging.kt │ ├── Realtime.kt │ ├── Storage.kt │ └── Teams.kt │ └── views │ └── CallbackActivity.kt ├── scripts ├── publish-config.gradle └── publish-module.gradle └── settings.gradle /.github/workflows/autoclose.yml: -------------------------------------------------------------------------------- 1 | name: Auto-close External Pull Requests 2 | 3 | on: 4 | pull_request_target: 5 | types: [opened, reopened] 6 | 7 | jobs: 8 | auto_close: 9 | uses: appwrite/.github/.github/workflows/autoclose.yml@main 10 | secrets: 11 | GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }} 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/* 5 | .DS_Store 6 | /build 7 | /captures 8 | .externalNativeBuild 9 | .cxx 10 | .local.properties 11 | .env 12 | */build -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## 8.0.0 4 | 5 | * Add `token` param to `getFilePreview` and `getFileView` for File tokens usage 6 | * Update default `quality` for `getFilePreview` from 0 to -1 7 | * Remove `Gif` from ImageFormat enum 8 | * Remove `search` param from `listExecutions` method -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | 8 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 9 | 10 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 11 | 12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'io.github.gradle-nexus.publish-plugin' 2 | 3 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 4 | buildscript { 5 | ext.kotlin_version = "1.9.10" 6 | 7 | version System.getenv("SDK_VERSION") 8 | 9 | repositories { 10 | maven { url "https://plugins.gradle.org/m2/" } 11 | google() 12 | mavenCentral() 13 | } 14 | dependencies { 15 | classpath "com.android.tools.build:gradle:8.2.2" 16 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 17 | classpath "io.github.gradle-nexus:publish-plugin:1.3.0" 18 | } 19 | } 20 | 21 | allprojects { 22 | repositories { 23 | google() 24 | mavenCentral() 25 | } 26 | } 27 | 28 | task clean(type: Delete) { 29 | delete rootProject.buildDir 30 | } 31 | 32 | 33 | apply from: "${rootDir}/scripts/publish-config.gradle" 34 | 35 | -------------------------------------------------------------------------------- /docs/examples/java/account/create-anonymous-session.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.createAnonymousSession(new CoroutineCallback<>((result, error) -> { 12 | if (error != null) { 13 | error.printStackTrace(); 14 | return; 15 | } 16 | 17 | Log.d("Appwrite", result.toString()); 18 | })); 19 | -------------------------------------------------------------------------------- /docs/examples/java/account/create-email-password-session.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.createEmailPasswordSession( 12 | "email@example.com", // email 13 | "password", // password 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/account/create-email-token.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.createEmailToken( 12 | "", // userId 13 | "email@example.com", // email 14 | false, // phrase (optional) 15 | new CoroutineCallback<>((result, error) -> { 16 | if (error != null) { 17 | error.printStackTrace(); 18 | return; 19 | } 20 | 21 | Log.d("Appwrite", result.toString()); 22 | }) 23 | ); 24 | 25 | -------------------------------------------------------------------------------- /docs/examples/java/account/create-j-w-t.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.createJWT(new CoroutineCallback<>((result, error) -> { 12 | if (error != null) { 13 | error.printStackTrace(); 14 | return; 15 | } 16 | 17 | Log.d("Appwrite", result.toString()); 18 | })); 19 | -------------------------------------------------------------------------------- /docs/examples/java/account/create-magic-u-r-l-token.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.createMagicURLToken( 12 | "", // userId 13 | "email@example.com", // email 14 | "https://example.com", // url (optional) 15 | false, // phrase (optional) 16 | new CoroutineCallback<>((result, error) -> { 17 | if (error != null) { 18 | error.printStackTrace(); 19 | return; 20 | } 21 | 22 | Log.d("Appwrite", result.toString()); 23 | }) 24 | ); 25 | 26 | -------------------------------------------------------------------------------- /docs/examples/java/account/create-mfa-authenticator.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | import io.appwrite.enums.AuthenticatorType; 5 | 6 | Client client = new Client(context) 7 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 8 | .setProject(""); // Your project ID 9 | 10 | Account account = new Account(client); 11 | 12 | account.createMfaAuthenticator( 13 | AuthenticatorType.TOTP, // type 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/account/create-mfa-challenge.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | import io.appwrite.enums.AuthenticationFactor; 5 | 6 | Client client = new Client(context) 7 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 8 | .setProject(""); // Your project ID 9 | 10 | Account account = new Account(client); 11 | 12 | account.createMfaChallenge( 13 | AuthenticationFactor.EMAIL, // factor 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/account/create-mfa-recovery-codes.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.createMfaRecoveryCodes(new CoroutineCallback<>((result, error) -> { 12 | if (error != null) { 13 | error.printStackTrace(); 14 | return; 15 | } 16 | 17 | Log.d("Appwrite", result.toString()); 18 | })); 19 | -------------------------------------------------------------------------------- /docs/examples/java/account/create-o-auth2session.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | import io.appwrite.enums.OAuthProvider; 5 | 6 | Client client = new Client(context) 7 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 8 | .setProject(""); // Your project ID 9 | 10 | Account account = new Account(client); 11 | 12 | account.createOAuth2Session( 13 | OAuthProvider.AMAZON, // provider 14 | "https://example.com", // success (optional) 15 | "https://example.com", // failure (optional) 16 | listOf(), // scopes (optional) 17 | new CoroutineCallback<>((result, error) -> { 18 | if (error != null) { 19 | error.printStackTrace(); 20 | return; 21 | } 22 | 23 | Log.d("Appwrite", result.toString()); 24 | }) 25 | ); 26 | 27 | -------------------------------------------------------------------------------- /docs/examples/java/account/create-o-auth2token.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | import io.appwrite.enums.OAuthProvider; 5 | 6 | Client client = new Client(context) 7 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 8 | .setProject(""); // Your project ID 9 | 10 | Account account = new Account(client); 11 | 12 | account.createOAuth2Token( 13 | OAuthProvider.AMAZON, // provider 14 | "https://example.com", // success (optional) 15 | "https://example.com", // failure (optional) 16 | listOf(), // scopes (optional) 17 | new CoroutineCallback<>((result, error) -> { 18 | if (error != null) { 19 | error.printStackTrace(); 20 | return; 21 | } 22 | 23 | Log.d("Appwrite", result.toString()); 24 | }) 25 | ); 26 | 27 | -------------------------------------------------------------------------------- /docs/examples/java/account/create-phone-token.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.createPhoneToken( 12 | "", // userId 13 | "+12065550100", // phone 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/account/create-phone-verification.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.createPhoneVerification(new CoroutineCallback<>((result, error) -> { 12 | if (error != null) { 13 | error.printStackTrace(); 14 | return; 15 | } 16 | 17 | Log.d("Appwrite", result.toString()); 18 | })); 19 | -------------------------------------------------------------------------------- /docs/examples/java/account/create-push-target.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.createPushTarget( 12 | "", // targetId 13 | "", // identifier 14 | "", // providerId (optional) 15 | new CoroutineCallback<>((result, error) -> { 16 | if (error != null) { 17 | error.printStackTrace(); 18 | return; 19 | } 20 | 21 | Log.d("Appwrite", result.toString()); 22 | }) 23 | ); 24 | 25 | -------------------------------------------------------------------------------- /docs/examples/java/account/create-recovery.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.createRecovery( 12 | "email@example.com", // email 13 | "https://example.com", // url 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/account/create-session.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.createSession( 12 | "", // userId 13 | "", // secret 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/account/create-verification.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.createVerification( 12 | "https://example.com", // url 13 | new CoroutineCallback<>((result, error) -> { 14 | if (error != null) { 15 | error.printStackTrace(); 16 | return; 17 | } 18 | 19 | Log.d("Appwrite", result.toString()); 20 | }) 21 | ); 22 | 23 | -------------------------------------------------------------------------------- /docs/examples/java/account/create.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.create( 12 | "", // userId 13 | "email@example.com", // email 14 | "", // password 15 | "", // name (optional) 16 | new CoroutineCallback<>((result, error) -> { 17 | if (error != null) { 18 | error.printStackTrace(); 19 | return; 20 | } 21 | 22 | Log.d("Appwrite", result.toString()); 23 | }) 24 | ); 25 | 26 | -------------------------------------------------------------------------------- /docs/examples/java/account/delete-identity.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.deleteIdentity( 12 | "", // identityId 13 | new CoroutineCallback<>((result, error) -> { 14 | if (error != null) { 15 | error.printStackTrace(); 16 | return; 17 | } 18 | 19 | Log.d("Appwrite", result.toString()); 20 | }) 21 | ); 22 | 23 | -------------------------------------------------------------------------------- /docs/examples/java/account/delete-mfa-authenticator.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | import io.appwrite.enums.AuthenticatorType; 5 | 6 | Client client = new Client(context) 7 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 8 | .setProject(""); // Your project ID 9 | 10 | Account account = new Account(client); 11 | 12 | account.deleteMfaAuthenticator( 13 | AuthenticatorType.TOTP, // type 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/account/delete-push-target.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.deletePushTarget( 12 | "", // targetId 13 | new CoroutineCallback<>((result, error) -> { 14 | if (error != null) { 15 | error.printStackTrace(); 16 | return; 17 | } 18 | 19 | Log.d("Appwrite", result.toString()); 20 | }) 21 | ); 22 | 23 | -------------------------------------------------------------------------------- /docs/examples/java/account/delete-session.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.deleteSession( 12 | "", // sessionId 13 | new CoroutineCallback<>((result, error) -> { 14 | if (error != null) { 15 | error.printStackTrace(); 16 | return; 17 | } 18 | 19 | Log.d("Appwrite", result.toString()); 20 | }) 21 | ); 22 | 23 | -------------------------------------------------------------------------------- /docs/examples/java/account/delete-sessions.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.deleteSessions(new CoroutineCallback<>((result, error) -> { 12 | if (error != null) { 13 | error.printStackTrace(); 14 | return; 15 | } 16 | 17 | Log.d("Appwrite", result.toString()); 18 | })); 19 | -------------------------------------------------------------------------------- /docs/examples/java/account/get-mfa-recovery-codes.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.getMfaRecoveryCodes(new CoroutineCallback<>((result, error) -> { 12 | if (error != null) { 13 | error.printStackTrace(); 14 | return; 15 | } 16 | 17 | Log.d("Appwrite", result.toString()); 18 | })); 19 | -------------------------------------------------------------------------------- /docs/examples/java/account/get-prefs.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.getPrefs(new CoroutineCallback<>((result, error) -> { 12 | if (error != null) { 13 | error.printStackTrace(); 14 | return; 15 | } 16 | 17 | Log.d("Appwrite", result.toString()); 18 | })); 19 | -------------------------------------------------------------------------------- /docs/examples/java/account/get-session.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.getSession( 12 | "", // sessionId 13 | new CoroutineCallback<>((result, error) -> { 14 | if (error != null) { 15 | error.printStackTrace(); 16 | return; 17 | } 18 | 19 | Log.d("Appwrite", result.toString()); 20 | }) 21 | ); 22 | 23 | -------------------------------------------------------------------------------- /docs/examples/java/account/get.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.get(new CoroutineCallback<>((result, error) -> { 12 | if (error != null) { 13 | error.printStackTrace(); 14 | return; 15 | } 16 | 17 | Log.d("Appwrite", result.toString()); 18 | })); 19 | -------------------------------------------------------------------------------- /docs/examples/java/account/list-identities.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.listIdentities( 12 | listOf(), // queries (optional) 13 | new CoroutineCallback<>((result, error) -> { 14 | if (error != null) { 15 | error.printStackTrace(); 16 | return; 17 | } 18 | 19 | Log.d("Appwrite", result.toString()); 20 | }) 21 | ); 22 | 23 | -------------------------------------------------------------------------------- /docs/examples/java/account/list-logs.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.listLogs( 12 | listOf(), // queries (optional) 13 | new CoroutineCallback<>((result, error) -> { 14 | if (error != null) { 15 | error.printStackTrace(); 16 | return; 17 | } 18 | 19 | Log.d("Appwrite", result.toString()); 20 | }) 21 | ); 22 | 23 | -------------------------------------------------------------------------------- /docs/examples/java/account/list-mfa-factors.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.listMfaFactors(new CoroutineCallback<>((result, error) -> { 12 | if (error != null) { 13 | error.printStackTrace(); 14 | return; 15 | } 16 | 17 | Log.d("Appwrite", result.toString()); 18 | })); 19 | -------------------------------------------------------------------------------- /docs/examples/java/account/list-sessions.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.listSessions(new CoroutineCallback<>((result, error) -> { 12 | if (error != null) { 13 | error.printStackTrace(); 14 | return; 15 | } 16 | 17 | Log.d("Appwrite", result.toString()); 18 | })); 19 | -------------------------------------------------------------------------------- /docs/examples/java/account/update-email.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.updateEmail( 12 | "email@example.com", // email 13 | "password", // password 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/account/update-m-f-a.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.updateMFA( 12 | false, // mfa 13 | new CoroutineCallback<>((result, error) -> { 14 | if (error != null) { 15 | error.printStackTrace(); 16 | return; 17 | } 18 | 19 | Log.d("Appwrite", result.toString()); 20 | }) 21 | ); 22 | 23 | -------------------------------------------------------------------------------- /docs/examples/java/account/update-magic-u-r-l-session.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.updateMagicURLSession( 12 | "", // userId 13 | "", // secret 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/account/update-mfa-authenticator.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | import io.appwrite.enums.AuthenticatorType; 5 | 6 | Client client = new Client(context) 7 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 8 | .setProject(""); // Your project ID 9 | 10 | Account account = new Account(client); 11 | 12 | account.updateMfaAuthenticator( 13 | AuthenticatorType.TOTP, // type 14 | "", // otp 15 | new CoroutineCallback<>((result, error) -> { 16 | if (error != null) { 17 | error.printStackTrace(); 18 | return; 19 | } 20 | 21 | Log.d("Appwrite", result.toString()); 22 | }) 23 | ); 24 | 25 | -------------------------------------------------------------------------------- /docs/examples/java/account/update-mfa-challenge.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.updateMfaChallenge( 12 | "", // challengeId 13 | "", // otp 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/account/update-mfa-recovery-codes.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.updateMfaRecoveryCodes(new CoroutineCallback<>((result, error) -> { 12 | if (error != null) { 13 | error.printStackTrace(); 14 | return; 15 | } 16 | 17 | Log.d("Appwrite", result.toString()); 18 | })); 19 | -------------------------------------------------------------------------------- /docs/examples/java/account/update-name.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.updateName( 12 | "", // name 13 | new CoroutineCallback<>((result, error) -> { 14 | if (error != null) { 15 | error.printStackTrace(); 16 | return; 17 | } 18 | 19 | Log.d("Appwrite", result.toString()); 20 | }) 21 | ); 22 | 23 | -------------------------------------------------------------------------------- /docs/examples/java/account/update-password.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.updatePassword( 12 | "", // password 13 | "password", // oldPassword (optional) 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/account/update-phone-session.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.updatePhoneSession( 12 | "", // userId 13 | "", // secret 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/account/update-phone-verification.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.updatePhoneVerification( 12 | "", // userId 13 | "", // secret 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/account/update-phone.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.updatePhone( 12 | "+12065550100", // phone 13 | "password", // password 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/account/update-prefs.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.updatePrefs( 12 | mapOf( "a" to "b" ), // prefs 13 | new CoroutineCallback<>((result, error) -> { 14 | if (error != null) { 15 | error.printStackTrace(); 16 | return; 17 | } 18 | 19 | Log.d("Appwrite", result.toString()); 20 | }) 21 | ); 22 | 23 | -------------------------------------------------------------------------------- /docs/examples/java/account/update-push-target.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.updatePushTarget( 12 | "", // targetId 13 | "", // identifier 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/account/update-recovery.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.updateRecovery( 12 | "", // userId 13 | "", // secret 14 | "", // password 15 | new CoroutineCallback<>((result, error) -> { 16 | if (error != null) { 17 | error.printStackTrace(); 18 | return; 19 | } 20 | 21 | Log.d("Appwrite", result.toString()); 22 | }) 23 | ); 24 | 25 | -------------------------------------------------------------------------------- /docs/examples/java/account/update-session.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.updateSession( 12 | "", // sessionId 13 | new CoroutineCallback<>((result, error) -> { 14 | if (error != null) { 15 | error.printStackTrace(); 16 | return; 17 | } 18 | 19 | Log.d("Appwrite", result.toString()); 20 | }) 21 | ); 22 | 23 | -------------------------------------------------------------------------------- /docs/examples/java/account/update-status.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.updateStatus(new CoroutineCallback<>((result, error) -> { 12 | if (error != null) { 13 | error.printStackTrace(); 14 | return; 15 | } 16 | 17 | Log.d("Appwrite", result.toString()); 18 | })); 19 | -------------------------------------------------------------------------------- /docs/examples/java/account/update-verification.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Account; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Account account = new Account(client); 10 | 11 | account.updateVerification( 12 | "", // userId 13 | "", // secret 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/avatars/get-browser.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Avatars; 4 | import io.appwrite.enums.Browser; 5 | 6 | Client client = new Client(context) 7 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 8 | .setProject(""); // Your project ID 9 | 10 | Avatars avatars = new Avatars(client); 11 | 12 | avatars.getBrowser( 13 | Browser.AVANT_BROWSER, // code 14 | 0, // width (optional) 15 | 0, // height (optional) 16 | -1, // quality (optional) 17 | new CoroutineCallback<>((result, error) -> { 18 | if (error != null) { 19 | error.printStackTrace(); 20 | return; 21 | } 22 | 23 | Log.d("Appwrite", result.toString()); 24 | }) 25 | ); 26 | 27 | -------------------------------------------------------------------------------- /docs/examples/java/avatars/get-credit-card.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Avatars; 4 | import io.appwrite.enums.CreditCard; 5 | 6 | Client client = new Client(context) 7 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 8 | .setProject(""); // Your project ID 9 | 10 | Avatars avatars = new Avatars(client); 11 | 12 | avatars.getCreditCard( 13 | CreditCard.AMERICAN_EXPRESS, // code 14 | 0, // width (optional) 15 | 0, // height (optional) 16 | -1, // quality (optional) 17 | new CoroutineCallback<>((result, error) -> { 18 | if (error != null) { 19 | error.printStackTrace(); 20 | return; 21 | } 22 | 23 | Log.d("Appwrite", result.toString()); 24 | }) 25 | ); 26 | 27 | -------------------------------------------------------------------------------- /docs/examples/java/avatars/get-favicon.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Avatars; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Avatars avatars = new Avatars(client); 10 | 11 | avatars.getFavicon( 12 | "https://example.com", // url 13 | new CoroutineCallback<>((result, error) -> { 14 | if (error != null) { 15 | error.printStackTrace(); 16 | return; 17 | } 18 | 19 | Log.d("Appwrite", result.toString()); 20 | }) 21 | ); 22 | 23 | -------------------------------------------------------------------------------- /docs/examples/java/avatars/get-flag.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Avatars; 4 | import io.appwrite.enums.Flag; 5 | 6 | Client client = new Client(context) 7 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 8 | .setProject(""); // Your project ID 9 | 10 | Avatars avatars = new Avatars(client); 11 | 12 | avatars.getFlag( 13 | Flag.AFGHANISTAN, // code 14 | 0, // width (optional) 15 | 0, // height (optional) 16 | -1, // quality (optional) 17 | new CoroutineCallback<>((result, error) -> { 18 | if (error != null) { 19 | error.printStackTrace(); 20 | return; 21 | } 22 | 23 | Log.d("Appwrite", result.toString()); 24 | }) 25 | ); 26 | 27 | -------------------------------------------------------------------------------- /docs/examples/java/avatars/get-image.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Avatars; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Avatars avatars = new Avatars(client); 10 | 11 | avatars.getImage( 12 | "https://example.com", // url 13 | 0, // width (optional) 14 | 0, // height (optional) 15 | new CoroutineCallback<>((result, error) -> { 16 | if (error != null) { 17 | error.printStackTrace(); 18 | return; 19 | } 20 | 21 | Log.d("Appwrite", result.toString()); 22 | }) 23 | ); 24 | 25 | -------------------------------------------------------------------------------- /docs/examples/java/avatars/get-initials.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Avatars; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Avatars avatars = new Avatars(client); 10 | 11 | avatars.getInitials( 12 | "", // name (optional) 13 | 0, // width (optional) 14 | 0, // height (optional) 15 | "", // background (optional) 16 | new CoroutineCallback<>((result, error) -> { 17 | if (error != null) { 18 | error.printStackTrace(); 19 | return; 20 | } 21 | 22 | Log.d("Appwrite", result.toString()); 23 | }) 24 | ); 25 | 26 | -------------------------------------------------------------------------------- /docs/examples/java/avatars/get-q-r.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Avatars; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Avatars avatars = new Avatars(client); 10 | 11 | avatars.getQR( 12 | "", // text 13 | 1, // size (optional) 14 | 0, // margin (optional) 15 | false, // download (optional) 16 | new CoroutineCallback<>((result, error) -> { 17 | if (error != null) { 18 | error.printStackTrace(); 19 | return; 20 | } 21 | 22 | Log.d("Appwrite", result.toString()); 23 | }) 24 | ); 25 | 26 | -------------------------------------------------------------------------------- /docs/examples/java/databases/create-document.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Databases; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setSession("") // The user session to authenticate with 8 | .setKey("") // 9 | .setJWT(""); // Your secret JSON Web Token 10 | 11 | Databases databases = new Databases(client); 12 | 13 | databases.createDocument( 14 | "", // databaseId 15 | "", // collectionId 16 | "", // documentId 17 | mapOf( "a" to "b" ), // data 18 | listOf("read("any")"), // permissions (optional) 19 | new CoroutineCallback<>((result, error) -> { 20 | if (error != null) { 21 | error.printStackTrace(); 22 | return; 23 | } 24 | 25 | Log.d("Appwrite", result.toString()); 26 | }) 27 | ); 28 | 29 | -------------------------------------------------------------------------------- /docs/examples/java/databases/delete-document.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Databases; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Databases databases = new Databases(client); 10 | 11 | databases.deleteDocument( 12 | "", // databaseId 13 | "", // collectionId 14 | "", // documentId 15 | new CoroutineCallback<>((result, error) -> { 16 | if (error != null) { 17 | error.printStackTrace(); 18 | return; 19 | } 20 | 21 | Log.d("Appwrite", result.toString()); 22 | }) 23 | ); 24 | 25 | -------------------------------------------------------------------------------- /docs/examples/java/databases/get-document.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Databases; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Databases databases = new Databases(client); 10 | 11 | databases.getDocument( 12 | "", // databaseId 13 | "", // collectionId 14 | "", // documentId 15 | listOf(), // queries (optional) 16 | new CoroutineCallback<>((result, error) -> { 17 | if (error != null) { 18 | error.printStackTrace(); 19 | return; 20 | } 21 | 22 | Log.d("Appwrite", result.toString()); 23 | }) 24 | ); 25 | 26 | -------------------------------------------------------------------------------- /docs/examples/java/databases/list-documents.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Databases; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Databases databases = new Databases(client); 10 | 11 | databases.listDocuments( 12 | "", // databaseId 13 | "", // collectionId 14 | listOf(), // queries (optional) 15 | new CoroutineCallback<>((result, error) -> { 16 | if (error != null) { 17 | error.printStackTrace(); 18 | return; 19 | } 20 | 21 | Log.d("Appwrite", result.toString()); 22 | }) 23 | ); 24 | 25 | -------------------------------------------------------------------------------- /docs/examples/java/databases/update-document.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Databases; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Databases databases = new Databases(client); 10 | 11 | databases.updateDocument( 12 | "", // databaseId 13 | "", // collectionId 14 | "", // documentId 15 | mapOf( "a" to "b" ), // data (optional) 16 | listOf("read("any")"), // permissions (optional) 17 | new CoroutineCallback<>((result, error) -> { 18 | if (error != null) { 19 | error.printStackTrace(); 20 | return; 21 | } 22 | 23 | Log.d("Appwrite", result.toString()); 24 | }) 25 | ); 26 | 27 | -------------------------------------------------------------------------------- /docs/examples/java/databases/upsert-document.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Databases; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Databases databases = new Databases(client); 10 | 11 | databases.upsertDocument( 12 | "", // databaseId 13 | "", // collectionId 14 | "", // documentId 15 | mapOf( "a" to "b" ), // data 16 | listOf("read("any")"), // permissions (optional) 17 | new CoroutineCallback<>((result, error) -> { 18 | if (error != null) { 19 | error.printStackTrace(); 20 | return; 21 | } 22 | 23 | Log.d("Appwrite", result.toString()); 24 | }) 25 | ); 26 | 27 | -------------------------------------------------------------------------------- /docs/examples/java/functions/create-execution.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Functions; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Functions functions = new Functions(client); 10 | 11 | functions.createExecution( 12 | "", // functionId 13 | "", // body (optional) 14 | false, // async (optional) 15 | "", // path (optional) 16 | ExecutionMethod.GET, // method (optional) 17 | mapOf( "a" to "b" ), // headers (optional) 18 | "", // scheduledAt (optional) 19 | new CoroutineCallback<>((result, error) -> { 20 | if (error != null) { 21 | error.printStackTrace(); 22 | return; 23 | } 24 | 25 | Log.d("Appwrite", result.toString()); 26 | }) 27 | ); 28 | 29 | -------------------------------------------------------------------------------- /docs/examples/java/functions/get-execution.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Functions; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Functions functions = new Functions(client); 10 | 11 | functions.getExecution( 12 | "", // functionId 13 | "", // executionId 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/functions/list-executions.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Functions; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Functions functions = new Functions(client); 10 | 11 | functions.listExecutions( 12 | "", // functionId 13 | listOf(), // queries (optional) 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/graphql/mutation.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Graphql; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Graphql graphql = new Graphql(client); 10 | 11 | graphql.mutation( 12 | mapOf( "a" to "b" ), // query 13 | new CoroutineCallback<>((result, error) -> { 14 | if (error != null) { 15 | error.printStackTrace(); 16 | return; 17 | } 18 | 19 | Log.d("Appwrite", result.toString()); 20 | }) 21 | ); 22 | 23 | -------------------------------------------------------------------------------- /docs/examples/java/graphql/query.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Graphql; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Graphql graphql = new Graphql(client); 10 | 11 | graphql.query( 12 | mapOf( "a" to "b" ), // query 13 | new CoroutineCallback<>((result, error) -> { 14 | if (error != null) { 15 | error.printStackTrace(); 16 | return; 17 | } 18 | 19 | Log.d("Appwrite", result.toString()); 20 | }) 21 | ); 22 | 23 | -------------------------------------------------------------------------------- /docs/examples/java/locale/get.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Locale; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Locale locale = new Locale(client); 10 | 11 | locale.get(new CoroutineCallback<>((result, error) -> { 12 | if (error != null) { 13 | error.printStackTrace(); 14 | return; 15 | } 16 | 17 | Log.d("Appwrite", result.toString()); 18 | })); 19 | -------------------------------------------------------------------------------- /docs/examples/java/locale/list-codes.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Locale; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Locale locale = new Locale(client); 10 | 11 | locale.listCodes(new CoroutineCallback<>((result, error) -> { 12 | if (error != null) { 13 | error.printStackTrace(); 14 | return; 15 | } 16 | 17 | Log.d("Appwrite", result.toString()); 18 | })); 19 | -------------------------------------------------------------------------------- /docs/examples/java/locale/list-continents.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Locale; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Locale locale = new Locale(client); 10 | 11 | locale.listContinents(new CoroutineCallback<>((result, error) -> { 12 | if (error != null) { 13 | error.printStackTrace(); 14 | return; 15 | } 16 | 17 | Log.d("Appwrite", result.toString()); 18 | })); 19 | -------------------------------------------------------------------------------- /docs/examples/java/locale/list-countries-e-u.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Locale; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Locale locale = new Locale(client); 10 | 11 | locale.listCountriesEU(new CoroutineCallback<>((result, error) -> { 12 | if (error != null) { 13 | error.printStackTrace(); 14 | return; 15 | } 16 | 17 | Log.d("Appwrite", result.toString()); 18 | })); 19 | -------------------------------------------------------------------------------- /docs/examples/java/locale/list-countries-phones.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Locale; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Locale locale = new Locale(client); 10 | 11 | locale.listCountriesPhones(new CoroutineCallback<>((result, error) -> { 12 | if (error != null) { 13 | error.printStackTrace(); 14 | return; 15 | } 16 | 17 | Log.d("Appwrite", result.toString()); 18 | })); 19 | -------------------------------------------------------------------------------- /docs/examples/java/locale/list-countries.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Locale; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Locale locale = new Locale(client); 10 | 11 | locale.listCountries(new CoroutineCallback<>((result, error) -> { 12 | if (error != null) { 13 | error.printStackTrace(); 14 | return; 15 | } 16 | 17 | Log.d("Appwrite", result.toString()); 18 | })); 19 | -------------------------------------------------------------------------------- /docs/examples/java/locale/list-currencies.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Locale; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Locale locale = new Locale(client); 10 | 11 | locale.listCurrencies(new CoroutineCallback<>((result, error) -> { 12 | if (error != null) { 13 | error.printStackTrace(); 14 | return; 15 | } 16 | 17 | Log.d("Appwrite", result.toString()); 18 | })); 19 | -------------------------------------------------------------------------------- /docs/examples/java/locale/list-languages.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Locale; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Locale locale = new Locale(client); 10 | 11 | locale.listLanguages(new CoroutineCallback<>((result, error) -> { 12 | if (error != null) { 13 | error.printStackTrace(); 14 | return; 15 | } 16 | 17 | Log.d("Appwrite", result.toString()); 18 | })); 19 | -------------------------------------------------------------------------------- /docs/examples/java/messaging/create-subscriber.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Messaging; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Messaging messaging = new Messaging(client); 10 | 11 | messaging.createSubscriber( 12 | "", // topicId 13 | "", // subscriberId 14 | "", // targetId 15 | new CoroutineCallback<>((result, error) -> { 16 | if (error != null) { 17 | error.printStackTrace(); 18 | return; 19 | } 20 | 21 | Log.d("Appwrite", result.toString()); 22 | }) 23 | ); 24 | 25 | -------------------------------------------------------------------------------- /docs/examples/java/messaging/delete-subscriber.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Messaging; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Messaging messaging = new Messaging(client); 10 | 11 | messaging.deleteSubscriber( 12 | "", // topicId 13 | "", // subscriberId 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/storage/create-file.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.models.InputFile; 4 | import io.appwrite.services.Storage; 5 | 6 | Client client = new Client(context) 7 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 8 | .setProject(""); // Your project ID 9 | 10 | Storage storage = new Storage(client); 11 | 12 | storage.createFile( 13 | "", // bucketId 14 | "", // fileId 15 | InputFile.fromPath("file.png"), // file 16 | listOf("read("any")"), // permissions (optional) 17 | new CoroutineCallback<>((result, error) -> { 18 | if (error != null) { 19 | error.printStackTrace(); 20 | return; 21 | } 22 | 23 | Log.d("Appwrite", result.toString()); 24 | }) 25 | ); 26 | 27 | -------------------------------------------------------------------------------- /docs/examples/java/storage/delete-file.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Storage; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Storage storage = new Storage(client); 10 | 11 | storage.deleteFile( 12 | "", // bucketId 13 | "", // fileId 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/storage/get-file-download.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Storage; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Storage storage = new Storage(client); 10 | 11 | storage.getFileDownload( 12 | "", // bucketId 13 | "", // fileId 14 | "", // token (optional) 15 | new CoroutineCallback<>((result, error) -> { 16 | if (error != null) { 17 | error.printStackTrace(); 18 | return; 19 | } 20 | 21 | Log.d("Appwrite", result.toString()); 22 | }) 23 | ); 24 | 25 | -------------------------------------------------------------------------------- /docs/examples/java/storage/get-file-preview.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Storage; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Storage storage = new Storage(client); 10 | 11 | storage.getFilePreview( 12 | "", // bucketId 13 | "", // fileId 14 | 0, // width (optional) 15 | 0, // height (optional) 16 | ImageGravity.CENTER, // gravity (optional) 17 | -1, // quality (optional) 18 | 0, // borderWidth (optional) 19 | "", // borderColor (optional) 20 | 0, // borderRadius (optional) 21 | 0, // opacity (optional) 22 | -360, // rotation (optional) 23 | "", // background (optional) 24 | ImageFormat.JPG, // output (optional) 25 | "", // token (optional) 26 | new CoroutineCallback<>((result, error) -> { 27 | if (error != null) { 28 | error.printStackTrace(); 29 | return; 30 | } 31 | 32 | Log.d("Appwrite", result.toString()); 33 | }) 34 | ); 35 | 36 | -------------------------------------------------------------------------------- /docs/examples/java/storage/get-file-view.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Storage; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Storage storage = new Storage(client); 10 | 11 | storage.getFileView( 12 | "", // bucketId 13 | "", // fileId 14 | "", // token (optional) 15 | new CoroutineCallback<>((result, error) -> { 16 | if (error != null) { 17 | error.printStackTrace(); 18 | return; 19 | } 20 | 21 | Log.d("Appwrite", result.toString()); 22 | }) 23 | ); 24 | 25 | -------------------------------------------------------------------------------- /docs/examples/java/storage/get-file.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Storage; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Storage storage = new Storage(client); 10 | 11 | storage.getFile( 12 | "", // bucketId 13 | "", // fileId 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/storage/list-files.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Storage; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Storage storage = new Storage(client); 10 | 11 | storage.listFiles( 12 | "", // bucketId 13 | listOf(), // queries (optional) 14 | "", // search (optional) 15 | new CoroutineCallback<>((result, error) -> { 16 | if (error != null) { 17 | error.printStackTrace(); 18 | return; 19 | } 20 | 21 | Log.d("Appwrite", result.toString()); 22 | }) 23 | ); 24 | 25 | -------------------------------------------------------------------------------- /docs/examples/java/storage/update-file.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Storage; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Storage storage = new Storage(client); 10 | 11 | storage.updateFile( 12 | "", // bucketId 13 | "", // fileId 14 | "", // name (optional) 15 | listOf("read("any")"), // permissions (optional) 16 | new CoroutineCallback<>((result, error) -> { 17 | if (error != null) { 18 | error.printStackTrace(); 19 | return; 20 | } 21 | 22 | Log.d("Appwrite", result.toString()); 23 | }) 24 | ); 25 | 26 | -------------------------------------------------------------------------------- /docs/examples/java/teams/create-membership.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Teams; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Teams teams = new Teams(client); 10 | 11 | teams.createMembership( 12 | "", // teamId 13 | listOf(), // roles 14 | "email@example.com", // email (optional) 15 | "", // userId (optional) 16 | "+12065550100", // phone (optional) 17 | "https://example.com", // url (optional) 18 | "", // name (optional) 19 | new CoroutineCallback<>((result, error) -> { 20 | if (error != null) { 21 | error.printStackTrace(); 22 | return; 23 | } 24 | 25 | Log.d("Appwrite", result.toString()); 26 | }) 27 | ); 28 | 29 | -------------------------------------------------------------------------------- /docs/examples/java/teams/create.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Teams; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Teams teams = new Teams(client); 10 | 11 | teams.create( 12 | "", // teamId 13 | "", // name 14 | listOf(), // roles (optional) 15 | new CoroutineCallback<>((result, error) -> { 16 | if (error != null) { 17 | error.printStackTrace(); 18 | return; 19 | } 20 | 21 | Log.d("Appwrite", result.toString()); 22 | }) 23 | ); 24 | 25 | -------------------------------------------------------------------------------- /docs/examples/java/teams/delete-membership.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Teams; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Teams teams = new Teams(client); 10 | 11 | teams.deleteMembership( 12 | "", // teamId 13 | "", // membershipId 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/teams/delete.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Teams; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Teams teams = new Teams(client); 10 | 11 | teams.delete( 12 | "", // teamId 13 | new CoroutineCallback<>((result, error) -> { 14 | if (error != null) { 15 | error.printStackTrace(); 16 | return; 17 | } 18 | 19 | Log.d("Appwrite", result.toString()); 20 | }) 21 | ); 22 | 23 | -------------------------------------------------------------------------------- /docs/examples/java/teams/get-membership.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Teams; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Teams teams = new Teams(client); 10 | 11 | teams.getMembership( 12 | "", // teamId 13 | "", // membershipId 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/teams/get-prefs.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Teams; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Teams teams = new Teams(client); 10 | 11 | teams.getPrefs( 12 | "", // teamId 13 | new CoroutineCallback<>((result, error) -> { 14 | if (error != null) { 15 | error.printStackTrace(); 16 | return; 17 | } 18 | 19 | Log.d("Appwrite", result.toString()); 20 | }) 21 | ); 22 | 23 | -------------------------------------------------------------------------------- /docs/examples/java/teams/get.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Teams; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Teams teams = new Teams(client); 10 | 11 | teams.get( 12 | "", // teamId 13 | new CoroutineCallback<>((result, error) -> { 14 | if (error != null) { 15 | error.printStackTrace(); 16 | return; 17 | } 18 | 19 | Log.d("Appwrite", result.toString()); 20 | }) 21 | ); 22 | 23 | -------------------------------------------------------------------------------- /docs/examples/java/teams/list-memberships.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Teams; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Teams teams = new Teams(client); 10 | 11 | teams.listMemberships( 12 | "", // teamId 13 | listOf(), // queries (optional) 14 | "", // search (optional) 15 | new CoroutineCallback<>((result, error) -> { 16 | if (error != null) { 17 | error.printStackTrace(); 18 | return; 19 | } 20 | 21 | Log.d("Appwrite", result.toString()); 22 | }) 23 | ); 24 | 25 | -------------------------------------------------------------------------------- /docs/examples/java/teams/list.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Teams; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Teams teams = new Teams(client); 10 | 11 | teams.list( 12 | listOf(), // queries (optional) 13 | "", // search (optional) 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/teams/update-membership-status.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Teams; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Teams teams = new Teams(client); 10 | 11 | teams.updateMembershipStatus( 12 | "", // teamId 13 | "", // membershipId 14 | "", // userId 15 | "", // secret 16 | new CoroutineCallback<>((result, error) -> { 17 | if (error != null) { 18 | error.printStackTrace(); 19 | return; 20 | } 21 | 22 | Log.d("Appwrite", result.toString()); 23 | }) 24 | ); 25 | 26 | -------------------------------------------------------------------------------- /docs/examples/java/teams/update-membership.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Teams; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Teams teams = new Teams(client); 10 | 11 | teams.updateMembership( 12 | "", // teamId 13 | "", // membershipId 14 | listOf(), // roles 15 | new CoroutineCallback<>((result, error) -> { 16 | if (error != null) { 17 | error.printStackTrace(); 18 | return; 19 | } 20 | 21 | Log.d("Appwrite", result.toString()); 22 | }) 23 | ); 24 | 25 | -------------------------------------------------------------------------------- /docs/examples/java/teams/update-name.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Teams; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Teams teams = new Teams(client); 10 | 11 | teams.updateName( 12 | "", // teamId 13 | "", // name 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/java/teams/update-prefs.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client; 2 | import io.appwrite.coroutines.CoroutineCallback; 3 | import io.appwrite.services.Teams; 4 | 5 | Client client = new Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject(""); // Your project ID 8 | 9 | Teams teams = new Teams(client); 10 | 11 | teams.updatePrefs( 12 | "", // teamId 13 | mapOf( "a" to "b" ), // prefs 14 | new CoroutineCallback<>((result, error) -> { 15 | if (error != null) { 16 | error.printStackTrace(); 17 | return; 18 | } 19 | 20 | Log.d("Appwrite", result.toString()); 21 | }) 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /docs/examples/kotlin/account/create-anonymous-session.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.createAnonymousSession() 12 | -------------------------------------------------------------------------------- /docs/examples/kotlin/account/create-email-password-session.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.createEmailPasswordSession( 12 | email = "email@example.com", 13 | password = "password", 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/create-email-token.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.createEmailToken( 12 | userId = "", 13 | email = "email@example.com", 14 | phrase = false, // (optional) 15 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/create-j-w-t.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.createJWT() 12 | -------------------------------------------------------------------------------- /docs/examples/kotlin/account/create-magic-u-r-l-token.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.createMagicURLToken( 12 | userId = "", 13 | email = "email@example.com", 14 | url = "https://example.com", // (optional) 15 | phrase = false, // (optional) 16 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/create-mfa-authenticator.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | import io.appwrite.enums.AuthenticatorType 5 | 6 | val client = Client(context) 7 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 8 | .setProject("") // Your project ID 9 | 10 | val account = Account(client) 11 | 12 | val result = account.createMfaAuthenticator( 13 | type = AuthenticatorType.TOTP, 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/create-mfa-challenge.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | import io.appwrite.enums.AuthenticationFactor 5 | 6 | val client = Client(context) 7 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 8 | .setProject("") // Your project ID 9 | 10 | val account = Account(client) 11 | 12 | val result = account.createMfaChallenge( 13 | factor = AuthenticationFactor.EMAIL, 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/create-mfa-recovery-codes.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.createMfaRecoveryCodes() 12 | -------------------------------------------------------------------------------- /docs/examples/kotlin/account/create-o-auth2session.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | import io.appwrite.enums.OAuthProvider 5 | 6 | val client = Client(context) 7 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 8 | .setProject("") // Your project ID 9 | 10 | val account = Account(client) 11 | 12 | account.createOAuth2Session( 13 | provider = OAuthProvider.AMAZON, 14 | success = "https://example.com", // (optional) 15 | failure = "https://example.com", // (optional) 16 | scopes = listOf(), // (optional) 17 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/create-o-auth2token.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | import io.appwrite.enums.OAuthProvider 5 | 6 | val client = Client(context) 7 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 8 | .setProject("") // Your project ID 9 | 10 | val account = Account(client) 11 | 12 | account.createOAuth2Token( 13 | provider = OAuthProvider.AMAZON, 14 | success = "https://example.com", // (optional) 15 | failure = "https://example.com", // (optional) 16 | scopes = listOf(), // (optional) 17 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/create-phone-token.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.createPhoneToken( 12 | userId = "", 13 | phone = "+12065550100", 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/create-phone-verification.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.createPhoneVerification() 12 | -------------------------------------------------------------------------------- /docs/examples/kotlin/account/create-push-target.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.createPushTarget( 12 | targetId = "", 13 | identifier = "", 14 | providerId = "", // (optional) 15 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/create-recovery.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.createRecovery( 12 | email = "email@example.com", 13 | url = "https://example.com", 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/create-session.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.createSession( 12 | userId = "", 13 | secret = "", 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/create-verification.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.createVerification( 12 | url = "https://example.com", 13 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/create.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.create( 12 | userId = "", 13 | email = "email@example.com", 14 | password = "", 15 | name = "", // (optional) 16 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/delete-identity.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.deleteIdentity( 12 | identityId = "", 13 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/delete-mfa-authenticator.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | import io.appwrite.enums.AuthenticatorType 5 | 6 | val client = Client(context) 7 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 8 | .setProject("") // Your project ID 9 | 10 | val account = Account(client) 11 | 12 | val result = account.deleteMfaAuthenticator( 13 | type = AuthenticatorType.TOTP, 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/delete-push-target.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.deletePushTarget( 12 | targetId = "", 13 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/delete-session.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.deleteSession( 12 | sessionId = "", 13 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/delete-sessions.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.deleteSessions() 12 | -------------------------------------------------------------------------------- /docs/examples/kotlin/account/get-mfa-recovery-codes.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.getMfaRecoveryCodes() 12 | -------------------------------------------------------------------------------- /docs/examples/kotlin/account/get-prefs.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.getPrefs() 12 | -------------------------------------------------------------------------------- /docs/examples/kotlin/account/get-session.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.getSession( 12 | sessionId = "", 13 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/get.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.get() 12 | -------------------------------------------------------------------------------- /docs/examples/kotlin/account/list-identities.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.listIdentities( 12 | queries = listOf(), // (optional) 13 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/list-logs.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.listLogs( 12 | queries = listOf(), // (optional) 13 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/list-mfa-factors.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.listMfaFactors() 12 | -------------------------------------------------------------------------------- /docs/examples/kotlin/account/list-sessions.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.listSessions() 12 | -------------------------------------------------------------------------------- /docs/examples/kotlin/account/update-email.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.updateEmail( 12 | email = "email@example.com", 13 | password = "password", 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/update-m-f-a.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.updateMFA( 12 | mfa = false, 13 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/update-magic-u-r-l-session.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.updateMagicURLSession( 12 | userId = "", 13 | secret = "", 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/update-mfa-authenticator.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | import io.appwrite.enums.AuthenticatorType 5 | 6 | val client = Client(context) 7 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 8 | .setProject("") // Your project ID 9 | 10 | val account = Account(client) 11 | 12 | val result = account.updateMfaAuthenticator( 13 | type = AuthenticatorType.TOTP, 14 | otp = "", 15 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/update-mfa-challenge.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.updateMfaChallenge( 12 | challengeId = "", 13 | otp = "", 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/update-mfa-recovery-codes.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.updateMfaRecoveryCodes() 12 | -------------------------------------------------------------------------------- /docs/examples/kotlin/account/update-name.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.updateName( 12 | name = "", 13 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/update-password.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.updatePassword( 12 | password = "", 13 | oldPassword = "password", // (optional) 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/update-phone-session.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.updatePhoneSession( 12 | userId = "", 13 | secret = "", 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/update-phone-verification.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.updatePhoneVerification( 12 | userId = "", 13 | secret = "", 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/update-phone.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.updatePhone( 12 | phone = "+12065550100", 13 | password = "password", 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/update-prefs.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.updatePrefs( 12 | prefs = mapOf( "a" to "b" ), 13 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/update-push-target.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.updatePushTarget( 12 | targetId = "", 13 | identifier = "", 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/update-recovery.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.updateRecovery( 12 | userId = "", 13 | secret = "", 14 | password = "", 15 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/update-session.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.updateSession( 12 | sessionId = "", 13 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/account/update-status.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.updateStatus() 12 | -------------------------------------------------------------------------------- /docs/examples/kotlin/account/update-verification.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Account 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val account = Account(client) 10 | 11 | val result = account.updateVerification( 12 | userId = "", 13 | secret = "", 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/avatars/get-browser.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Avatars 4 | import io.appwrite.enums.Browser 5 | 6 | val client = Client(context) 7 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 8 | .setProject("") // Your project ID 9 | 10 | val avatars = Avatars(client) 11 | 12 | val result = avatars.getBrowser( 13 | code = Browser.AVANT_BROWSER, 14 | width = 0, // (optional) 15 | height = 0, // (optional) 16 | quality = -1, // (optional) 17 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/avatars/get-credit-card.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Avatars 4 | import io.appwrite.enums.CreditCard 5 | 6 | val client = Client(context) 7 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 8 | .setProject("") // Your project ID 9 | 10 | val avatars = Avatars(client) 11 | 12 | val result = avatars.getCreditCard( 13 | code = CreditCard.AMERICAN_EXPRESS, 14 | width = 0, // (optional) 15 | height = 0, // (optional) 16 | quality = -1, // (optional) 17 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/avatars/get-favicon.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Avatars 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val avatars = Avatars(client) 10 | 11 | val result = avatars.getFavicon( 12 | url = "https://example.com", 13 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/avatars/get-flag.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Avatars 4 | import io.appwrite.enums.Flag 5 | 6 | val client = Client(context) 7 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 8 | .setProject("") // Your project ID 9 | 10 | val avatars = Avatars(client) 11 | 12 | val result = avatars.getFlag( 13 | code = Flag.AFGHANISTAN, 14 | width = 0, // (optional) 15 | height = 0, // (optional) 16 | quality = -1, // (optional) 17 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/avatars/get-image.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Avatars 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val avatars = Avatars(client) 10 | 11 | val result = avatars.getImage( 12 | url = "https://example.com", 13 | width = 0, // (optional) 14 | height = 0, // (optional) 15 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/avatars/get-initials.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Avatars 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val avatars = Avatars(client) 10 | 11 | val result = avatars.getInitials( 12 | name = "", // (optional) 13 | width = 0, // (optional) 14 | height = 0, // (optional) 15 | background = "", // (optional) 16 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/avatars/get-q-r.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Avatars 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val avatars = Avatars(client) 10 | 11 | val result = avatars.getQR( 12 | text = "", 13 | size = 1, // (optional) 14 | margin = 0, // (optional) 15 | download = false, // (optional) 16 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/databases/create-document.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Databases 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setSession("") // The user session to authenticate with 8 | .setKey("") // 9 | .setJWT("") // Your secret JSON Web Token 10 | 11 | val databases = Databases(client) 12 | 13 | val result = databases.createDocument( 14 | databaseId = "", 15 | collectionId = "", 16 | documentId = "", 17 | data = mapOf( "a" to "b" ), 18 | permissions = listOf("read("any")"), // (optional) 19 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/databases/delete-document.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Databases 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val databases = Databases(client) 10 | 11 | val result = databases.deleteDocument( 12 | databaseId = "", 13 | collectionId = "", 14 | documentId = "", 15 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/databases/get-document.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Databases 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val databases = Databases(client) 10 | 11 | val result = databases.getDocument( 12 | databaseId = "", 13 | collectionId = "", 14 | documentId = "", 15 | queries = listOf(), // (optional) 16 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/databases/list-documents.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Databases 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val databases = Databases(client) 10 | 11 | val result = databases.listDocuments( 12 | databaseId = "", 13 | collectionId = "", 14 | queries = listOf(), // (optional) 15 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/databases/update-document.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Databases 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val databases = Databases(client) 10 | 11 | val result = databases.updateDocument( 12 | databaseId = "", 13 | collectionId = "", 14 | documentId = "", 15 | data = mapOf( "a" to "b" ), // (optional) 16 | permissions = listOf("read("any")"), // (optional) 17 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/databases/upsert-document.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Databases 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val databases = Databases(client) 10 | 11 | val result = databases.upsertDocument( 12 | databaseId = "", 13 | collectionId = "", 14 | documentId = "", 15 | data = mapOf( "a" to "b" ), 16 | permissions = listOf("read("any")"), // (optional) 17 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/functions/create-execution.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Functions 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val functions = Functions(client) 10 | 11 | val result = functions.createExecution( 12 | functionId = "", 13 | body = "", // (optional) 14 | async = false, // (optional) 15 | path = "", // (optional) 16 | method = ExecutionMethod.GET, // (optional) 17 | headers = mapOf( "a" to "b" ), // (optional) 18 | scheduledAt = "", // (optional) 19 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/functions/get-execution.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Functions 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val functions = Functions(client) 10 | 11 | val result = functions.getExecution( 12 | functionId = "", 13 | executionId = "", 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/functions/list-executions.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Functions 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val functions = Functions(client) 10 | 11 | val result = functions.listExecutions( 12 | functionId = "", 13 | queries = listOf(), // (optional) 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/graphql/mutation.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Graphql 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val graphql = Graphql(client) 10 | 11 | val result = graphql.mutation( 12 | query = mapOf( "a" to "b" ), 13 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/graphql/query.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Graphql 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val graphql = Graphql(client) 10 | 11 | val result = graphql.query( 12 | query = mapOf( "a" to "b" ), 13 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/locale/get.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Locale 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val locale = Locale(client) 10 | 11 | val result = locale.get() 12 | -------------------------------------------------------------------------------- /docs/examples/kotlin/locale/list-codes.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Locale 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val locale = Locale(client) 10 | 11 | val result = locale.listCodes() 12 | -------------------------------------------------------------------------------- /docs/examples/kotlin/locale/list-continents.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Locale 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val locale = Locale(client) 10 | 11 | val result = locale.listContinents() 12 | -------------------------------------------------------------------------------- /docs/examples/kotlin/locale/list-countries-e-u.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Locale 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val locale = Locale(client) 10 | 11 | val result = locale.listCountriesEU() 12 | -------------------------------------------------------------------------------- /docs/examples/kotlin/locale/list-countries-phones.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Locale 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val locale = Locale(client) 10 | 11 | val result = locale.listCountriesPhones() 12 | -------------------------------------------------------------------------------- /docs/examples/kotlin/locale/list-countries.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Locale 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val locale = Locale(client) 10 | 11 | val result = locale.listCountries() 12 | -------------------------------------------------------------------------------- /docs/examples/kotlin/locale/list-currencies.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Locale 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val locale = Locale(client) 10 | 11 | val result = locale.listCurrencies() 12 | -------------------------------------------------------------------------------- /docs/examples/kotlin/locale/list-languages.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Locale 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val locale = Locale(client) 10 | 11 | val result = locale.listLanguages() 12 | -------------------------------------------------------------------------------- /docs/examples/kotlin/messaging/create-subscriber.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Messaging 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val messaging = Messaging(client) 10 | 11 | val result = messaging.createSubscriber( 12 | topicId = "", 13 | subscriberId = "", 14 | targetId = "", 15 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/messaging/delete-subscriber.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Messaging 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val messaging = Messaging(client) 10 | 11 | val result = messaging.deleteSubscriber( 12 | topicId = "", 13 | subscriberId = "", 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/storage/create-file.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.models.InputFile 4 | import io.appwrite.services.Storage 5 | 6 | val client = Client(context) 7 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 8 | .setProject("") // Your project ID 9 | 10 | val storage = Storage(client) 11 | 12 | val result = storage.createFile( 13 | bucketId = "", 14 | fileId = "", 15 | file = InputFile.fromPath("file.png"), 16 | permissions = listOf("read("any")"), // (optional) 17 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/storage/delete-file.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Storage 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val storage = Storage(client) 10 | 11 | val result = storage.deleteFile( 12 | bucketId = "", 13 | fileId = "", 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/storage/get-file-download.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Storage 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val storage = Storage(client) 10 | 11 | val result = storage.getFileDownload( 12 | bucketId = "", 13 | fileId = "", 14 | token = "", // (optional) 15 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/storage/get-file-preview.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Storage 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val storage = Storage(client) 10 | 11 | val result = storage.getFilePreview( 12 | bucketId = "", 13 | fileId = "", 14 | width = 0, // (optional) 15 | height = 0, // (optional) 16 | gravity = ImageGravity.CENTER, // (optional) 17 | quality = -1, // (optional) 18 | borderWidth = 0, // (optional) 19 | borderColor = "", // (optional) 20 | borderRadius = 0, // (optional) 21 | opacity = 0, // (optional) 22 | rotation = -360, // (optional) 23 | background = "", // (optional) 24 | output = ImageFormat.JPG, // (optional) 25 | token = "", // (optional) 26 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/storage/get-file-view.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Storage 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val storage = Storage(client) 10 | 11 | val result = storage.getFileView( 12 | bucketId = "", 13 | fileId = "", 14 | token = "", // (optional) 15 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/storage/get-file.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Storage 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val storage = Storage(client) 10 | 11 | val result = storage.getFile( 12 | bucketId = "", 13 | fileId = "", 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/storage/list-files.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Storage 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val storage = Storage(client) 10 | 11 | val result = storage.listFiles( 12 | bucketId = "", 13 | queries = listOf(), // (optional) 14 | search = "", // (optional) 15 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/storage/update-file.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Storage 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val storage = Storage(client) 10 | 11 | val result = storage.updateFile( 12 | bucketId = "", 13 | fileId = "", 14 | name = "", // (optional) 15 | permissions = listOf("read("any")"), // (optional) 16 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/teams/create-membership.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Teams 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val teams = Teams(client) 10 | 11 | val result = teams.createMembership( 12 | teamId = "", 13 | roles = listOf(), 14 | email = "email@example.com", // (optional) 15 | userId = "", // (optional) 16 | phone = "+12065550100", // (optional) 17 | url = "https://example.com", // (optional) 18 | name = "", // (optional) 19 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/teams/create.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Teams 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val teams = Teams(client) 10 | 11 | val result = teams.create( 12 | teamId = "", 13 | name = "", 14 | roles = listOf(), // (optional) 15 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/teams/delete-membership.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Teams 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val teams = Teams(client) 10 | 11 | val result = teams.deleteMembership( 12 | teamId = "", 13 | membershipId = "", 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/teams/delete.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Teams 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val teams = Teams(client) 10 | 11 | val result = teams.delete( 12 | teamId = "", 13 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/teams/get-membership.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Teams 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val teams = Teams(client) 10 | 11 | val result = teams.getMembership( 12 | teamId = "", 13 | membershipId = "", 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/teams/get-prefs.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Teams 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val teams = Teams(client) 10 | 11 | val result = teams.getPrefs( 12 | teamId = "", 13 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/teams/get.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Teams 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val teams = Teams(client) 10 | 11 | val result = teams.get( 12 | teamId = "", 13 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/teams/list-memberships.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Teams 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val teams = Teams(client) 10 | 11 | val result = teams.listMemberships( 12 | teamId = "", 13 | queries = listOf(), // (optional) 14 | search = "", // (optional) 15 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/teams/list.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Teams 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val teams = Teams(client) 10 | 11 | val result = teams.list( 12 | queries = listOf(), // (optional) 13 | search = "", // (optional) 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/teams/update-membership-status.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Teams 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val teams = Teams(client) 10 | 11 | val result = teams.updateMembershipStatus( 12 | teamId = "", 13 | membershipId = "", 14 | userId = "", 15 | secret = "", 16 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/teams/update-membership.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Teams 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val teams = Teams(client) 10 | 11 | val result = teams.updateMembership( 12 | teamId = "", 13 | membershipId = "", 14 | roles = listOf(), 15 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/teams/update-name.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Teams 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val teams = Teams(client) 10 | 11 | val result = teams.updateName( 12 | teamId = "", 13 | name = "", 14 | ) -------------------------------------------------------------------------------- /docs/examples/kotlin/teams/update-prefs.md: -------------------------------------------------------------------------------- 1 | import io.appwrite.Client 2 | import io.appwrite.coroutines.CoroutineCallback 3 | import io.appwrite.services.Teams 4 | 5 | val client = Client(context) 6 | .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint 7 | .setProject("") // Your project ID 8 | 9 | val teams = Teams(client) 10 | 11 | val result = teams.updatePrefs( 12 | teamId = "", 13 | prefs = mapOf( "a" to "b" ), 14 | ) -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /example/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/src/main/java/io/appwrite/android/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.android 2 | 3 | import androidx.appcompat.app.AppCompatActivity 4 | import android.os.Bundle 5 | import androidx.fragment.app.add 6 | import androidx.fragment.app.commit 7 | import io.appwrite.android.ui.accounts.AccountsFragment 8 | import io.appwrite.android.utils.Client 9 | 10 | class MainActivity : AppCompatActivity() { 11 | override fun onCreate(savedInstanceState: Bundle?) { 12 | super.onCreate(savedInstanceState) 13 | setContentView(R.layout.activity_main) 14 | Client.create(applicationContext) 15 | 16 | if (savedInstanceState == null) { 17 | supportFragmentManager.commit { 18 | setReorderingAllowed(true) 19 | add(R.id.fragment_container_view) 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /example/src/main/java/io/appwrite/android/services/MessagingService.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.android.services 2 | 3 | import com.google.firebase.messaging.FirebaseMessagingService 4 | import io.appwrite.ID 5 | import io.appwrite.services.Account 6 | import kotlinx.coroutines.runBlocking 7 | 8 | class MessagingService : FirebaseMessagingService() { 9 | 10 | companion object { 11 | var account: Account? = null 12 | } 13 | 14 | override fun onNewToken(token: String) { 15 | super.onNewToken(token) 16 | 17 | val prefs = getSharedPreferences("example", MODE_PRIVATE) 18 | 19 | prefs.edit().putString("fcmToken", token).apply() 20 | 21 | if (account == null) { 22 | return 23 | } 24 | 25 | val targetId = prefs.getString("targetId", null) 26 | 27 | runBlocking { 28 | if (targetId == null) { 29 | val target = account!!.createPushTarget(ID.unique(), token) 30 | 31 | prefs.edit().putString("targetId", target.id).apply() 32 | } else { 33 | account!!.updatePushTarget(targetId, token) 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /example/src/main/java/io/appwrite/android/utils/Client.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.android.utils 2 | 3 | import android.content.Context 4 | import io.appwrite.Client 5 | 6 | object Client { 7 | lateinit var client : Client 8 | 9 | fun create(context: Context) { 10 | client = Client(context) 11 | .setEndpoint("https://.cloud.appwrite.io/v1") 12 | .setProject("65a8e2b4632c04b1f5da") 13 | .setSelfSigned(true) 14 | } 15 | } -------------------------------------------------------------------------------- /example/src/main/java/io/appwrite/android/utils/Event.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.android.utils 2 | 3 | /** 4 | * Used as a wrapper for data that is exposed via a LiveData that represents an event. 5 | */ 6 | open class Event(private val content: T) { 7 | 8 | var hasBeenHandled = false 9 | private set // Allow external read but not write 10 | 11 | /** 12 | * Returns the content and prevents its use again. 13 | */ 14 | fun getContentIfNotHandled(): T? { 15 | return if (hasBeenHandled) { 16 | null 17 | } else { 18 | hasBeenHandled = true 19 | content 20 | } 21 | } 22 | 23 | /** 24 | * Returns the content, even if it's already been handled. 25 | */ 26 | fun peekContent(): T = content 27 | } 28 | -------------------------------------------------------------------------------- /example/src/main/res/drawable/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /example/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /example/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | -------------------------------------------------------------------------------- /example/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Appwrite Android SDK 3 | -------------------------------------------------------------------------------- /example/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Kotlin code style for this project: "official" or "obsolete": 19 | kotlin.code.style=official -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/appwrite/sdk-for-android/7b1cb56855426b85b53fc64fea4d967c7003f19c/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Jun 01 15:55:54 IST 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /library/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/ID.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite 2 | 3 | import java.time.Instant 4 | import kotlin.math.floor 5 | import kotlin.random.Random 6 | 7 | /** 8 | * Helper class to generate ID strings for resources. 9 | */ 10 | class ID { 11 | companion object { 12 | // Generate an hex ID based on timestamp 13 | // Recreated from https://www.php.net/manual/en/function.uniqid.php 14 | private fun hexTimestamp(): String { 15 | val now = Instant.now() 16 | val sec = now.epochSecond 17 | val usec = (System.nanoTime() / 1000) % 1000 18 | 19 | val hexTimestamp = "%08x%05x".format(sec, usec) 20 | 21 | return hexTimestamp 22 | } 23 | 24 | fun custom(id: String): String 25 | = id 26 | 27 | /** 28 | * Generate a unique ID with padding to have a longer ID 29 | * 30 | * @param padding The number of characters to add to the ID 31 | * @returns The unique ID 32 | */ 33 | fun unique(padding: Int = 7): String { 34 | val baseId = hexTimestamp() 35 | val randomPadding = (1..padding) 36 | .map { Random.nextInt(0, 16).toString(16) } 37 | .joinToString("") 38 | 39 | return baseId + randomPadding 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/KeepAliveService.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.services 2 | 3 | import android.app.Service 4 | import android.content.Intent 5 | import android.os.Binder 6 | import android.os.IBinder 7 | 8 | internal class KeepAliveService: Service() { 9 | companion object { 10 | val binder = Binder() 11 | } 12 | 13 | override fun onBind(intent: Intent) = binder 14 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/Service.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite 2 | 3 | import io.appwrite.Client 4 | 5 | /** 6 | * Abstract class for services. 7 | * 8 | * @param client The Appwrite client. 9 | */ 10 | abstract class Service(val client: Client) 11 | -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/cookies/Extensions.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.cookies 2 | 3 | import android.os.Build 4 | import java.net.CookieStore 5 | import java.net.HttpCookie 6 | import java.text.SimpleDateFormat 7 | import java.util.Calendar 8 | import java.util.Locale 9 | import java.util.TimeZone 10 | 11 | fun HttpCookie.toSetCookieString(): String { 12 | val expires = if (maxAge != -1L) { 13 | val dateFormat = SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.UK).apply { 14 | timeZone = TimeZone.getTimeZone("GMT") 15 | } 16 | 17 | val calendar = Calendar.getInstance(Locale.UK).apply { set(Calendar.SECOND, maxAge.toInt()) } 18 | 19 | "; expires=${dateFormat.format(calendar.time)}" 20 | } else { 21 | "" 22 | } 23 | 24 | val path = if (path != null) "; path=$path" else "" 25 | val domain = if (domain != null) "; domain=$domain" else "" 26 | val secure = if (secure) "; secure" else "" 27 | val httpOnly = if (Build.VERSION.SDK_INT >= 24) { 28 | if (isHttpOnly) "; httponly" else "" 29 | } else { 30 | "" 31 | } 32 | 33 | return "$name=$value$expires$path$domain$secure$httpOnly" 34 | } 35 | 36 | @Synchronized 37 | fun CookieStore.syncToWebKitCookieManager() { 38 | val webKitCookieManager = android.webkit.CookieManager.getInstance() 39 | 40 | cookies.forEach { 41 | val hostUrl = "${if (it.secure) "https" else "http"}://${it.domain}" 42 | webKitCookieManager.setCookie(hostUrl, it.toSetCookieString()) 43 | } 44 | 45 | webKitCookieManager.flush() 46 | } 47 | 48 | @Synchronized 49 | @Suppress("DEPRECATION") 50 | fun android.webkit.CookieManager.removeAll() { 51 | removeAllCookies(null) 52 | flush() 53 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/cookies/InternalCookie.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.cookies 2 | 3 | import android.os.Build 4 | import java.net.HttpCookie 5 | 6 | data class InternalCookie( 7 | val comment: String?, 8 | val commentURL: String?, 9 | val discard: Boolean?, 10 | val domain: String, 11 | val maxAge: Long?, 12 | val name: String, 13 | val path: String?, 14 | val portlist: String?, 15 | val secure: Boolean?, 16 | val value: String, 17 | val version: Int?, 18 | var httpOnly: Boolean? = null 19 | ) { 20 | constructor(cookie: HttpCookie) : this( 21 | cookie.comment, 22 | cookie.commentURL, 23 | cookie.discard, 24 | cookie.domain, 25 | cookie.maxAge, 26 | cookie.name, 27 | cookie.path, 28 | cookie.portlist, 29 | cookie.secure, 30 | cookie.value, 31 | cookie.version 32 | ) 33 | 34 | fun toHttpCookie() = HttpCookie(name, value).apply { 35 | comment = this@InternalCookie.comment 36 | commentURL = this@InternalCookie.commentURL 37 | discard = this@InternalCookie.discard == true 38 | domain = this@InternalCookie.domain 39 | maxAge = this@InternalCookie.maxAge ?: 0 40 | path = this@InternalCookie.path 41 | portlist = this@InternalCookie.portlist 42 | secure = this@InternalCookie.secure == true 43 | version = this@InternalCookie.version ?: 0 44 | 45 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { 46 | isHttpOnly = (this@InternalCookie.httpOnly == true) 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/coroutines/Callback.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.coroutines 2 | 3 | import kotlinx.coroutines.Dispatchers 4 | import kotlin.coroutines.Continuation 5 | import kotlin.coroutines.CoroutineContext 6 | 7 | interface Callback { 8 | fun onComplete(result: T?, error: Throwable?) 9 | } 10 | 11 | class CoroutineCallback @JvmOverloads constructor( 12 | private val callback: Callback, 13 | override val context: CoroutineContext = Dispatchers.Default 14 | ) : Continuation { 15 | override fun resumeWith(result: Result) { 16 | callback.onComplete(result.getOrNull(), result.exceptionOrNull()) 17 | } 18 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/enums/AuthenticationFactor.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.enums 2 | 3 | import com.google.gson.annotations.SerializedName 4 | 5 | enum class AuthenticationFactor(val value: String) { 6 | @SerializedName("email") 7 | EMAIL("email"), 8 | @SerializedName("phone") 9 | PHONE("phone"), 10 | @SerializedName("totp") 11 | TOTP("totp"), 12 | @SerializedName("recoverycode") 13 | RECOVERYCODE("recoverycode"); 14 | 15 | override fun toString() = value 16 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/enums/AuthenticatorType.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.enums 2 | 3 | import com.google.gson.annotations.SerializedName 4 | 5 | enum class AuthenticatorType(val value: String) { 6 | @SerializedName("totp") 7 | TOTP("totp"); 8 | 9 | override fun toString() = value 10 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/enums/Browser.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.enums 2 | 3 | import com.google.gson.annotations.SerializedName 4 | 5 | enum class Browser(val value: String) { 6 | @SerializedName("aa") 7 | AVANT_BROWSER("aa"), 8 | @SerializedName("an") 9 | ANDROID_WEBVIEW_BETA("an"), 10 | @SerializedName("ch") 11 | GOOGLE_CHROME("ch"), 12 | @SerializedName("ci") 13 | GOOGLE_CHROME_IOS("ci"), 14 | @SerializedName("cm") 15 | GOOGLE_CHROME_MOBILE("cm"), 16 | @SerializedName("cr") 17 | CHROMIUM("cr"), 18 | @SerializedName("ff") 19 | MOZILLA_FIREFOX("ff"), 20 | @SerializedName("sf") 21 | SAFARI("sf"), 22 | @SerializedName("mf") 23 | MOBILE_SAFARI("mf"), 24 | @SerializedName("ps") 25 | MICROSOFT_EDGE("ps"), 26 | @SerializedName("oi") 27 | MICROSOFT_EDGE_IOS("oi"), 28 | @SerializedName("om") 29 | OPERA_MINI("om"), 30 | @SerializedName("op") 31 | OPERA("op"), 32 | @SerializedName("on") 33 | OPERA_NEXT("on"); 34 | 35 | override fun toString() = value 36 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/enums/CreditCard.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.enums 2 | 3 | import com.google.gson.annotations.SerializedName 4 | 5 | enum class CreditCard(val value: String) { 6 | @SerializedName("amex") 7 | AMERICAN_EXPRESS("amex"), 8 | @SerializedName("argencard") 9 | ARGENCARD("argencard"), 10 | @SerializedName("cabal") 11 | CABAL("cabal"), 12 | @SerializedName("cencosud") 13 | CENCOSUD("cencosud"), 14 | @SerializedName("diners") 15 | DINERS_CLUB("diners"), 16 | @SerializedName("discover") 17 | DISCOVER("discover"), 18 | @SerializedName("elo") 19 | ELO("elo"), 20 | @SerializedName("hipercard") 21 | HIPERCARD("hipercard"), 22 | @SerializedName("jcb") 23 | JCB("jcb"), 24 | @SerializedName("mastercard") 25 | MASTERCARD("mastercard"), 26 | @SerializedName("naranja") 27 | NARANJA("naranja"), 28 | @SerializedName("targeta-shopping") 29 | TARJETA_SHOPPING("targeta-shopping"), 30 | @SerializedName("union-china-pay") 31 | UNION_CHINA_PAY("union-china-pay"), 32 | @SerializedName("visa") 33 | VISA("visa"), 34 | @SerializedName("mir") 35 | MIR("mir"), 36 | @SerializedName("maestro") 37 | MAESTRO("maestro"), 38 | @SerializedName("rupay") 39 | RUPAY("rupay"); 40 | 41 | override fun toString() = value 42 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/enums/ExecutionMethod.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.enums 2 | 3 | import com.google.gson.annotations.SerializedName 4 | 5 | enum class ExecutionMethod(val value: String) { 6 | @SerializedName("GET") 7 | GET("GET"), 8 | @SerializedName("POST") 9 | POST("POST"), 10 | @SerializedName("PUT") 11 | PUT("PUT"), 12 | @SerializedName("PATCH") 13 | PATCH("PATCH"), 14 | @SerializedName("DELETE") 15 | DELETE("DELETE"), 16 | @SerializedName("OPTIONS") 17 | OPTIONS("OPTIONS"); 18 | 19 | override fun toString() = value 20 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/enums/ImageFormat.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.enums 2 | 3 | import com.google.gson.annotations.SerializedName 4 | 5 | enum class ImageFormat(val value: String) { 6 | @SerializedName("jpg") 7 | JPG("jpg"), 8 | @SerializedName("jpeg") 9 | JPEG("jpeg"), 10 | @SerializedName("png") 11 | PNG("png"), 12 | @SerializedName("webp") 13 | WEBP("webp"), 14 | @SerializedName("heic") 15 | HEIC("heic"), 16 | @SerializedName("avif") 17 | AVIF("avif"); 18 | 19 | override fun toString() = value 20 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/enums/ImageGravity.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.enums 2 | 3 | import com.google.gson.annotations.SerializedName 4 | 5 | enum class ImageGravity(val value: String) { 6 | @SerializedName("center") 7 | CENTER("center"), 8 | @SerializedName("top-left") 9 | TOP_LEFT("top-left"), 10 | @SerializedName("top") 11 | TOP("top"), 12 | @SerializedName("top-right") 13 | TOP_RIGHT("top-right"), 14 | @SerializedName("left") 15 | LEFT("left"), 16 | @SerializedName("right") 17 | RIGHT("right"), 18 | @SerializedName("bottom-left") 19 | BOTTOM_LEFT("bottom-left"), 20 | @SerializedName("bottom") 21 | BOTTOM("bottom"), 22 | @SerializedName("bottom-right") 23 | BOTTOM_RIGHT("bottom-right"); 24 | 25 | override fun toString() = value 26 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/exceptions/AppwriteException.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.exceptions 2 | 3 | import java.lang.Exception 4 | 5 | class AppwriteException( 6 | override val message: String? = null, 7 | val code: Int? = null, 8 | val type: String? = null, 9 | val response: String? = null 10 | ) : Exception(message) -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/extensions/CollectionExtensions.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.extensions 2 | 3 | import kotlinx.coroutines.Dispatchers.IO 4 | import kotlinx.coroutines.async 5 | import kotlinx.coroutines.awaitAll 6 | import kotlinx.coroutines.withContext 7 | 8 | suspend fun Collection.forEachAsync( 9 | callback: suspend (T) -> Unit 10 | ) = withContext(IO) { 11 | map { async { callback.invoke(it) } }.awaitAll() 12 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/extensions/JsonExtensions.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.extensions 2 | 3 | import com.google.gson.Gson 4 | import com.google.gson.GsonBuilder 5 | import com.google.gson.ToNumberPolicy 6 | import com.google.gson.reflect.TypeToken 7 | 8 | val gson: Gson = GsonBuilder() 9 | .setNumberToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) 10 | .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) 11 | .create() 12 | 13 | fun Any.toJson(): String = 14 | gson.toJson(this) 15 | 16 | fun String.fromJson(clazz: Class): T = 17 | gson.fromJson(this, clazz) 18 | 19 | inline fun String.fromJson(): T = 20 | gson.fromJson(this, T::class.java) 21 | 22 | fun Any.jsonCast(to: Class): T = 23 | toJson().fromJson(to) 24 | 25 | inline fun Any.jsonCast(): T = 26 | toJson().fromJson(T::class.java) 27 | 28 | fun Any.tryJsonCast(to: Class): T? = try { 29 | toJson().fromJson(to) 30 | } catch (ex: Exception) { 31 | ex.printStackTrace() 32 | null 33 | } 34 | 35 | inline fun Any.tryJsonCast(): T? = try { 36 | toJson().fromJson(T::class.java) 37 | } catch (ex: Exception) { 38 | ex.printStackTrace() 39 | null 40 | } 41 | -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/extensions/TypeExtensions.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.extensions 2 | 3 | import kotlin.reflect.KClass 4 | import kotlin.reflect.typeOf 5 | 6 | inline fun classOf(): Class { 7 | @Suppress("UNCHECKED_CAST") 8 | return (typeOf().classifier!! as KClass).java 9 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/AlgoArgon2.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * AlgoArgon2 8 | */ 9 | data class AlgoArgon2( 10 | /** 11 | * Algo type. 12 | */ 13 | @SerializedName("type") 14 | val type: String, 15 | 16 | /** 17 | * Memory used to compute hash. 18 | */ 19 | @SerializedName("memoryCost") 20 | val memoryCost: Long, 21 | 22 | /** 23 | * Amount of time consumed to compute hash 24 | */ 25 | @SerializedName("timeCost") 26 | val timeCost: Long, 27 | 28 | /** 29 | * Number of threads used to compute hash. 30 | */ 31 | @SerializedName("threads") 32 | val threads: Long, 33 | 34 | ) { 35 | fun toMap(): Map = mapOf( 36 | "type" to type as Any, 37 | "memoryCost" to memoryCost as Any, 38 | "timeCost" to timeCost as Any, 39 | "threads" to threads as Any, 40 | ) 41 | 42 | companion object { 43 | 44 | @Suppress("UNCHECKED_CAST") 45 | fun from( 46 | map: Map, 47 | ) = AlgoArgon2( 48 | type = map["type"] as String, 49 | memoryCost = (map["memoryCost"] as Number).toLong(), 50 | timeCost = (map["timeCost"] as Number).toLong(), 51 | threads = (map["threads"] as Number).toLong(), 52 | ) 53 | } 54 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/AlgoBcrypt.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * AlgoBcrypt 8 | */ 9 | data class AlgoBcrypt( 10 | /** 11 | * Algo type. 12 | */ 13 | @SerializedName("type") 14 | val type: String, 15 | 16 | ) { 17 | fun toMap(): Map = mapOf( 18 | "type" to type as Any, 19 | ) 20 | 21 | companion object { 22 | 23 | @Suppress("UNCHECKED_CAST") 24 | fun from( 25 | map: Map, 26 | ) = AlgoBcrypt( 27 | type = map["type"] as String, 28 | ) 29 | } 30 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/AlgoMd5.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * AlgoMD5 8 | */ 9 | data class AlgoMd5( 10 | /** 11 | * Algo type. 12 | */ 13 | @SerializedName("type") 14 | val type: String, 15 | 16 | ) { 17 | fun toMap(): Map = mapOf( 18 | "type" to type as Any, 19 | ) 20 | 21 | companion object { 22 | 23 | @Suppress("UNCHECKED_CAST") 24 | fun from( 25 | map: Map, 26 | ) = AlgoMd5( 27 | type = map["type"] as String, 28 | ) 29 | } 30 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/AlgoPhpass.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * AlgoPHPass 8 | */ 9 | data class AlgoPhpass( 10 | /** 11 | * Algo type. 12 | */ 13 | @SerializedName("type") 14 | val type: String, 15 | 16 | ) { 17 | fun toMap(): Map = mapOf( 18 | "type" to type as Any, 19 | ) 20 | 21 | companion object { 22 | 23 | @Suppress("UNCHECKED_CAST") 24 | fun from( 25 | map: Map, 26 | ) = AlgoPhpass( 27 | type = map["type"] as String, 28 | ) 29 | } 30 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/AlgoScrypt.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * AlgoScrypt 8 | */ 9 | data class AlgoScrypt( 10 | /** 11 | * Algo type. 12 | */ 13 | @SerializedName("type") 14 | val type: String, 15 | 16 | /** 17 | * CPU complexity of computed hash. 18 | */ 19 | @SerializedName("costCpu") 20 | val costCpu: Long, 21 | 22 | /** 23 | * Memory complexity of computed hash. 24 | */ 25 | @SerializedName("costMemory") 26 | val costMemory: Long, 27 | 28 | /** 29 | * Parallelization of computed hash. 30 | */ 31 | @SerializedName("costParallel") 32 | val costParallel: Long, 33 | 34 | /** 35 | * Length used to compute hash. 36 | */ 37 | @SerializedName("length") 38 | val length: Long, 39 | 40 | ) { 41 | fun toMap(): Map = mapOf( 42 | "type" to type as Any, 43 | "costCpu" to costCpu as Any, 44 | "costMemory" to costMemory as Any, 45 | "costParallel" to costParallel as Any, 46 | "length" to length as Any, 47 | ) 48 | 49 | companion object { 50 | 51 | @Suppress("UNCHECKED_CAST") 52 | fun from( 53 | map: Map, 54 | ) = AlgoScrypt( 55 | type = map["type"] as String, 56 | costCpu = (map["costCpu"] as Number).toLong(), 57 | costMemory = (map["costMemory"] as Number).toLong(), 58 | costParallel = (map["costParallel"] as Number).toLong(), 59 | length = (map["length"] as Number).toLong(), 60 | ) 61 | } 62 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/AlgoScryptModified.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * AlgoScryptModified 8 | */ 9 | data class AlgoScryptModified( 10 | /** 11 | * Algo type. 12 | */ 13 | @SerializedName("type") 14 | val type: String, 15 | 16 | /** 17 | * Salt used to compute hash. 18 | */ 19 | @SerializedName("salt") 20 | val salt: String, 21 | 22 | /** 23 | * Separator used to compute hash. 24 | */ 25 | @SerializedName("saltSeparator") 26 | val saltSeparator: String, 27 | 28 | /** 29 | * Key used to compute hash. 30 | */ 31 | @SerializedName("signerKey") 32 | val signerKey: String, 33 | 34 | ) { 35 | fun toMap(): Map = mapOf( 36 | "type" to type as Any, 37 | "salt" to salt as Any, 38 | "saltSeparator" to saltSeparator as Any, 39 | "signerKey" to signerKey as Any, 40 | ) 41 | 42 | companion object { 43 | 44 | @Suppress("UNCHECKED_CAST") 45 | fun from( 46 | map: Map, 47 | ) = AlgoScryptModified( 48 | type = map["type"] as String, 49 | salt = map["salt"] as String, 50 | saltSeparator = map["saltSeparator"] as String, 51 | signerKey = map["signerKey"] as String, 52 | ) 53 | } 54 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/AlgoSha.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * AlgoSHA 8 | */ 9 | data class AlgoSha( 10 | /** 11 | * Algo type. 12 | */ 13 | @SerializedName("type") 14 | val type: String, 15 | 16 | ) { 17 | fun toMap(): Map = mapOf( 18 | "type" to type as Any, 19 | ) 20 | 21 | companion object { 22 | 23 | @Suppress("UNCHECKED_CAST") 24 | fun from( 25 | map: Map, 26 | ) = AlgoSha( 27 | type = map["type"] as String, 28 | ) 29 | } 30 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/Continent.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * Continent 8 | */ 9 | data class Continent( 10 | /** 11 | * Continent name. 12 | */ 13 | @SerializedName("name") 14 | val name: String, 15 | 16 | /** 17 | * Continent two letter code. 18 | */ 19 | @SerializedName("code") 20 | val code: String, 21 | 22 | ) { 23 | fun toMap(): Map = mapOf( 24 | "name" to name as Any, 25 | "code" to code as Any, 26 | ) 27 | 28 | companion object { 29 | 30 | @Suppress("UNCHECKED_CAST") 31 | fun from( 32 | map: Map, 33 | ) = Continent( 34 | name = map["name"] as String, 35 | code = map["code"] as String, 36 | ) 37 | } 38 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/ContinentList.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * Continents List 8 | */ 9 | data class ContinentList( 10 | /** 11 | * Total number of continents documents that matched your query. 12 | */ 13 | @SerializedName("total") 14 | val total: Long, 15 | 16 | /** 17 | * List of continents. 18 | */ 19 | @SerializedName("continents") 20 | val continents: List, 21 | 22 | ) { 23 | fun toMap(): Map = mapOf( 24 | "total" to total as Any, 25 | "continents" to continents.map { it.toMap() } as Any, 26 | ) 27 | 28 | companion object { 29 | 30 | @Suppress("UNCHECKED_CAST") 31 | fun from( 32 | map: Map, 33 | ) = ContinentList( 34 | total = (map["total"] as Number).toLong(), 35 | continents = (map["continents"] as List>).map { Continent.from(map = it) }, 36 | ) 37 | } 38 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/Country.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * Country 8 | */ 9 | data class Country( 10 | /** 11 | * Country name. 12 | */ 13 | @SerializedName("name") 14 | val name: String, 15 | 16 | /** 17 | * Country two-character ISO 3166-1 alpha code. 18 | */ 19 | @SerializedName("code") 20 | val code: String, 21 | 22 | ) { 23 | fun toMap(): Map = mapOf( 24 | "name" to name as Any, 25 | "code" to code as Any, 26 | ) 27 | 28 | companion object { 29 | 30 | @Suppress("UNCHECKED_CAST") 31 | fun from( 32 | map: Map, 33 | ) = Country( 34 | name = map["name"] as String, 35 | code = map["code"] as String, 36 | ) 37 | } 38 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/CountryList.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * Countries List 8 | */ 9 | data class CountryList( 10 | /** 11 | * Total number of countries documents that matched your query. 12 | */ 13 | @SerializedName("total") 14 | val total: Long, 15 | 16 | /** 17 | * List of countries. 18 | */ 19 | @SerializedName("countries") 20 | val countries: List, 21 | 22 | ) { 23 | fun toMap(): Map = mapOf( 24 | "total" to total as Any, 25 | "countries" to countries.map { it.toMap() } as Any, 26 | ) 27 | 28 | companion object { 29 | 30 | @Suppress("UNCHECKED_CAST") 31 | fun from( 32 | map: Map, 33 | ) = CountryList( 34 | total = (map["total"] as Number).toLong(), 35 | countries = (map["countries"] as List>).map { Country.from(map = it) }, 36 | ) 37 | } 38 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/Currency.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * Currency 8 | */ 9 | data class Currency( 10 | /** 11 | * Currency symbol. 12 | */ 13 | @SerializedName("symbol") 14 | val symbol: String, 15 | 16 | /** 17 | * Currency name. 18 | */ 19 | @SerializedName("name") 20 | val name: String, 21 | 22 | /** 23 | * Currency native symbol. 24 | */ 25 | @SerializedName("symbolNative") 26 | val symbolNative: String, 27 | 28 | /** 29 | * Number of decimal digits. 30 | */ 31 | @SerializedName("decimalDigits") 32 | val decimalDigits: Long, 33 | 34 | /** 35 | * Currency digit rounding. 36 | */ 37 | @SerializedName("rounding") 38 | val rounding: Double, 39 | 40 | /** 41 | * Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format. 42 | */ 43 | @SerializedName("code") 44 | val code: String, 45 | 46 | /** 47 | * Currency plural name 48 | */ 49 | @SerializedName("namePlural") 50 | val namePlural: String, 51 | 52 | ) { 53 | fun toMap(): Map = mapOf( 54 | "symbol" to symbol as Any, 55 | "name" to name as Any, 56 | "symbolNative" to symbolNative as Any, 57 | "decimalDigits" to decimalDigits as Any, 58 | "rounding" to rounding as Any, 59 | "code" to code as Any, 60 | "namePlural" to namePlural as Any, 61 | ) 62 | 63 | companion object { 64 | 65 | @Suppress("UNCHECKED_CAST") 66 | fun from( 67 | map: Map, 68 | ) = Currency( 69 | symbol = map["symbol"] as String, 70 | name = map["name"] as String, 71 | symbolNative = map["symbolNative"] as String, 72 | decimalDigits = (map["decimalDigits"] as Number).toLong(), 73 | rounding = (map["rounding"] as Number).toDouble(), 74 | code = map["code"] as String, 75 | namePlural = map["namePlural"] as String, 76 | ) 77 | } 78 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/CurrencyList.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * Currencies List 8 | */ 9 | data class CurrencyList( 10 | /** 11 | * Total number of currencies documents that matched your query. 12 | */ 13 | @SerializedName("total") 14 | val total: Long, 15 | 16 | /** 17 | * List of currencies. 18 | */ 19 | @SerializedName("currencies") 20 | val currencies: List, 21 | 22 | ) { 23 | fun toMap(): Map = mapOf( 24 | "total" to total as Any, 25 | "currencies" to currencies.map { it.toMap() } as Any, 26 | ) 27 | 28 | companion object { 29 | 30 | @Suppress("UNCHECKED_CAST") 31 | fun from( 32 | map: Map, 33 | ) = CurrencyList( 34 | total = (map["total"] as Number).toLong(), 35 | currencies = (map["currencies"] as List>).map { Currency.from(map = it) }, 36 | ) 37 | } 38 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/DocumentList.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * Documents List 8 | */ 9 | data class DocumentList( 10 | /** 11 | * Total number of documents documents that matched your query. 12 | */ 13 | @SerializedName("total") 14 | val total: Long, 15 | 16 | /** 17 | * List of documents. 18 | */ 19 | @SerializedName("documents") 20 | val documents: List>, 21 | 22 | ) { 23 | fun toMap(): Map = mapOf( 24 | "total" to total as Any, 25 | "documents" to documents.map { it.toMap() } as Any, 26 | ) 27 | 28 | companion object { 29 | operator fun invoke( 30 | total: Long, 31 | documents: List>>, 32 | ) = DocumentList>( 33 | total, 34 | documents, 35 | ) 36 | 37 | @Suppress("UNCHECKED_CAST") 38 | fun from( 39 | map: Map, 40 | nestedType: Class 41 | ) = DocumentList( 42 | total = (map["total"] as Number).toLong(), 43 | documents = (map["documents"] as List>).map { Document.from(map = it, nestedType) }, 44 | ) 45 | } 46 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/ExecutionList.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * Executions List 8 | */ 9 | data class ExecutionList( 10 | /** 11 | * Total number of executions documents that matched your query. 12 | */ 13 | @SerializedName("total") 14 | val total: Long, 15 | 16 | /** 17 | * List of executions. 18 | */ 19 | @SerializedName("executions") 20 | val executions: List, 21 | 22 | ) { 23 | fun toMap(): Map = mapOf( 24 | "total" to total as Any, 25 | "executions" to executions.map { it.toMap() } as Any, 26 | ) 27 | 28 | companion object { 29 | 30 | @Suppress("UNCHECKED_CAST") 31 | fun from( 32 | map: Map, 33 | ) = ExecutionList( 34 | total = (map["total"] as Number).toLong(), 35 | executions = (map["executions"] as List>).map { Execution.from(map = it) }, 36 | ) 37 | } 38 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/FileList.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * Files List 8 | */ 9 | data class FileList( 10 | /** 11 | * Total number of files documents that matched your query. 12 | */ 13 | @SerializedName("total") 14 | val total: Long, 15 | 16 | /** 17 | * List of files. 18 | */ 19 | @SerializedName("files") 20 | val files: List, 21 | 22 | ) { 23 | fun toMap(): Map = mapOf( 24 | "total" to total as Any, 25 | "files" to files.map { it.toMap() } as Any, 26 | ) 27 | 28 | companion object { 29 | 30 | @Suppress("UNCHECKED_CAST") 31 | fun from( 32 | map: Map, 33 | ) = FileList( 34 | total = (map["total"] as Number).toLong(), 35 | files = (map["files"] as List>).map { File.from(map = it) }, 36 | ) 37 | } 38 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/Headers.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * Headers 8 | */ 9 | data class Headers( 10 | /** 11 | * Header name. 12 | */ 13 | @SerializedName("name") 14 | val name: String, 15 | 16 | /** 17 | * Header value. 18 | */ 19 | @SerializedName("value") 20 | val value: String, 21 | 22 | ) { 23 | fun toMap(): Map = mapOf( 24 | "name" to name as Any, 25 | "value" to value as Any, 26 | ) 27 | 28 | companion object { 29 | 30 | @Suppress("UNCHECKED_CAST") 31 | fun from( 32 | map: Map, 33 | ) = Headers( 34 | name = map["name"] as String, 35 | value = map["value"] as String, 36 | ) 37 | } 38 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/IdentityList.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * Identities List 8 | */ 9 | data class IdentityList( 10 | /** 11 | * Total number of identities documents that matched your query. 12 | */ 13 | @SerializedName("total") 14 | val total: Long, 15 | 16 | /** 17 | * List of identities. 18 | */ 19 | @SerializedName("identities") 20 | val identities: List, 21 | 22 | ) { 23 | fun toMap(): Map = mapOf( 24 | "total" to total as Any, 25 | "identities" to identities.map { it.toMap() } as Any, 26 | ) 27 | 28 | companion object { 29 | 30 | @Suppress("UNCHECKED_CAST") 31 | fun from( 32 | map: Map, 33 | ) = IdentityList( 34 | total = (map["total"] as Number).toLong(), 35 | identities = (map["identities"] as List>).map { Identity.from(map = it) }, 36 | ) 37 | } 38 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/InputFile.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import java.io.File 4 | import java.net.URLConnection 5 | import java.nio.file.Files 6 | import java.nio.file.Paths 7 | 8 | class InputFile private constructor() { 9 | 10 | lateinit var path: String 11 | lateinit var filename: String 12 | lateinit var mimeType: String 13 | lateinit var sourceType: String 14 | lateinit var data: Any 15 | 16 | companion object { 17 | fun fromFile(file: File) = InputFile().apply { 18 | path = file.canonicalPath 19 | filename = file.name 20 | mimeType = Files.probeContentType(Paths.get(file.canonicalPath)) 21 | ?: URLConnection.guessContentTypeFromName(filename) 22 | ?: "" 23 | sourceType = "file" 24 | } 25 | 26 | fun fromPath(path: String): InputFile = fromFile(File(path)).apply { 27 | sourceType = "path" 28 | } 29 | 30 | fun fromBytes(bytes: ByteArray, filename: String = "", mimeType: String = "") = InputFile().apply { 31 | this.filename = filename 32 | this.mimeType = mimeType 33 | data = bytes 34 | sourceType = "bytes" 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/Jwt.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * JWT 8 | */ 9 | data class Jwt( 10 | /** 11 | * JWT encoded string. 12 | */ 13 | @SerializedName("jwt") 14 | val jwt: String, 15 | 16 | ) { 17 | fun toMap(): Map = mapOf( 18 | "jwt" to jwt as Any, 19 | ) 20 | 21 | companion object { 22 | 23 | @Suppress("UNCHECKED_CAST") 24 | fun from( 25 | map: Map, 26 | ) = Jwt( 27 | jwt = map["jwt"] as String, 28 | ) 29 | } 30 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/Language.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * Language 8 | */ 9 | data class Language( 10 | /** 11 | * Language name. 12 | */ 13 | @SerializedName("name") 14 | val name: String, 15 | 16 | /** 17 | * Language two-character ISO 639-1 codes. 18 | */ 19 | @SerializedName("code") 20 | val code: String, 21 | 22 | /** 23 | * Language native name. 24 | */ 25 | @SerializedName("nativeName") 26 | val nativeName: String, 27 | 28 | ) { 29 | fun toMap(): Map = mapOf( 30 | "name" to name as Any, 31 | "code" to code as Any, 32 | "nativeName" to nativeName as Any, 33 | ) 34 | 35 | companion object { 36 | 37 | @Suppress("UNCHECKED_CAST") 38 | fun from( 39 | map: Map, 40 | ) = Language( 41 | name = map["name"] as String, 42 | code = map["code"] as String, 43 | nativeName = map["nativeName"] as String, 44 | ) 45 | } 46 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/LanguageList.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * Languages List 8 | */ 9 | data class LanguageList( 10 | /** 11 | * Total number of languages documents that matched your query. 12 | */ 13 | @SerializedName("total") 14 | val total: Long, 15 | 16 | /** 17 | * List of languages. 18 | */ 19 | @SerializedName("languages") 20 | val languages: List, 21 | 22 | ) { 23 | fun toMap(): Map = mapOf( 24 | "total" to total as Any, 25 | "languages" to languages.map { it.toMap() } as Any, 26 | ) 27 | 28 | companion object { 29 | 30 | @Suppress("UNCHECKED_CAST") 31 | fun from( 32 | map: Map, 33 | ) = LanguageList( 34 | total = (map["total"] as Number).toLong(), 35 | languages = (map["languages"] as List>).map { Language.from(map = it) }, 36 | ) 37 | } 38 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/LocaleCode.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * LocaleCode 8 | */ 9 | data class LocaleCode( 10 | /** 11 | * Locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) 12 | */ 13 | @SerializedName("code") 14 | val code: String, 15 | 16 | /** 17 | * Locale name 18 | */ 19 | @SerializedName("name") 20 | val name: String, 21 | 22 | ) { 23 | fun toMap(): Map = mapOf( 24 | "code" to code as Any, 25 | "name" to name as Any, 26 | ) 27 | 28 | companion object { 29 | 30 | @Suppress("UNCHECKED_CAST") 31 | fun from( 32 | map: Map, 33 | ) = LocaleCode( 34 | code = map["code"] as String, 35 | name = map["name"] as String, 36 | ) 37 | } 38 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/LocaleCodeList.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * Locale codes list 8 | */ 9 | data class LocaleCodeList( 10 | /** 11 | * Total number of localeCodes documents that matched your query. 12 | */ 13 | @SerializedName("total") 14 | val total: Long, 15 | 16 | /** 17 | * List of localeCodes. 18 | */ 19 | @SerializedName("localeCodes") 20 | val localeCodes: List, 21 | 22 | ) { 23 | fun toMap(): Map = mapOf( 24 | "total" to total as Any, 25 | "localeCodes" to localeCodes.map { it.toMap() } as Any, 26 | ) 27 | 28 | companion object { 29 | 30 | @Suppress("UNCHECKED_CAST") 31 | fun from( 32 | map: Map, 33 | ) = LocaleCodeList( 34 | total = (map["total"] as Number).toLong(), 35 | localeCodes = (map["localeCodes"] as List>).map { LocaleCode.from(map = it) }, 36 | ) 37 | } 38 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/LogList.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * Logs List 8 | */ 9 | data class LogList( 10 | /** 11 | * Total number of logs documents that matched your query. 12 | */ 13 | @SerializedName("total") 14 | val total: Long, 15 | 16 | /** 17 | * List of logs. 18 | */ 19 | @SerializedName("logs") 20 | val logs: List, 21 | 22 | ) { 23 | fun toMap(): Map = mapOf( 24 | "total" to total as Any, 25 | "logs" to logs.map { it.toMap() } as Any, 26 | ) 27 | 28 | companion object { 29 | 30 | @Suppress("UNCHECKED_CAST") 31 | fun from( 32 | map: Map, 33 | ) = LogList( 34 | total = (map["total"] as Number).toLong(), 35 | logs = (map["logs"] as List>).map { Log.from(map = it) }, 36 | ) 37 | } 38 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/MembershipList.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * Memberships List 8 | */ 9 | data class MembershipList( 10 | /** 11 | * Total number of memberships documents that matched your query. 12 | */ 13 | @SerializedName("total") 14 | val total: Long, 15 | 16 | /** 17 | * List of memberships. 18 | */ 19 | @SerializedName("memberships") 20 | val memberships: List, 21 | 22 | ) { 23 | fun toMap(): Map = mapOf( 24 | "total" to total as Any, 25 | "memberships" to memberships.map { it.toMap() } as Any, 26 | ) 27 | 28 | companion object { 29 | 30 | @Suppress("UNCHECKED_CAST") 31 | fun from( 32 | map: Map, 33 | ) = MembershipList( 34 | total = (map["total"] as Number).toLong(), 35 | memberships = (map["memberships"] as List>).map { Membership.from(map = it) }, 36 | ) 37 | } 38 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/MfaChallenge.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * MFA Challenge 8 | */ 9 | data class MfaChallenge( 10 | /** 11 | * Token ID. 12 | */ 13 | @SerializedName("\$id") 14 | val id: String, 15 | 16 | /** 17 | * Token creation date in ISO 8601 format. 18 | */ 19 | @SerializedName("\$createdAt") 20 | val createdAt: String, 21 | 22 | /** 23 | * User ID. 24 | */ 25 | @SerializedName("userId") 26 | val userId: String, 27 | 28 | /** 29 | * Token expiration date in ISO 8601 format. 30 | */ 31 | @SerializedName("expire") 32 | val expire: String, 33 | 34 | ) { 35 | fun toMap(): Map = mapOf( 36 | "\$id" to id as Any, 37 | "\$createdAt" to createdAt as Any, 38 | "userId" to userId as Any, 39 | "expire" to expire as Any, 40 | ) 41 | 42 | companion object { 43 | 44 | @Suppress("UNCHECKED_CAST") 45 | fun from( 46 | map: Map, 47 | ) = MfaChallenge( 48 | id = map["\$id"] as String, 49 | createdAt = map["\$createdAt"] as String, 50 | userId = map["userId"] as String, 51 | expire = map["expire"] as String, 52 | ) 53 | } 54 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/MfaFactors.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * MFAFactors 8 | */ 9 | data class MfaFactors( 10 | /** 11 | * Can TOTP be used for MFA challenge for this account. 12 | */ 13 | @SerializedName("totp") 14 | val totp: Boolean, 15 | 16 | /** 17 | * Can phone (SMS) be used for MFA challenge for this account. 18 | */ 19 | @SerializedName("phone") 20 | val phone: Boolean, 21 | 22 | /** 23 | * Can email be used for MFA challenge for this account. 24 | */ 25 | @SerializedName("email") 26 | val email: Boolean, 27 | 28 | /** 29 | * Can recovery code be used for MFA challenge for this account. 30 | */ 31 | @SerializedName("recoveryCode") 32 | val recoveryCode: Boolean, 33 | 34 | ) { 35 | fun toMap(): Map = mapOf( 36 | "totp" to totp as Any, 37 | "phone" to phone as Any, 38 | "email" to email as Any, 39 | "recoveryCode" to recoveryCode as Any, 40 | ) 41 | 42 | companion object { 43 | 44 | @Suppress("UNCHECKED_CAST") 45 | fun from( 46 | map: Map, 47 | ) = MfaFactors( 48 | totp = map["totp"] as Boolean, 49 | phone = map["phone"] as Boolean, 50 | email = map["email"] as Boolean, 51 | recoveryCode = map["recoveryCode"] as Boolean, 52 | ) 53 | } 54 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/MfaRecoveryCodes.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * MFA Recovery Codes 8 | */ 9 | data class MfaRecoveryCodes( 10 | /** 11 | * Recovery codes. 12 | */ 13 | @SerializedName("recoveryCodes") 14 | val recoveryCodes: List, 15 | 16 | ) { 17 | fun toMap(): Map = mapOf( 18 | "recoveryCodes" to recoveryCodes as Any, 19 | ) 20 | 21 | companion object { 22 | 23 | @Suppress("UNCHECKED_CAST") 24 | fun from( 25 | map: Map, 26 | ) = MfaRecoveryCodes( 27 | recoveryCodes = map["recoveryCodes"] as List, 28 | ) 29 | } 30 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/MfaType.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * MFAType 8 | */ 9 | data class MfaType( 10 | /** 11 | * Secret token used for TOTP factor. 12 | */ 13 | @SerializedName("secret") 14 | val secret: String, 15 | 16 | /** 17 | * URI for authenticator apps. 18 | */ 19 | @SerializedName("uri") 20 | val uri: String, 21 | 22 | ) { 23 | fun toMap(): Map = mapOf( 24 | "secret" to secret as Any, 25 | "uri" to uri as Any, 26 | ) 27 | 28 | companion object { 29 | 30 | @Suppress("UNCHECKED_CAST") 31 | fun from( 32 | map: Map, 33 | ) = MfaType( 34 | secret = map["secret"] as String, 35 | uri = map["uri"] as String, 36 | ) 37 | } 38 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/Phone.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * Phone 8 | */ 9 | data class Phone( 10 | /** 11 | * Phone code. 12 | */ 13 | @SerializedName("code") 14 | val code: String, 15 | 16 | /** 17 | * Country two-character ISO 3166-1 alpha code. 18 | */ 19 | @SerializedName("countryCode") 20 | val countryCode: String, 21 | 22 | /** 23 | * Country name. 24 | */ 25 | @SerializedName("countryName") 26 | val countryName: String, 27 | 28 | ) { 29 | fun toMap(): Map = mapOf( 30 | "code" to code as Any, 31 | "countryCode" to countryCode as Any, 32 | "countryName" to countryName as Any, 33 | ) 34 | 35 | companion object { 36 | 37 | @Suppress("UNCHECKED_CAST") 38 | fun from( 39 | map: Map, 40 | ) = Phone( 41 | code = map["code"] as String, 42 | countryCode = map["countryCode"] as String, 43 | countryName = map["countryName"] as String, 44 | ) 45 | } 46 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/PhoneList.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * Phones List 8 | */ 9 | data class PhoneList( 10 | /** 11 | * Total number of phones documents that matched your query. 12 | */ 13 | @SerializedName("total") 14 | val total: Long, 15 | 16 | /** 17 | * List of phones. 18 | */ 19 | @SerializedName("phones") 20 | val phones: List, 21 | 22 | ) { 23 | fun toMap(): Map = mapOf( 24 | "total" to total as Any, 25 | "phones" to phones.map { it.toMap() } as Any, 26 | ) 27 | 28 | companion object { 29 | 30 | @Suppress("UNCHECKED_CAST") 31 | fun from( 32 | map: Map, 33 | ) = PhoneList( 34 | total = (map["total"] as Number).toLong(), 35 | phones = (map["phones"] as List>).map { Phone.from(map = it) }, 36 | ) 37 | } 38 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/Preferences.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * Preferences 8 | */ 9 | data class Preferences( 10 | /** 11 | * Additional properties 12 | */ 13 | @SerializedName("data") 14 | val data: T 15 | ) { 16 | fun toMap(): Map = mapOf( 17 | "data" to data!!.jsonCast(to = Map::class.java) 18 | ) 19 | 20 | companion object { 21 | operator fun invoke( 22 | data: Map 23 | ) = Preferences>( 24 | data 25 | ) 26 | 27 | @Suppress("UNCHECKED_CAST") 28 | fun from( 29 | map: Map, 30 | nestedType: Class 31 | ) = Preferences( 32 | data = map.jsonCast(to = nestedType) 33 | ) 34 | } 35 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/RealtimeModels.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import kotlin.collections.Collection 4 | import java.io.Closeable 5 | 6 | data class RealtimeSubscription( 7 | private val close: () -> Unit 8 | ) : Closeable { 9 | override fun close() = close.invoke() 10 | } 11 | 12 | data class RealtimeCallback( 13 | val channels: Collection, 14 | val payloadClass: Class<*>, 15 | val callback: (RealtimeResponseEvent<*>) -> Unit 16 | ) 17 | 18 | open class RealtimeResponse( 19 | val type: String, 20 | val data: Any? 21 | ) 22 | 23 | data class RealtimeResponseEvent( 24 | val events: Collection, 25 | val channels: Collection, 26 | val timestamp: String, 27 | var payload: T 28 | ) 29 | 30 | enum class RealtimeCode(val value: Int) { 31 | POLICY_VIOLATION(1008), 32 | UNKNOWN_ERROR(-1) 33 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/SessionList.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * Sessions List 8 | */ 9 | data class SessionList( 10 | /** 11 | * Total number of sessions documents that matched your query. 12 | */ 13 | @SerializedName("total") 14 | val total: Long, 15 | 16 | /** 17 | * List of sessions. 18 | */ 19 | @SerializedName("sessions") 20 | val sessions: List, 21 | 22 | ) { 23 | fun toMap(): Map = mapOf( 24 | "total" to total as Any, 25 | "sessions" to sessions.map { it.toMap() } as Any, 26 | ) 27 | 28 | companion object { 29 | 30 | @Suppress("UNCHECKED_CAST") 31 | fun from( 32 | map: Map, 33 | ) = SessionList( 34 | total = (map["total"] as Number).toLong(), 35 | sessions = (map["sessions"] as List>).map { Session.from(map = it) }, 36 | ) 37 | } 38 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/TeamList.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * Teams List 8 | */ 9 | data class TeamList( 10 | /** 11 | * Total number of teams documents that matched your query. 12 | */ 13 | @SerializedName("total") 14 | val total: Long, 15 | 16 | /** 17 | * List of teams. 18 | */ 19 | @SerializedName("teams") 20 | val teams: List>, 21 | 22 | ) { 23 | fun toMap(): Map = mapOf( 24 | "total" to total as Any, 25 | "teams" to teams.map { it.toMap() } as Any, 26 | ) 27 | 28 | companion object { 29 | operator fun invoke( 30 | total: Long, 31 | teams: List>>, 32 | ) = TeamList>( 33 | total, 34 | teams, 35 | ) 36 | 37 | @Suppress("UNCHECKED_CAST") 38 | fun from( 39 | map: Map, 40 | nestedType: Class 41 | ) = TeamList( 42 | total = (map["total"] as Number).toLong(), 43 | teams = (map["teams"] as List>).map { Team.from(map = it, nestedType) }, 44 | ) 45 | } 46 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/Token.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | import com.google.gson.annotations.SerializedName 4 | import io.appwrite.extensions.jsonCast 5 | 6 | /** 7 | * Token 8 | */ 9 | data class Token( 10 | /** 11 | * Token ID. 12 | */ 13 | @SerializedName("\$id") 14 | val id: String, 15 | 16 | /** 17 | * Token creation date in ISO 8601 format. 18 | */ 19 | @SerializedName("\$createdAt") 20 | val createdAt: String, 21 | 22 | /** 23 | * User ID. 24 | */ 25 | @SerializedName("userId") 26 | val userId: String, 27 | 28 | /** 29 | * Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. 30 | */ 31 | @SerializedName("secret") 32 | val secret: String, 33 | 34 | /** 35 | * Token expiration date in ISO 8601 format. 36 | */ 37 | @SerializedName("expire") 38 | val expire: String, 39 | 40 | /** 41 | * 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. 42 | */ 43 | @SerializedName("phrase") 44 | val phrase: String, 45 | 46 | ) { 47 | fun toMap(): Map = mapOf( 48 | "\$id" to id as Any, 49 | "\$createdAt" to createdAt as Any, 50 | "userId" to userId as Any, 51 | "secret" to secret as Any, 52 | "expire" to expire as Any, 53 | "phrase" to phrase as Any, 54 | ) 55 | 56 | companion object { 57 | 58 | @Suppress("UNCHECKED_CAST") 59 | fun from( 60 | map: Map, 61 | ) = Token( 62 | id = map["\$id"] as String, 63 | createdAt = map["\$createdAt"] as String, 64 | userId = map["userId"] as String, 65 | secret = map["secret"] as String, 66 | expire = map["expire"] as String, 67 | phrase = map["phrase"] as String, 68 | ) 69 | } 70 | } -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/models/UploadProgress.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.models 2 | 3 | data class UploadProgress( 4 | val id: String, 5 | val progress: Double, 6 | val sizeUploaded: Long, 7 | val chunksTotal: Int, 8 | val chunksUploaded: Int 9 | ) -------------------------------------------------------------------------------- /library/src/main/java/io/appwrite/views/CallbackActivity.kt: -------------------------------------------------------------------------------- 1 | package io.appwrite.views 2 | 3 | import android.app.Activity 4 | import android.os.Bundle 5 | import io.appwrite.WebAuthComponent 6 | 7 | class CallbackActivity: Activity() { 8 | override fun onCreate(savedInstanceState: Bundle?) { 9 | super.onCreate(savedInstanceState) 10 | 11 | val url = intent?.data 12 | val scheme = url?.scheme 13 | if (scheme != null) { 14 | // Found a scheme, try to callback to web auth component. 15 | // Will only succeed if the scheme matches one launched by this sdk. 16 | WebAuthComponent.onCallback(scheme, url) 17 | } 18 | finish() 19 | } 20 | } -------------------------------------------------------------------------------- /scripts/publish-config.gradle: -------------------------------------------------------------------------------- 1 | // Create variables with empty default values 2 | ext["signing.keyId"] = '' 3 | ext["signing.password"] = '' 4 | ext["signing.secretKeyRingFile"] = '' 5 | ext["ossrhUsername"] = '' 6 | ext["ossrhPassword"] = '' 7 | ext["sonatypeStagingProfileId"] = '' 8 | 9 | File secretPropsFile = project.rootProject.file('local.properties') 10 | if (secretPropsFile.exists()) { 11 | // Read local.properties file first if it exists 12 | Properties p = new Properties() 13 | new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) } 14 | p.each { name, value -> ext[name] = value } 15 | } 16 | 17 | // Use system environment variables 18 | ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME') ?: ext["ossrhUsername"] 19 | ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD') ?: ext["ossrhPassword"] 20 | ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID') ?: ext["sonatypeStagingProfileId"] 21 | ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') ?: ext["signing.keyId"] 22 | ext["signing.password"] = System.getenv('SIGNING_PASSWORD') ?: ext["signing.password"] 23 | ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE') ?: ext["signing.secretKeyRingFile"] 24 | 25 | 26 | // Set up Sonatype repository 27 | nexusPublishing { 28 | repositories { 29 | sonatype { 30 | stagingProfileId = sonatypeStagingProfileId 31 | username = ossrhUsername 32 | password = ossrhPassword 33 | nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) 34 | snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = "Appwrite Android SDK" 2 | include ':example' 3 | include ':library' --------------------------------------------------------------------------------