From 84918075df71f3fb956ef0eede6f0fc06146e930 Mon Sep 17 00:00:00 2001 From: Evan Date: Mon, 29 Jul 2024 09:16:55 -0700 Subject: [PATCH 1/8] Create autoclose.yml --- .github/workflows/autoclose.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/workflows/autoclose.yml diff --git a/.github/workflows/autoclose.yml b/.github/workflows/autoclose.yml new file mode 100644 index 0000000..3e2b3cb --- /dev/null +++ b/.github/workflows/autoclose.yml @@ -0,0 +1,11 @@ +name: Auto-close External Pull Requests + +on: + pull_request_target: + types: [opened, reopened] + +jobs: + auto_close: + uses: appwrite/.github/.github/workflows/autoclose.yml@main + secrets: + GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }} From f4fb8d2dfd9cf0d2922b755b85dd8726e6f97a6e Mon Sep 17 00:00:00 2001 From: root Date: Wed, 18 Sep 2024 15:52:13 +0000 Subject: [PATCH 2/8] SDK binary support for executions --- README.md | 8 +- .../java/account/create-anonymous-session.md | 2 +- .../account/create-email-password-session.md | 6 +- .../java/account/create-email-token.md | 6 +- docs/examples/java/account/create-j-w-t.md | 2 +- .../java/account/create-magic-u-r-l-token.md | 8 +- .../java/account/create-mfa-authenticator.md | 2 +- .../java/account/create-mfa-challenge.md | 2 +- .../java/account/create-mfa-recovery-codes.md | 2 +- .../java/account/create-o-auth2session.md | 6 +- .../java/account/create-o-auth2token.md | 6 +- .../java/account/create-phone-token.md | 6 +- .../java/account/create-phone-verification.md | 2 +- .../java/account/create-push-target.md | 8 +- docs/examples/java/account/create-recovery.md | 6 +- docs/examples/java/account/create-session.md | 6 +- .../java/account/create-verification.md | 4 +- docs/examples/java/account/create.md | 8 +- docs/examples/java/account/delete-identity.md | 4 +- .../java/account/delete-mfa-authenticator.md | 3 +- .../java/account/delete-push-target.md | 4 +- docs/examples/java/account/delete-session.md | 4 +- docs/examples/java/account/delete-sessions.md | 2 +- .../java/account/get-mfa-recovery-codes.md | 2 +- docs/examples/java/account/get-prefs.md | 2 +- docs/examples/java/account/get-session.md | 4 +- docs/examples/java/account/get.md | 2 +- docs/examples/java/account/list-identities.md | 2 +- docs/examples/java/account/list-logs.md | 2 +- .../examples/java/account/list-mfa-factors.md | 2 +- docs/examples/java/account/list-sessions.md | 2 +- docs/examples/java/account/update-email.md | 6 +- docs/examples/java/account/update-m-f-a.md | 2 +- .../account/update-magic-u-r-l-session.md | 6 +- .../java/account/update-mfa-authenticator.md | 4 +- .../java/account/update-mfa-challenge.md | 6 +- .../java/account/update-mfa-recovery-codes.md | 2 +- docs/examples/java/account/update-name.md | 4 +- docs/examples/java/account/update-password.md | 4 +- .../java/account/update-phone-session.md | 6 +- .../java/account/update-phone-verification.md | 6 +- docs/examples/java/account/update-phone.md | 6 +- docs/examples/java/account/update-prefs.md | 2 +- .../java/account/update-push-target.md | 6 +- docs/examples/java/account/update-recovery.md | 6 +- docs/examples/java/account/update-session.md | 4 +- docs/examples/java/account/update-status.md | 2 +- .../java/account/update-verification.md | 6 +- docs/examples/java/avatars/get-browser.md | 2 +- docs/examples/java/avatars/get-credit-card.md | 2 +- docs/examples/java/avatars/get-favicon.md | 4 +- docs/examples/java/avatars/get-flag.md | 2 +- docs/examples/java/avatars/get-image.md | 4 +- docs/examples/java/avatars/get-initials.md | 4 +- docs/examples/java/avatars/get-q-r.md | 4 +- .../java/databases/create-document.md | 8 +- .../java/databases/delete-document.md | 8 +- docs/examples/java/databases/get-document.md | 8 +- .../examples/java/databases/list-documents.md | 6 +- .../java/databases/update-document.md | 8 +- .../java/functions/create-execution.md | 9 +- docs/examples/java/functions/get-execution.md | 6 +- .../java/functions/list-executions.md | 6 +- docs/examples/java/graphql/mutation.md | 2 +- docs/examples/java/graphql/query.md | 2 +- docs/examples/java/locale/get.md | 2 +- docs/examples/java/locale/list-codes.md | 2 +- docs/examples/java/locale/list-continents.md | 2 +- .../java/locale/list-countries-e-u.md | 2 +- .../java/locale/list-countries-phones.md | 2 +- docs/examples/java/locale/list-countries.md | 2 +- docs/examples/java/locale/list-currencies.md | 2 +- docs/examples/java/locale/list-languages.md | 2 +- .../java/messaging/create-subscriber.md | 8 +- .../java/messaging/delete-subscriber.md | 6 +- docs/examples/java/storage/create-file.md | 10 +- docs/examples/java/storage/delete-file.md | 6 +- .../java/storage/get-file-download.md | 6 +- .../examples/java/storage/get-file-preview.md | 6 +- docs/examples/java/storage/get-file-view.md | 6 +- docs/examples/java/storage/get-file.md | 6 +- docs/examples/java/storage/list-files.md | 6 +- docs/examples/java/storage/update-file.md | 8 +- docs/examples/java/teams/create-membership.md | 14 +- docs/examples/java/teams/create.md | 6 +- docs/examples/java/teams/delete-membership.md | 6 +- docs/examples/java/teams/delete.md | 4 +- docs/examples/java/teams/get-membership.md | 6 +- docs/examples/java/teams/get-prefs.md | 4 +- docs/examples/java/teams/get.md | 4 +- docs/examples/java/teams/list-memberships.md | 6 +- docs/examples/java/teams/list.md | 4 +- .../java/teams/update-membership-status.md | 10 +- docs/examples/java/teams/update-membership.md | 6 +- docs/examples/java/teams/update-name.md | 6 +- docs/examples/java/teams/update-prefs.md | 4 +- .../account/create-anonymous-session.md | 2 +- .../account/create-email-password-session.md | 6 +- .../kotlin/account/create-email-token.md | 6 +- docs/examples/kotlin/account/create-j-w-t.md | 2 +- .../account/create-magic-u-r-l-token.md | 8 +- .../account/create-mfa-authenticator.md | 2 +- .../kotlin/account/create-mfa-challenge.md | 2 +- .../account/create-mfa-recovery-codes.md | 2 +- .../kotlin/account/create-o-auth2session.md | 6 +- .../kotlin/account/create-o-auth2token.md | 6 +- .../kotlin/account/create-phone-token.md | 6 +- .../account/create-phone-verification.md | 2 +- .../kotlin/account/create-push-target.md | 8 +- .../kotlin/account/create-recovery.md | 6 +- .../examples/kotlin/account/create-session.md | 6 +- .../kotlin/account/create-verification.md | 4 +- docs/examples/kotlin/account/create.md | 8 +- .../kotlin/account/delete-identity.md | 4 +- .../account/delete-mfa-authenticator.md | 3 +- .../kotlin/account/delete-push-target.md | 4 +- .../examples/kotlin/account/delete-session.md | 4 +- .../kotlin/account/delete-sessions.md | 2 +- .../kotlin/account/get-mfa-recovery-codes.md | 2 +- docs/examples/kotlin/account/get-prefs.md | 2 +- docs/examples/kotlin/account/get-session.md | 4 +- docs/examples/kotlin/account/get.md | 2 +- .../kotlin/account/list-identities.md | 2 +- docs/examples/kotlin/account/list-logs.md | 2 +- .../kotlin/account/list-mfa-factors.md | 2 +- docs/examples/kotlin/account/list-sessions.md | 2 +- docs/examples/kotlin/account/update-email.md | 6 +- docs/examples/kotlin/account/update-m-f-a.md | 2 +- .../account/update-magic-u-r-l-session.md | 6 +- .../account/update-mfa-authenticator.md | 4 +- .../kotlin/account/update-mfa-challenge.md | 6 +- .../account/update-mfa-recovery-codes.md | 2 +- docs/examples/kotlin/account/update-name.md | 4 +- .../kotlin/account/update-password.md | 4 +- .../kotlin/account/update-phone-session.md | 6 +- .../account/update-phone-verification.md | 6 +- docs/examples/kotlin/account/update-phone.md | 6 +- docs/examples/kotlin/account/update-prefs.md | 2 +- .../kotlin/account/update-push-target.md | 6 +- .../kotlin/account/update-recovery.md | 6 +- .../examples/kotlin/account/update-session.md | 4 +- docs/examples/kotlin/account/update-status.md | 2 +- .../kotlin/account/update-verification.md | 6 +- docs/examples/kotlin/avatars/get-browser.md | 2 +- .../kotlin/avatars/get-credit-card.md | 2 +- docs/examples/kotlin/avatars/get-favicon.md | 4 +- docs/examples/kotlin/avatars/get-flag.md | 2 +- docs/examples/kotlin/avatars/get-image.md | 4 +- docs/examples/kotlin/avatars/get-initials.md | 4 +- docs/examples/kotlin/avatars/get-q-r.md | 4 +- .../kotlin/databases/create-document.md | 8 +- .../kotlin/databases/delete-document.md | 8 +- .../examples/kotlin/databases/get-document.md | 8 +- .../kotlin/databases/list-documents.md | 6 +- .../kotlin/databases/update-document.md | 8 +- .../kotlin/functions/create-execution.md | 9 +- .../kotlin/functions/get-execution.md | 6 +- .../kotlin/functions/list-executions.md | 6 +- docs/examples/kotlin/graphql/mutation.md | 2 +- docs/examples/kotlin/graphql/query.md | 2 +- docs/examples/kotlin/locale/get.md | 2 +- docs/examples/kotlin/locale/list-codes.md | 2 +- .../examples/kotlin/locale/list-continents.md | 2 +- .../kotlin/locale/list-countries-e-u.md | 2 +- .../kotlin/locale/list-countries-phones.md | 2 +- docs/examples/kotlin/locale/list-countries.md | 2 +- .../examples/kotlin/locale/list-currencies.md | 2 +- docs/examples/kotlin/locale/list-languages.md | 2 +- .../kotlin/messaging/create-subscriber.md | 8 +- .../kotlin/messaging/delete-subscriber.md | 6 +- docs/examples/kotlin/storage/create-file.md | 10 +- docs/examples/kotlin/storage/delete-file.md | 6 +- .../kotlin/storage/get-file-download.md | 6 +- .../kotlin/storage/get-file-preview.md | 6 +- docs/examples/kotlin/storage/get-file-view.md | 6 +- docs/examples/kotlin/storage/get-file.md | 6 +- docs/examples/kotlin/storage/list-files.md | 6 +- docs/examples/kotlin/storage/update-file.md | 8 +- .../kotlin/teams/create-membership.md | 14 +- docs/examples/kotlin/teams/create.md | 6 +- .../kotlin/teams/delete-membership.md | 6 +- docs/examples/kotlin/teams/delete.md | 4 +- docs/examples/kotlin/teams/get-membership.md | 6 +- docs/examples/kotlin/teams/get-prefs.md | 4 +- docs/examples/kotlin/teams/get.md | 4 +- .../examples/kotlin/teams/list-memberships.md | 6 +- docs/examples/kotlin/teams/list.md | 4 +- .../kotlin/teams/update-membership-status.md | 10 +- .../kotlin/teams/update-membership.md | 6 +- docs/examples/kotlin/teams/update-name.md | 6 +- docs/examples/kotlin/teams/update-prefs.md | 4 +- library/src/main/java/io/appwrite/Client.kt | 68 ++- library/src/main/java/io/appwrite/ID.kt | 10 +- .../src/main/java/io/appwrite/Permission.kt | 47 +- library/src/main/java/io/appwrite/Query.kt | 161 +++++- library/src/main/java/io/appwrite/Service.kt | 5 + .../io/appwrite/extensions/TypeExtensions.kt | 101 +++- .../main/java/io/appwrite/models/Execution.kt | 8 + .../main/java/io/appwrite/models/InputFile.kt | 37 -- .../main/java/io/appwrite/models/Payload.kt | 71 +++ .../main/java/io/appwrite/services/Account.kt | 459 +++++++++--------- .../main/java/io/appwrite/services/Avatars.kt | 62 +-- .../java/io/appwrite/services/Databases.kt | 62 +-- .../java/io/appwrite/services/Functions.kt | 44 +- .../main/java/io/appwrite/services/Graphql.kt | 18 +- .../main/java/io/appwrite/services/Locale.kt | 50 +- .../java/io/appwrite/services/Messaging.kt | 18 +- .../main/java/io/appwrite/services/Storage.kt | 78 +-- .../main/java/io/appwrite/services/Teams.kt | 144 +++--- 209 files changed, 1357 insertions(+), 982 deletions(-) delete mode 100644 library/src/main/java/io/appwrite/models/InputFile.kt create mode 100644 library/src/main/java/io/appwrite/models/Payload.kt diff --git a/README.md b/README.md index 7a8e368..f8dab1a 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,12 @@ ![Maven Central](https://img.shields.io/maven-central/v/io.appwrite/sdk-for-android.svg?color=green&style=flat-square) ![License](https://img.shields.io/github/license/appwrite/sdk-for-android.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.5.6-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.6.0-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.5.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-android/releases).** +**This SDK is compatible with Appwrite server version 1.6.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-android/releases).** Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Android SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) @@ -38,7 +38,7 @@ repositories { Next, add the dependency to your project's `build.gradle(.kts)` file: ```groovy -implementation("io.appwrite:sdk-for-android:5.1.1") +implementation("io.appwrite:sdk-for-android:6.0.0") ``` ### Maven @@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file: io.appwrite sdk-for-android - 5.1.1 + 6.0.0 ``` diff --git a/docs/examples/java/account/create-anonymous-session.md b/docs/examples/java/account/create-anonymous-session.md index 46ae275..1639cdc 100644 --- a/docs/examples/java/account/create-anonymous-session.md +++ b/docs/examples/java/account/create-anonymous-session.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/create-email-password-session.md b/docs/examples/java/account/create-email-password-session.md index 85d460e..112fb20 100644 --- a/docs/examples/java/account/create-email-password-session.md +++ b/docs/examples/java/account/create-email-password-session.md @@ -4,13 +4,13 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.createEmailPasswordSession( - "email@example.com", // email - "password", // password + "{$example}", // email + "{$example}", // password new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/create-email-token.md b/docs/examples/java/account/create-email-token.md index adf8b3d..3fafb5e 100644 --- a/docs/examples/java/account/create-email-token.md +++ b/docs/examples/java/account/create-email-token.md @@ -4,13 +4,13 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.createEmailToken( - "", // userId - "email@example.com", // email + "{$example}", // userId + "{$example}", // email false, // phrase (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/account/create-j-w-t.md b/docs/examples/java/account/create-j-w-t.md index 13e6e49..9aeb29c 100644 --- a/docs/examples/java/account/create-j-w-t.md +++ b/docs/examples/java/account/create-j-w-t.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/create-magic-u-r-l-token.md b/docs/examples/java/account/create-magic-u-r-l-token.md index 21108cc..e84b213 100644 --- a/docs/examples/java/account/create-magic-u-r-l-token.md +++ b/docs/examples/java/account/create-magic-u-r-l-token.md @@ -4,14 +4,14 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.createMagicURLToken( - "", // userId - "email@example.com", // email - "https://example.com", // url (optional) + "{$example}", // userId + "{$example}", // email + "{$example}", // url (optional) false, // phrase (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/account/create-mfa-authenticator.md b/docs/examples/java/account/create-mfa-authenticator.md index cc64341..b8b06c3 100644 --- a/docs/examples/java/account/create-mfa-authenticator.md +++ b/docs/examples/java/account/create-mfa-authenticator.md @@ -5,7 +5,7 @@ import io.appwrite.enums.AuthenticatorType; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/create-mfa-challenge.md b/docs/examples/java/account/create-mfa-challenge.md index a2c2aa4..d9d9bb6 100644 --- a/docs/examples/java/account/create-mfa-challenge.md +++ b/docs/examples/java/account/create-mfa-challenge.md @@ -5,7 +5,7 @@ import io.appwrite.enums.AuthenticationFactor; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/create-mfa-recovery-codes.md b/docs/examples/java/account/create-mfa-recovery-codes.md index 8ed8573..6e23ad2 100644 --- a/docs/examples/java/account/create-mfa-recovery-codes.md +++ b/docs/examples/java/account/create-mfa-recovery-codes.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/create-o-auth2session.md b/docs/examples/java/account/create-o-auth2session.md index ba284a1..591f85e 100644 --- a/docs/examples/java/account/create-o-auth2session.md +++ b/docs/examples/java/account/create-o-auth2session.md @@ -5,14 +5,14 @@ import io.appwrite.enums.OAuthProvider; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.createOAuth2Session( OAuthProvider.AMAZON, // provider - "https://example.com", // success (optional) - "https://example.com", // failure (optional) + "{$example}", // success (optional) + "{$example}", // failure (optional) listOf(), // scopes (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/account/create-o-auth2token.md b/docs/examples/java/account/create-o-auth2token.md index eb64da1..0866fef 100644 --- a/docs/examples/java/account/create-o-auth2token.md +++ b/docs/examples/java/account/create-o-auth2token.md @@ -5,14 +5,14 @@ import io.appwrite.enums.OAuthProvider; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.createOAuth2Token( OAuthProvider.AMAZON, // provider - "https://example.com", // success (optional) - "https://example.com", // failure (optional) + "{$example}", // success (optional) + "{$example}", // failure (optional) listOf(), // scopes (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/account/create-phone-token.md b/docs/examples/java/account/create-phone-token.md index 29ef311..ef60cfa 100644 --- a/docs/examples/java/account/create-phone-token.md +++ b/docs/examples/java/account/create-phone-token.md @@ -4,13 +4,13 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.createPhoneToken( - "", // userId - "+12065550100", // phone + "{$example}", // userId + "{$example}", // phone new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/create-phone-verification.md b/docs/examples/java/account/create-phone-verification.md index ef14ce8..cca9283 100644 --- a/docs/examples/java/account/create-phone-verification.md +++ b/docs/examples/java/account/create-phone-verification.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/create-push-target.md b/docs/examples/java/account/create-push-target.md index 7eff453..a0dc5a8 100644 --- a/docs/examples/java/account/create-push-target.md +++ b/docs/examples/java/account/create-push-target.md @@ -4,14 +4,14 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.createPushTarget( - "", // targetId - "", // identifier - "", // providerId (optional) + "{$example}", // targetId + "{$example}", // identifier + "{$example}", // providerId (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/create-recovery.md b/docs/examples/java/account/create-recovery.md index 19006f6..7fba792 100644 --- a/docs/examples/java/account/create-recovery.md +++ b/docs/examples/java/account/create-recovery.md @@ -4,13 +4,13 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.createRecovery( - "email@example.com", // email - "https://example.com", // url + "{$example}", // email + "{$example}", // url new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/create-session.md b/docs/examples/java/account/create-session.md index 013d372..ff3391f 100644 --- a/docs/examples/java/account/create-session.md +++ b/docs/examples/java/account/create-session.md @@ -4,13 +4,13 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.createSession( - "", // userId - "", // secret + "{$example}", // userId + "{$example}", // secret new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/create-verification.md b/docs/examples/java/account/create-verification.md index 254a31b..74e5b3d 100644 --- a/docs/examples/java/account/create-verification.md +++ b/docs/examples/java/account/create-verification.md @@ -4,12 +4,12 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.createVerification( - "https://example.com", // url + "{$example}", // url new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/create.md b/docs/examples/java/account/create.md index 8ee1de3..d23bcac 100644 --- a/docs/examples/java/account/create.md +++ b/docs/examples/java/account/create.md @@ -4,15 +4,15 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.create( - "", // userId - "email@example.com", // email + "{$example}", // userId + "{$example}", // email "", // password - "", // name (optional) + "{$example}", // name (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/delete-identity.md b/docs/examples/java/account/delete-identity.md index 1d6922a..d72c1e6 100644 --- a/docs/examples/java/account/delete-identity.md +++ b/docs/examples/java/account/delete-identity.md @@ -4,12 +4,12 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.deleteIdentity( - "", // identityId + "{$example}", // identityId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/delete-mfa-authenticator.md b/docs/examples/java/account/delete-mfa-authenticator.md index e821930..bb6cb09 100644 --- a/docs/examples/java/account/delete-mfa-authenticator.md +++ b/docs/examples/java/account/delete-mfa-authenticator.md @@ -5,13 +5,12 @@ import io.appwrite.enums.AuthenticatorType; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.deleteMfaAuthenticator( AuthenticatorType.TOTP, // type - "", // otp new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/delete-push-target.md b/docs/examples/java/account/delete-push-target.md index 484fc2c..366a473 100644 --- a/docs/examples/java/account/delete-push-target.md +++ b/docs/examples/java/account/delete-push-target.md @@ -4,12 +4,12 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.deletePushTarget( - "", // targetId + "{$example}", // targetId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/delete-session.md b/docs/examples/java/account/delete-session.md index 4344061..cb152f4 100644 --- a/docs/examples/java/account/delete-session.md +++ b/docs/examples/java/account/delete-session.md @@ -4,12 +4,12 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.deleteSession( - "", // sessionId + "{$example}", // sessionId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/delete-sessions.md b/docs/examples/java/account/delete-sessions.md index 147523e..d4c4380 100644 --- a/docs/examples/java/account/delete-sessions.md +++ b/docs/examples/java/account/delete-sessions.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/get-mfa-recovery-codes.md b/docs/examples/java/account/get-mfa-recovery-codes.md index 14e5023..acf5984 100644 --- a/docs/examples/java/account/get-mfa-recovery-codes.md +++ b/docs/examples/java/account/get-mfa-recovery-codes.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/get-prefs.md b/docs/examples/java/account/get-prefs.md index bfa3c1a..0fea3fe 100644 --- a/docs/examples/java/account/get-prefs.md +++ b/docs/examples/java/account/get-prefs.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/get-session.md b/docs/examples/java/account/get-session.md index 470f643..627026d 100644 --- a/docs/examples/java/account/get-session.md +++ b/docs/examples/java/account/get-session.md @@ -4,12 +4,12 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.getSession( - "", // sessionId + "{$example}", // sessionId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/get.md b/docs/examples/java/account/get.md index 9006cb8..5c25ed0 100644 --- a/docs/examples/java/account/get.md +++ b/docs/examples/java/account/get.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/list-identities.md b/docs/examples/java/account/list-identities.md index cb5f74e..7f9449d 100644 --- a/docs/examples/java/account/list-identities.md +++ b/docs/examples/java/account/list-identities.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/list-logs.md b/docs/examples/java/account/list-logs.md index 998d8a8..3aa66e2 100644 --- a/docs/examples/java/account/list-logs.md +++ b/docs/examples/java/account/list-logs.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/list-mfa-factors.md b/docs/examples/java/account/list-mfa-factors.md index e1a6fa6..a10cb8d 100644 --- a/docs/examples/java/account/list-mfa-factors.md +++ b/docs/examples/java/account/list-mfa-factors.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/list-sessions.md b/docs/examples/java/account/list-sessions.md index 9e70f0d..aa8d37b 100644 --- a/docs/examples/java/account/list-sessions.md +++ b/docs/examples/java/account/list-sessions.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/update-email.md b/docs/examples/java/account/update-email.md index 13c5b65..37894f7 100644 --- a/docs/examples/java/account/update-email.md +++ b/docs/examples/java/account/update-email.md @@ -4,13 +4,13 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.updateEmail( - "email@example.com", // email - "password", // password + "{$example}", // email + "{$example}", // password new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-m-f-a.md b/docs/examples/java/account/update-m-f-a.md index 7c774c7..620a20c 100644 --- a/docs/examples/java/account/update-m-f-a.md +++ b/docs/examples/java/account/update-m-f-a.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/update-magic-u-r-l-session.md b/docs/examples/java/account/update-magic-u-r-l-session.md index 339b1f7..4f09fb3 100644 --- a/docs/examples/java/account/update-magic-u-r-l-session.md +++ b/docs/examples/java/account/update-magic-u-r-l-session.md @@ -4,13 +4,13 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.updateMagicURLSession( - "", // userId - "", // secret + "{$example}", // userId + "{$example}", // secret new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-mfa-authenticator.md b/docs/examples/java/account/update-mfa-authenticator.md index 44bb7f0..9b3c3f6 100644 --- a/docs/examples/java/account/update-mfa-authenticator.md +++ b/docs/examples/java/account/update-mfa-authenticator.md @@ -5,13 +5,13 @@ import io.appwrite.enums.AuthenticatorType; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.updateMfaAuthenticator( AuthenticatorType.TOTP, // type - "", // otp + "{$example}", // otp new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-mfa-challenge.md b/docs/examples/java/account/update-mfa-challenge.md index e30c733..c898904 100644 --- a/docs/examples/java/account/update-mfa-challenge.md +++ b/docs/examples/java/account/update-mfa-challenge.md @@ -4,13 +4,13 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.updateMfaChallenge( - "", // challengeId - "", // otp + "{$example}", // challengeId + "{$example}", // otp new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-mfa-recovery-codes.md b/docs/examples/java/account/update-mfa-recovery-codes.md index 880d478..2aa82b1 100644 --- a/docs/examples/java/account/update-mfa-recovery-codes.md +++ b/docs/examples/java/account/update-mfa-recovery-codes.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/update-name.md b/docs/examples/java/account/update-name.md index ff23ace..cd00362 100644 --- a/docs/examples/java/account/update-name.md +++ b/docs/examples/java/account/update-name.md @@ -4,12 +4,12 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.updateName( - "", // name + "{$example}", // name new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-password.md b/docs/examples/java/account/update-password.md index 764debf..a8b9be7 100644 --- a/docs/examples/java/account/update-password.md +++ b/docs/examples/java/account/update-password.md @@ -4,13 +4,13 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.updatePassword( "", // password - "password", // oldPassword (optional) + "{$example}", // oldPassword (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-phone-session.md b/docs/examples/java/account/update-phone-session.md index 69d2dd7..9166d36 100644 --- a/docs/examples/java/account/update-phone-session.md +++ b/docs/examples/java/account/update-phone-session.md @@ -4,13 +4,13 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.updatePhoneSession( - "", // userId - "", // secret + "{$example}", // userId + "{$example}", // secret new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-phone-verification.md b/docs/examples/java/account/update-phone-verification.md index 304e73e..eb50644 100644 --- a/docs/examples/java/account/update-phone-verification.md +++ b/docs/examples/java/account/update-phone-verification.md @@ -4,13 +4,13 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.updatePhoneVerification( - "", // userId - "", // secret + "{$example}", // userId + "{$example}", // secret new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-phone.md b/docs/examples/java/account/update-phone.md index 795700a..1e7a1bc 100644 --- a/docs/examples/java/account/update-phone.md +++ b/docs/examples/java/account/update-phone.md @@ -4,13 +4,13 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.updatePhone( - "+12065550100", // phone - "password", // password + "{$example}", // phone + "{$example}", // password new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-prefs.md b/docs/examples/java/account/update-prefs.md index 71eae4c..d746067 100644 --- a/docs/examples/java/account/update-prefs.md +++ b/docs/examples/java/account/update-prefs.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/update-push-target.md b/docs/examples/java/account/update-push-target.md index 90dc29e..15f9b0a 100644 --- a/docs/examples/java/account/update-push-target.md +++ b/docs/examples/java/account/update-push-target.md @@ -4,13 +4,13 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.updatePushTarget( - "", // targetId - "", // identifier + "{$example}", // targetId + "{$example}", // identifier new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-recovery.md b/docs/examples/java/account/update-recovery.md index 527351c..9ec90c3 100644 --- a/docs/examples/java/account/update-recovery.md +++ b/docs/examples/java/account/update-recovery.md @@ -4,13 +4,13 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.updateRecovery( - "", // userId - "", // secret + "{$example}", // userId + "{$example}", // secret "", // password new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/account/update-session.md b/docs/examples/java/account/update-session.md index e2ef0c3..d6093d9 100644 --- a/docs/examples/java/account/update-session.md +++ b/docs/examples/java/account/update-session.md @@ -4,12 +4,12 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.updateSession( - "", // sessionId + "{$example}", // sessionId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-status.md b/docs/examples/java/account/update-status.md index 61cb944..2216649 100644 --- a/docs/examples/java/account/update-status.md +++ b/docs/examples/java/account/update-status.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/update-verification.md b/docs/examples/java/account/update-verification.md index 3f14196..ebced41 100644 --- a/docs/examples/java/account/update-verification.md +++ b/docs/examples/java/account/update-verification.md @@ -4,13 +4,13 @@ import io.appwrite.services.Account; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Account account = new Account(client); account.updateVerification( - "", // userId - "", // secret + "{$example}", // userId + "{$example}", // secret new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/avatars/get-browser.md b/docs/examples/java/avatars/get-browser.md index a7b9e7f..f7e8651 100644 --- a/docs/examples/java/avatars/get-browser.md +++ b/docs/examples/java/avatars/get-browser.md @@ -5,7 +5,7 @@ import io.appwrite.enums.Browser; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Avatars avatars = new Avatars(client); diff --git a/docs/examples/java/avatars/get-credit-card.md b/docs/examples/java/avatars/get-credit-card.md index 61a8a51..5b1ee06 100644 --- a/docs/examples/java/avatars/get-credit-card.md +++ b/docs/examples/java/avatars/get-credit-card.md @@ -5,7 +5,7 @@ import io.appwrite.enums.CreditCard; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Avatars avatars = new Avatars(client); diff --git a/docs/examples/java/avatars/get-favicon.md b/docs/examples/java/avatars/get-favicon.md index d2f86c0..ac8e6e6 100644 --- a/docs/examples/java/avatars/get-favicon.md +++ b/docs/examples/java/avatars/get-favicon.md @@ -4,12 +4,12 @@ import io.appwrite.services.Avatars; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Avatars avatars = new Avatars(client); avatars.getFavicon( - "https://example.com", // url + "{$example}", // url new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/avatars/get-flag.md b/docs/examples/java/avatars/get-flag.md index dc8cc29..6a2185c 100644 --- a/docs/examples/java/avatars/get-flag.md +++ b/docs/examples/java/avatars/get-flag.md @@ -5,7 +5,7 @@ import io.appwrite.enums.Flag; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Avatars avatars = new Avatars(client); diff --git a/docs/examples/java/avatars/get-image.md b/docs/examples/java/avatars/get-image.md index 81e8029..85eacb1 100644 --- a/docs/examples/java/avatars/get-image.md +++ b/docs/examples/java/avatars/get-image.md @@ -4,12 +4,12 @@ import io.appwrite.services.Avatars; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Avatars avatars = new Avatars(client); avatars.getImage( - "https://example.com", // url + "{$example}", // url 0, // width (optional) 0, // height (optional) new CoroutineCallback<>((result, error) -> { diff --git a/docs/examples/java/avatars/get-initials.md b/docs/examples/java/avatars/get-initials.md index f6c3ee6..d687c7b 100644 --- a/docs/examples/java/avatars/get-initials.md +++ b/docs/examples/java/avatars/get-initials.md @@ -4,12 +4,12 @@ import io.appwrite.services.Avatars; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Avatars avatars = new Avatars(client); avatars.getInitials( - "", // name (optional) + "{$example}", // name (optional) 0, // width (optional) 0, // height (optional) "", // background (optional) diff --git a/docs/examples/java/avatars/get-q-r.md b/docs/examples/java/avatars/get-q-r.md index d75b3b3..05a5e8d 100644 --- a/docs/examples/java/avatars/get-q-r.md +++ b/docs/examples/java/avatars/get-q-r.md @@ -4,12 +4,12 @@ import io.appwrite.services.Avatars; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Avatars avatars = new Avatars(client); avatars.getQR( - "", // text + "{$example}", // text 1, // size (optional) 0, // margin (optional) false, // download (optional) diff --git a/docs/examples/java/databases/create-document.md b/docs/examples/java/databases/create-document.md index 361d5fe..fc0465f 100644 --- a/docs/examples/java/databases/create-document.md +++ b/docs/examples/java/databases/create-document.md @@ -4,14 +4,14 @@ import io.appwrite.services.Databases; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Databases databases = new Databases(client); databases.createDocument( - "", // databaseId - "", // collectionId - "", // documentId + "{$example}", // databaseId + "{$example}", // collectionId + "{$example}", // documentId mapOf( "a" to "b" ), // data listOf("read("any")"), // permissions (optional) new CoroutineCallback<>((result, error) -> { diff --git a/docs/examples/java/databases/delete-document.md b/docs/examples/java/databases/delete-document.md index 26b67a2..50bd674 100644 --- a/docs/examples/java/databases/delete-document.md +++ b/docs/examples/java/databases/delete-document.md @@ -4,14 +4,14 @@ import io.appwrite.services.Databases; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Databases databases = new Databases(client); databases.deleteDocument( - "", // databaseId - "", // collectionId - "", // documentId + "{$example}", // databaseId + "{$example}", // collectionId + "{$example}", // documentId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/databases/get-document.md b/docs/examples/java/databases/get-document.md index ac89489..cbcca6e 100644 --- a/docs/examples/java/databases/get-document.md +++ b/docs/examples/java/databases/get-document.md @@ -4,14 +4,14 @@ import io.appwrite.services.Databases; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Databases databases = new Databases(client); databases.getDocument( - "", // databaseId - "", // collectionId - "", // documentId + "{$example}", // databaseId + "{$example}", // collectionId + "{$example}", // documentId listOf(), // queries (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/databases/list-documents.md b/docs/examples/java/databases/list-documents.md index 9f70425..a63e929 100644 --- a/docs/examples/java/databases/list-documents.md +++ b/docs/examples/java/databases/list-documents.md @@ -4,13 +4,13 @@ import io.appwrite.services.Databases; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Databases databases = new Databases(client); databases.listDocuments( - "", // databaseId - "", // collectionId + "{$example}", // databaseId + "{$example}", // collectionId listOf(), // queries (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/databases/update-document.md b/docs/examples/java/databases/update-document.md index 430a617..3831c2d 100644 --- a/docs/examples/java/databases/update-document.md +++ b/docs/examples/java/databases/update-document.md @@ -4,14 +4,14 @@ import io.appwrite.services.Databases; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Databases databases = new Databases(client); databases.updateDocument( - "", // databaseId - "", // collectionId - "", // documentId + "{$example}", // databaseId + "{$example}", // collectionId + "{$example}", // documentId mapOf( "a" to "b" ), // data (optional) listOf("read("any")"), // permissions (optional) new CoroutineCallback<>((result, error) -> { diff --git a/docs/examples/java/functions/create-execution.md b/docs/examples/java/functions/create-execution.md index 0db569b..89bf4c1 100644 --- a/docs/examples/java/functions/create-execution.md +++ b/docs/examples/java/functions/create-execution.md @@ -4,17 +4,18 @@ import io.appwrite.services.Functions; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Functions functions = new Functions(client); functions.createExecution( - "", // functionId - "", // body (optional) + "{$example}", // functionId + Payload.fromJson(mapOf("x" to "y" as Any)), // body (optional) false, // async (optional) - "", // path (optional) + "{$example}", // path (optional) ExecutionMethod.GET, // method (optional) mapOf( "a" to "b" ), // headers (optional) + "", // scheduledAt (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/functions/get-execution.md b/docs/examples/java/functions/get-execution.md index 66bf263..feabf8f 100644 --- a/docs/examples/java/functions/get-execution.md +++ b/docs/examples/java/functions/get-execution.md @@ -4,13 +4,13 @@ import io.appwrite.services.Functions; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Functions functions = new Functions(client); functions.getExecution( - "", // functionId - "", // executionId + "{$example}", // functionId + "{$example}", // executionId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/functions/list-executions.md b/docs/examples/java/functions/list-executions.md index 1bb510a..1efd982 100644 --- a/docs/examples/java/functions/list-executions.md +++ b/docs/examples/java/functions/list-executions.md @@ -4,14 +4,14 @@ import io.appwrite.services.Functions; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Functions functions = new Functions(client); functions.listExecutions( - "", // functionId + "{$example}", // functionId listOf(), // queries (optional) - "", // search (optional) + "{$example}", // search (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/graphql/mutation.md b/docs/examples/java/graphql/mutation.md index a7e5f6e..b79903b 100644 --- a/docs/examples/java/graphql/mutation.md +++ b/docs/examples/java/graphql/mutation.md @@ -4,7 +4,7 @@ import io.appwrite.services.Graphql; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Graphql graphql = new Graphql(client); diff --git a/docs/examples/java/graphql/query.md b/docs/examples/java/graphql/query.md index a6420b4..82bad13 100644 --- a/docs/examples/java/graphql/query.md +++ b/docs/examples/java/graphql/query.md @@ -4,7 +4,7 @@ import io.appwrite.services.Graphql; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Graphql graphql = new Graphql(client); diff --git a/docs/examples/java/locale/get.md b/docs/examples/java/locale/get.md index cc37896..29b542f 100644 --- a/docs/examples/java/locale/get.md +++ b/docs/examples/java/locale/get.md @@ -4,7 +4,7 @@ import io.appwrite.services.Locale; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Locale locale = new Locale(client); diff --git a/docs/examples/java/locale/list-codes.md b/docs/examples/java/locale/list-codes.md index 3fbdf85..d8c9a0b 100644 --- a/docs/examples/java/locale/list-codes.md +++ b/docs/examples/java/locale/list-codes.md @@ -4,7 +4,7 @@ import io.appwrite.services.Locale; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Locale locale = new Locale(client); diff --git a/docs/examples/java/locale/list-continents.md b/docs/examples/java/locale/list-continents.md index 296eade..cf43045 100644 --- a/docs/examples/java/locale/list-continents.md +++ b/docs/examples/java/locale/list-continents.md @@ -4,7 +4,7 @@ import io.appwrite.services.Locale; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Locale locale = new Locale(client); diff --git a/docs/examples/java/locale/list-countries-e-u.md b/docs/examples/java/locale/list-countries-e-u.md index f674ac5..b7b56ab 100644 --- a/docs/examples/java/locale/list-countries-e-u.md +++ b/docs/examples/java/locale/list-countries-e-u.md @@ -4,7 +4,7 @@ import io.appwrite.services.Locale; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Locale locale = new Locale(client); diff --git a/docs/examples/java/locale/list-countries-phones.md b/docs/examples/java/locale/list-countries-phones.md index 6280cbb..c3598c0 100644 --- a/docs/examples/java/locale/list-countries-phones.md +++ b/docs/examples/java/locale/list-countries-phones.md @@ -4,7 +4,7 @@ import io.appwrite.services.Locale; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Locale locale = new Locale(client); diff --git a/docs/examples/java/locale/list-countries.md b/docs/examples/java/locale/list-countries.md index eab9ae2..91ac052 100644 --- a/docs/examples/java/locale/list-countries.md +++ b/docs/examples/java/locale/list-countries.md @@ -4,7 +4,7 @@ import io.appwrite.services.Locale; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Locale locale = new Locale(client); diff --git a/docs/examples/java/locale/list-currencies.md b/docs/examples/java/locale/list-currencies.md index 662e025..5233004 100644 --- a/docs/examples/java/locale/list-currencies.md +++ b/docs/examples/java/locale/list-currencies.md @@ -4,7 +4,7 @@ import io.appwrite.services.Locale; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Locale locale = new Locale(client); diff --git a/docs/examples/java/locale/list-languages.md b/docs/examples/java/locale/list-languages.md index dd68bf2..0f10563 100644 --- a/docs/examples/java/locale/list-languages.md +++ b/docs/examples/java/locale/list-languages.md @@ -4,7 +4,7 @@ import io.appwrite.services.Locale; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Locale locale = new Locale(client); diff --git a/docs/examples/java/messaging/create-subscriber.md b/docs/examples/java/messaging/create-subscriber.md index e83b43c..1ce5d6d 100644 --- a/docs/examples/java/messaging/create-subscriber.md +++ b/docs/examples/java/messaging/create-subscriber.md @@ -4,14 +4,14 @@ import io.appwrite.services.Messaging; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Messaging messaging = new Messaging(client); messaging.createSubscriber( - "", // topicId - "", // subscriberId - "", // targetId + "{$example}", // topicId + "{$example}", // subscriberId + "{$example}", // targetId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/messaging/delete-subscriber.md b/docs/examples/java/messaging/delete-subscriber.md index 5e8302b..07fbd2f 100644 --- a/docs/examples/java/messaging/delete-subscriber.md +++ b/docs/examples/java/messaging/delete-subscriber.md @@ -4,13 +4,13 @@ import io.appwrite.services.Messaging; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Messaging messaging = new Messaging(client); messaging.deleteSubscriber( - "", // topicId - "", // subscriberId + "{$example}", // topicId + "{$example}", // subscriberId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/storage/create-file.md b/docs/examples/java/storage/create-file.md index a060552..6da1bf5 100644 --- a/docs/examples/java/storage/create-file.md +++ b/docs/examples/java/storage/create-file.md @@ -1,18 +1,18 @@ import io.appwrite.Client; import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.models.InputFile; +import io.appwrite.models.Payload; import io.appwrite.services.Storage; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Storage storage = new Storage(client); storage.createFile( - "", // bucketId - "", // fileId - InputFile.fromPath("file.png"), // file + "{$example}", // bucketId + "{$example}", // fileId + Payload.fromFile("/path/to/file.png"), // file listOf("read("any")"), // permissions (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/storage/delete-file.md b/docs/examples/java/storage/delete-file.md index 113dfce..1defa04 100644 --- a/docs/examples/java/storage/delete-file.md +++ b/docs/examples/java/storage/delete-file.md @@ -4,13 +4,13 @@ import io.appwrite.services.Storage; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Storage storage = new Storage(client); storage.deleteFile( - "", // bucketId - "", // fileId + "{$example}", // bucketId + "{$example}", // fileId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/storage/get-file-download.md b/docs/examples/java/storage/get-file-download.md index 22207ca..611b5c7 100644 --- a/docs/examples/java/storage/get-file-download.md +++ b/docs/examples/java/storage/get-file-download.md @@ -4,13 +4,13 @@ import io.appwrite.services.Storage; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Storage storage = new Storage(client); storage.getFileDownload( - "", // bucketId - "", // fileId + "{$example}", // bucketId + "{$example}", // fileId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/storage/get-file-preview.md b/docs/examples/java/storage/get-file-preview.md index df81fb4..c29be40 100644 --- a/docs/examples/java/storage/get-file-preview.md +++ b/docs/examples/java/storage/get-file-preview.md @@ -4,13 +4,13 @@ import io.appwrite.services.Storage; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Storage storage = new Storage(client); storage.getFilePreview( - "", // bucketId - "", // fileId + "{$example}", // bucketId + "{$example}", // fileId 0, // width (optional) 0, // height (optional) ImageGravity.CENTER, // gravity (optional) diff --git a/docs/examples/java/storage/get-file-view.md b/docs/examples/java/storage/get-file-view.md index d64c3e6..5cac2ce 100644 --- a/docs/examples/java/storage/get-file-view.md +++ b/docs/examples/java/storage/get-file-view.md @@ -4,13 +4,13 @@ import io.appwrite.services.Storage; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Storage storage = new Storage(client); storage.getFileView( - "", // bucketId - "", // fileId + "{$example}", // bucketId + "{$example}", // fileId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/storage/get-file.md b/docs/examples/java/storage/get-file.md index b68bf78..54dd453 100644 --- a/docs/examples/java/storage/get-file.md +++ b/docs/examples/java/storage/get-file.md @@ -4,13 +4,13 @@ import io.appwrite.services.Storage; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Storage storage = new Storage(client); storage.getFile( - "", // bucketId - "", // fileId + "{$example}", // bucketId + "{$example}", // fileId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/storage/list-files.md b/docs/examples/java/storage/list-files.md index 8b84ecb..56ec1a8 100644 --- a/docs/examples/java/storage/list-files.md +++ b/docs/examples/java/storage/list-files.md @@ -4,14 +4,14 @@ import io.appwrite.services.Storage; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Storage storage = new Storage(client); storage.listFiles( - "", // bucketId + "{$example}", // bucketId listOf(), // queries (optional) - "", // search (optional) + "{$example}", // search (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/storage/update-file.md b/docs/examples/java/storage/update-file.md index 12b6443..563a413 100644 --- a/docs/examples/java/storage/update-file.md +++ b/docs/examples/java/storage/update-file.md @@ -4,14 +4,14 @@ import io.appwrite.services.Storage; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Storage storage = new Storage(client); storage.updateFile( - "", // bucketId - "", // fileId - "", // name (optional) + "{$example}", // bucketId + "{$example}", // fileId + "{$example}", // name (optional) listOf("read("any")"), // permissions (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/teams/create-membership.md b/docs/examples/java/teams/create-membership.md index 468571e..60461af 100644 --- a/docs/examples/java/teams/create-membership.md +++ b/docs/examples/java/teams/create-membership.md @@ -4,18 +4,18 @@ import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Teams teams = new Teams(client); teams.createMembership( - "", // teamId + "{$example}", // teamId listOf(), // roles - "email@example.com", // email (optional) - "", // userId (optional) - "+12065550100", // phone (optional) - "https://example.com", // url (optional) - "", // name (optional) + "{$example}", // email (optional) + "{$example}", // userId (optional) + "{$example}", // phone (optional) + "{$example}", // url (optional) + "{$example}", // name (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/teams/create.md b/docs/examples/java/teams/create.md index 3c757ac..00f691b 100644 --- a/docs/examples/java/teams/create.md +++ b/docs/examples/java/teams/create.md @@ -4,13 +4,13 @@ import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Teams teams = new Teams(client); teams.create( - "", // teamId - "", // name + "{$example}", // teamId + "{$example}", // name listOf(), // roles (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/teams/delete-membership.md b/docs/examples/java/teams/delete-membership.md index e23409f..bf6c877 100644 --- a/docs/examples/java/teams/delete-membership.md +++ b/docs/examples/java/teams/delete-membership.md @@ -4,13 +4,13 @@ import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Teams teams = new Teams(client); teams.deleteMembership( - "", // teamId - "", // membershipId + "{$example}", // teamId + "{$example}", // membershipId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/teams/delete.md b/docs/examples/java/teams/delete.md index 567ea3d..aa8bfac 100644 --- a/docs/examples/java/teams/delete.md +++ b/docs/examples/java/teams/delete.md @@ -4,12 +4,12 @@ import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Teams teams = new Teams(client); teams.delete( - "", // teamId + "{$example}", // teamId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/teams/get-membership.md b/docs/examples/java/teams/get-membership.md index c09a267..6da129e 100644 --- a/docs/examples/java/teams/get-membership.md +++ b/docs/examples/java/teams/get-membership.md @@ -4,13 +4,13 @@ import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Teams teams = new Teams(client); teams.getMembership( - "", // teamId - "", // membershipId + "{$example}", // teamId + "{$example}", // membershipId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/teams/get-prefs.md b/docs/examples/java/teams/get-prefs.md index 48a9815..81f344b 100644 --- a/docs/examples/java/teams/get-prefs.md +++ b/docs/examples/java/teams/get-prefs.md @@ -4,12 +4,12 @@ import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Teams teams = new Teams(client); teams.getPrefs( - "", // teamId + "{$example}", // teamId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/teams/get.md b/docs/examples/java/teams/get.md index 20a6f6a..c53aeba 100644 --- a/docs/examples/java/teams/get.md +++ b/docs/examples/java/teams/get.md @@ -4,12 +4,12 @@ import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Teams teams = new Teams(client); teams.get( - "", // teamId + "{$example}", // teamId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/teams/list-memberships.md b/docs/examples/java/teams/list-memberships.md index 2de609c..137ee2a 100644 --- a/docs/examples/java/teams/list-memberships.md +++ b/docs/examples/java/teams/list-memberships.md @@ -4,14 +4,14 @@ import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Teams teams = new Teams(client); teams.listMemberships( - "", // teamId + "{$example}", // teamId listOf(), // queries (optional) - "", // search (optional) + "{$example}", // search (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/teams/list.md b/docs/examples/java/teams/list.md index 7f7910c..e918ac8 100644 --- a/docs/examples/java/teams/list.md +++ b/docs/examples/java/teams/list.md @@ -4,13 +4,13 @@ import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Teams teams = new Teams(client); teams.list( listOf(), // queries (optional) - "", // search (optional) + "{$example}", // search (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/teams/update-membership-status.md b/docs/examples/java/teams/update-membership-status.md index 97e8242..80bfe17 100644 --- a/docs/examples/java/teams/update-membership-status.md +++ b/docs/examples/java/teams/update-membership-status.md @@ -4,15 +4,15 @@ import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Teams teams = new Teams(client); teams.updateMembershipStatus( - "", // teamId - "", // membershipId - "", // userId - "", // secret + "{$example}", // teamId + "{$example}", // membershipId + "{$example}", // userId + "{$example}", // secret new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/teams/update-membership.md b/docs/examples/java/teams/update-membership.md index 86f0ddd..69c99b6 100644 --- a/docs/examples/java/teams/update-membership.md +++ b/docs/examples/java/teams/update-membership.md @@ -4,13 +4,13 @@ import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Teams teams = new Teams(client); teams.updateMembership( - "", // teamId - "", // membershipId + "{$example}", // teamId + "{$example}", // membershipId listOf(), // roles new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/teams/update-name.md b/docs/examples/java/teams/update-name.md index 1aa96f8..7d9d96d 100644 --- a/docs/examples/java/teams/update-name.md +++ b/docs/examples/java/teams/update-name.md @@ -4,13 +4,13 @@ import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Teams teams = new Teams(client); teams.updateName( - "", // teamId - "", // name + "{$example}", // teamId + "{$example}", // name new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/teams/update-prefs.md b/docs/examples/java/teams/update-prefs.md index e188a99..334fd6d 100644 --- a/docs/examples/java/teams/update-prefs.md +++ b/docs/examples/java/teams/update-prefs.md @@ -4,12 +4,12 @@ import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2"); // Your project ID + .setProject(""); // Your project ID Teams teams = new Teams(client); teams.updatePrefs( - "", // teamId + "{$example}", // teamId mapOf( "a" to "b" ), // prefs new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/kotlin/account/create-anonymous-session.md b/docs/examples/kotlin/account/create-anonymous-session.md index 7961cc0..50a011a 100644 --- a/docs/examples/kotlin/account/create-anonymous-session.md +++ b/docs/examples/kotlin/account/create-anonymous-session.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/create-email-password-session.md b/docs/examples/kotlin/account/create-email-password-session.md index 57bc99b..6b69b3a 100644 --- a/docs/examples/kotlin/account/create-email-password-session.md +++ b/docs/examples/kotlin/account/create-email-password-session.md @@ -4,11 +4,11 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.createEmailPasswordSession( - email = "email@example.com", - password = "password", + email = "{$example}", + password = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/create-email-token.md b/docs/examples/kotlin/account/create-email-token.md index dd0bdf3..46e6926 100644 --- a/docs/examples/kotlin/account/create-email-token.md +++ b/docs/examples/kotlin/account/create-email-token.md @@ -4,12 +4,12 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.createEmailToken( - userId = "", - email = "email@example.com", + userId = "{$example}", + email = "{$example}", phrase = false, // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/create-j-w-t.md b/docs/examples/kotlin/account/create-j-w-t.md index 3aefe4a..50014d4 100644 --- a/docs/examples/kotlin/account/create-j-w-t.md +++ b/docs/examples/kotlin/account/create-j-w-t.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/create-magic-u-r-l-token.md b/docs/examples/kotlin/account/create-magic-u-r-l-token.md index dad908e..9851dab 100644 --- a/docs/examples/kotlin/account/create-magic-u-r-l-token.md +++ b/docs/examples/kotlin/account/create-magic-u-r-l-token.md @@ -4,13 +4,13 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.createMagicURLToken( - userId = "", - email = "email@example.com", - url = "https://example.com", // (optional) + userId = "{$example}", + email = "{$example}", + url = "{$example}", // (optional) phrase = false, // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/create-mfa-authenticator.md b/docs/examples/kotlin/account/create-mfa-authenticator.md index f2ff748..dacf56a 100644 --- a/docs/examples/kotlin/account/create-mfa-authenticator.md +++ b/docs/examples/kotlin/account/create-mfa-authenticator.md @@ -5,7 +5,7 @@ import io.appwrite.enums.AuthenticatorType val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/create-mfa-challenge.md b/docs/examples/kotlin/account/create-mfa-challenge.md index d43aa39..22c9658 100644 --- a/docs/examples/kotlin/account/create-mfa-challenge.md +++ b/docs/examples/kotlin/account/create-mfa-challenge.md @@ -5,7 +5,7 @@ import io.appwrite.enums.AuthenticationFactor val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/create-mfa-recovery-codes.md b/docs/examples/kotlin/account/create-mfa-recovery-codes.md index be25e74..364bc0e 100644 --- a/docs/examples/kotlin/account/create-mfa-recovery-codes.md +++ b/docs/examples/kotlin/account/create-mfa-recovery-codes.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/create-o-auth2session.md b/docs/examples/kotlin/account/create-o-auth2session.md index d642de8..7f63375 100644 --- a/docs/examples/kotlin/account/create-o-auth2session.md +++ b/docs/examples/kotlin/account/create-o-auth2session.md @@ -5,13 +5,13 @@ import io.appwrite.enums.OAuthProvider val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) account.createOAuth2Session( provider = OAuthProvider.AMAZON, - success = "https://example.com", // (optional) - failure = "https://example.com", // (optional) + success = "{$example}", // (optional) + failure = "{$example}", // (optional) scopes = listOf(), // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/create-o-auth2token.md b/docs/examples/kotlin/account/create-o-auth2token.md index 7d651b1..7607380 100644 --- a/docs/examples/kotlin/account/create-o-auth2token.md +++ b/docs/examples/kotlin/account/create-o-auth2token.md @@ -5,13 +5,13 @@ import io.appwrite.enums.OAuthProvider val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) account.createOAuth2Token( provider = OAuthProvider.AMAZON, - success = "https://example.com", // (optional) - failure = "https://example.com", // (optional) + success = "{$example}", // (optional) + failure = "{$example}", // (optional) scopes = listOf(), // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/create-phone-token.md b/docs/examples/kotlin/account/create-phone-token.md index 9e72059..acea79b 100644 --- a/docs/examples/kotlin/account/create-phone-token.md +++ b/docs/examples/kotlin/account/create-phone-token.md @@ -4,11 +4,11 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.createPhoneToken( - userId = "", - phone = "+12065550100", + userId = "{$example}", + phone = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/create-phone-verification.md b/docs/examples/kotlin/account/create-phone-verification.md index 3c94fb8..531aead 100644 --- a/docs/examples/kotlin/account/create-phone-verification.md +++ b/docs/examples/kotlin/account/create-phone-verification.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/create-push-target.md b/docs/examples/kotlin/account/create-push-target.md index 66729cc..df6d9fe 100644 --- a/docs/examples/kotlin/account/create-push-target.md +++ b/docs/examples/kotlin/account/create-push-target.md @@ -4,12 +4,12 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.createPushTarget( - targetId = "", - identifier = "", - providerId = "", // (optional) + targetId = "{$example}", + identifier = "{$example}", + providerId = "{$example}", // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/create-recovery.md b/docs/examples/kotlin/account/create-recovery.md index 8afb76c..13e8fbc 100644 --- a/docs/examples/kotlin/account/create-recovery.md +++ b/docs/examples/kotlin/account/create-recovery.md @@ -4,11 +4,11 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.createRecovery( - email = "email@example.com", - url = "https://example.com", + email = "{$example}", + url = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/create-session.md b/docs/examples/kotlin/account/create-session.md index 49daa6b..000ddb8 100644 --- a/docs/examples/kotlin/account/create-session.md +++ b/docs/examples/kotlin/account/create-session.md @@ -4,11 +4,11 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.createSession( - userId = "", - secret = "", + userId = "{$example}", + secret = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/create-verification.md b/docs/examples/kotlin/account/create-verification.md index 0638a36..e0a6b38 100644 --- a/docs/examples/kotlin/account/create-verification.md +++ b/docs/examples/kotlin/account/create-verification.md @@ -4,10 +4,10 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.createVerification( - url = "https://example.com", + url = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/create.md b/docs/examples/kotlin/account/create.md index 48b8b66..38fbca9 100644 --- a/docs/examples/kotlin/account/create.md +++ b/docs/examples/kotlin/account/create.md @@ -4,13 +4,13 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.create( - userId = "", - email = "email@example.com", + userId = "{$example}", + email = "{$example}", password = "", - name = "", // (optional) + name = "{$example}", // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/delete-identity.md b/docs/examples/kotlin/account/delete-identity.md index 099b5ac..78bdc8d 100644 --- a/docs/examples/kotlin/account/delete-identity.md +++ b/docs/examples/kotlin/account/delete-identity.md @@ -4,10 +4,10 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.deleteIdentity( - identityId = "", + identityId = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/delete-mfa-authenticator.md b/docs/examples/kotlin/account/delete-mfa-authenticator.md index c07afd0..48220b2 100644 --- a/docs/examples/kotlin/account/delete-mfa-authenticator.md +++ b/docs/examples/kotlin/account/delete-mfa-authenticator.md @@ -5,11 +5,10 @@ import io.appwrite.enums.AuthenticatorType val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.deleteMfaAuthenticator( type = AuthenticatorType.TOTP, - otp = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/delete-push-target.md b/docs/examples/kotlin/account/delete-push-target.md index c20d04a..257bd3e 100644 --- a/docs/examples/kotlin/account/delete-push-target.md +++ b/docs/examples/kotlin/account/delete-push-target.md @@ -4,10 +4,10 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.deletePushTarget( - targetId = "", + targetId = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/delete-session.md b/docs/examples/kotlin/account/delete-session.md index ae2ed67..53db6d4 100644 --- a/docs/examples/kotlin/account/delete-session.md +++ b/docs/examples/kotlin/account/delete-session.md @@ -4,10 +4,10 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.deleteSession( - sessionId = "", + sessionId = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/delete-sessions.md b/docs/examples/kotlin/account/delete-sessions.md index 7caaea4..8c464e0 100644 --- a/docs/examples/kotlin/account/delete-sessions.md +++ b/docs/examples/kotlin/account/delete-sessions.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/get-mfa-recovery-codes.md b/docs/examples/kotlin/account/get-mfa-recovery-codes.md index 4a1652c..bd12e83 100644 --- a/docs/examples/kotlin/account/get-mfa-recovery-codes.md +++ b/docs/examples/kotlin/account/get-mfa-recovery-codes.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/get-prefs.md b/docs/examples/kotlin/account/get-prefs.md index 08fdd13..9227eff 100644 --- a/docs/examples/kotlin/account/get-prefs.md +++ b/docs/examples/kotlin/account/get-prefs.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/get-session.md b/docs/examples/kotlin/account/get-session.md index d0520ce..bb39027 100644 --- a/docs/examples/kotlin/account/get-session.md +++ b/docs/examples/kotlin/account/get-session.md @@ -4,10 +4,10 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.getSession( - sessionId = "", + sessionId = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/get.md b/docs/examples/kotlin/account/get.md index ed4874b..8c90304 100644 --- a/docs/examples/kotlin/account/get.md +++ b/docs/examples/kotlin/account/get.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/list-identities.md b/docs/examples/kotlin/account/list-identities.md index bde6023..53e388d 100644 --- a/docs/examples/kotlin/account/list-identities.md +++ b/docs/examples/kotlin/account/list-identities.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/list-logs.md b/docs/examples/kotlin/account/list-logs.md index 56238f9..683a94b 100644 --- a/docs/examples/kotlin/account/list-logs.md +++ b/docs/examples/kotlin/account/list-logs.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/list-mfa-factors.md b/docs/examples/kotlin/account/list-mfa-factors.md index 9f8572c..ecfa6c2 100644 --- a/docs/examples/kotlin/account/list-mfa-factors.md +++ b/docs/examples/kotlin/account/list-mfa-factors.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/list-sessions.md b/docs/examples/kotlin/account/list-sessions.md index 9d64c74..2da413d 100644 --- a/docs/examples/kotlin/account/list-sessions.md +++ b/docs/examples/kotlin/account/list-sessions.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/update-email.md b/docs/examples/kotlin/account/update-email.md index 5068962..b2d749a 100644 --- a/docs/examples/kotlin/account/update-email.md +++ b/docs/examples/kotlin/account/update-email.md @@ -4,11 +4,11 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.updateEmail( - email = "email@example.com", - password = "password", + email = "{$example}", + password = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-m-f-a.md b/docs/examples/kotlin/account/update-m-f-a.md index 7949490..3cac098 100644 --- a/docs/examples/kotlin/account/update-m-f-a.md +++ b/docs/examples/kotlin/account/update-m-f-a.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/update-magic-u-r-l-session.md b/docs/examples/kotlin/account/update-magic-u-r-l-session.md index 0abb033..d4f2043 100644 --- a/docs/examples/kotlin/account/update-magic-u-r-l-session.md +++ b/docs/examples/kotlin/account/update-magic-u-r-l-session.md @@ -4,11 +4,11 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.updateMagicURLSession( - userId = "", - secret = "", + userId = "{$example}", + secret = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-mfa-authenticator.md b/docs/examples/kotlin/account/update-mfa-authenticator.md index 8b19680..3959917 100644 --- a/docs/examples/kotlin/account/update-mfa-authenticator.md +++ b/docs/examples/kotlin/account/update-mfa-authenticator.md @@ -5,11 +5,11 @@ import io.appwrite.enums.AuthenticatorType val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.updateMfaAuthenticator( type = AuthenticatorType.TOTP, - otp = "", + otp = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-mfa-challenge.md b/docs/examples/kotlin/account/update-mfa-challenge.md index fe4cb1e..40fa58e 100644 --- a/docs/examples/kotlin/account/update-mfa-challenge.md +++ b/docs/examples/kotlin/account/update-mfa-challenge.md @@ -4,11 +4,11 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.updateMfaChallenge( - challengeId = "", - otp = "", + challengeId = "{$example}", + otp = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-mfa-recovery-codes.md b/docs/examples/kotlin/account/update-mfa-recovery-codes.md index f39b7c6..d4ea7f5 100644 --- a/docs/examples/kotlin/account/update-mfa-recovery-codes.md +++ b/docs/examples/kotlin/account/update-mfa-recovery-codes.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/update-name.md b/docs/examples/kotlin/account/update-name.md index 20aab9d..0a52615 100644 --- a/docs/examples/kotlin/account/update-name.md +++ b/docs/examples/kotlin/account/update-name.md @@ -4,10 +4,10 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.updateName( - name = "", + name = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-password.md b/docs/examples/kotlin/account/update-password.md index 86c862c..75c57f4 100644 --- a/docs/examples/kotlin/account/update-password.md +++ b/docs/examples/kotlin/account/update-password.md @@ -4,11 +4,11 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.updatePassword( password = "", - oldPassword = "password", // (optional) + oldPassword = "{$example}", // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-phone-session.md b/docs/examples/kotlin/account/update-phone-session.md index 6c8fa65..31ccdef 100644 --- a/docs/examples/kotlin/account/update-phone-session.md +++ b/docs/examples/kotlin/account/update-phone-session.md @@ -4,11 +4,11 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.updatePhoneSession( - userId = "", - secret = "", + userId = "{$example}", + secret = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-phone-verification.md b/docs/examples/kotlin/account/update-phone-verification.md index 445a47e..9636ecd 100644 --- a/docs/examples/kotlin/account/update-phone-verification.md +++ b/docs/examples/kotlin/account/update-phone-verification.md @@ -4,11 +4,11 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.updatePhoneVerification( - userId = "", - secret = "", + userId = "{$example}", + secret = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-phone.md b/docs/examples/kotlin/account/update-phone.md index c8f50c3..3f882b2 100644 --- a/docs/examples/kotlin/account/update-phone.md +++ b/docs/examples/kotlin/account/update-phone.md @@ -4,11 +4,11 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.updatePhone( - phone = "+12065550100", - password = "password", + phone = "{$example}", + password = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-prefs.md b/docs/examples/kotlin/account/update-prefs.md index f449ccb..c5c7a3d 100644 --- a/docs/examples/kotlin/account/update-prefs.md +++ b/docs/examples/kotlin/account/update-prefs.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/update-push-target.md b/docs/examples/kotlin/account/update-push-target.md index 5fff554..315d770 100644 --- a/docs/examples/kotlin/account/update-push-target.md +++ b/docs/examples/kotlin/account/update-push-target.md @@ -4,11 +4,11 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.updatePushTarget( - targetId = "", - identifier = "", + targetId = "{$example}", + identifier = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-recovery.md b/docs/examples/kotlin/account/update-recovery.md index da1f27e..5e9866d 100644 --- a/docs/examples/kotlin/account/update-recovery.md +++ b/docs/examples/kotlin/account/update-recovery.md @@ -4,12 +4,12 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.updateRecovery( - userId = "", - secret = "", + userId = "{$example}", + secret = "{$example}", password = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-session.md b/docs/examples/kotlin/account/update-session.md index 3252039..e4b85a8 100644 --- a/docs/examples/kotlin/account/update-session.md +++ b/docs/examples/kotlin/account/update-session.md @@ -4,10 +4,10 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.updateSession( - sessionId = "", + sessionId = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-status.md b/docs/examples/kotlin/account/update-status.md index 2b54214..4f44ce1 100644 --- a/docs/examples/kotlin/account/update-status.md +++ b/docs/examples/kotlin/account/update-status.md @@ -4,7 +4,7 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/update-verification.md b/docs/examples/kotlin/account/update-verification.md index 5f7f902..7a58116 100644 --- a/docs/examples/kotlin/account/update-verification.md +++ b/docs/examples/kotlin/account/update-verification.md @@ -4,11 +4,11 @@ import io.appwrite.services.Account val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val account = Account(client) val result = account.updateVerification( - userId = "", - secret = "", + userId = "{$example}", + secret = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/avatars/get-browser.md b/docs/examples/kotlin/avatars/get-browser.md index 1e63217..34f6f28 100644 --- a/docs/examples/kotlin/avatars/get-browser.md +++ b/docs/examples/kotlin/avatars/get-browser.md @@ -5,7 +5,7 @@ import io.appwrite.enums.Browser val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val avatars = Avatars(client) diff --git a/docs/examples/kotlin/avatars/get-credit-card.md b/docs/examples/kotlin/avatars/get-credit-card.md index 23fbbfd..52eea79 100644 --- a/docs/examples/kotlin/avatars/get-credit-card.md +++ b/docs/examples/kotlin/avatars/get-credit-card.md @@ -5,7 +5,7 @@ import io.appwrite.enums.CreditCard val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val avatars = Avatars(client) diff --git a/docs/examples/kotlin/avatars/get-favicon.md b/docs/examples/kotlin/avatars/get-favicon.md index a2d5e18..b95f9c8 100644 --- a/docs/examples/kotlin/avatars/get-favicon.md +++ b/docs/examples/kotlin/avatars/get-favicon.md @@ -4,10 +4,10 @@ import io.appwrite.services.Avatars val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val avatars = Avatars(client) val result = avatars.getFavicon( - url = "https://example.com", + url = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/avatars/get-flag.md b/docs/examples/kotlin/avatars/get-flag.md index b1ac632..cfd5d01 100644 --- a/docs/examples/kotlin/avatars/get-flag.md +++ b/docs/examples/kotlin/avatars/get-flag.md @@ -5,7 +5,7 @@ import io.appwrite.enums.Flag val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val avatars = Avatars(client) diff --git a/docs/examples/kotlin/avatars/get-image.md b/docs/examples/kotlin/avatars/get-image.md index bb76b4c..64d8619 100644 --- a/docs/examples/kotlin/avatars/get-image.md +++ b/docs/examples/kotlin/avatars/get-image.md @@ -4,12 +4,12 @@ import io.appwrite.services.Avatars val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val avatars = Avatars(client) val result = avatars.getImage( - url = "https://example.com", + url = "{$example}", width = 0, // (optional) height = 0, // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/avatars/get-initials.md b/docs/examples/kotlin/avatars/get-initials.md index b2a1c25..c7388b0 100644 --- a/docs/examples/kotlin/avatars/get-initials.md +++ b/docs/examples/kotlin/avatars/get-initials.md @@ -4,12 +4,12 @@ import io.appwrite.services.Avatars val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val avatars = Avatars(client) val result = avatars.getInitials( - name = "", // (optional) + name = "{$example}", // (optional) width = 0, // (optional) height = 0, // (optional) background = "", // (optional) diff --git a/docs/examples/kotlin/avatars/get-q-r.md b/docs/examples/kotlin/avatars/get-q-r.md index 853d94e..1157d95 100644 --- a/docs/examples/kotlin/avatars/get-q-r.md +++ b/docs/examples/kotlin/avatars/get-q-r.md @@ -4,12 +4,12 @@ import io.appwrite.services.Avatars val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val avatars = Avatars(client) val result = avatars.getQR( - text = "", + text = "{$example}", size = 1, // (optional) margin = 0, // (optional) download = false, // (optional) diff --git a/docs/examples/kotlin/databases/create-document.md b/docs/examples/kotlin/databases/create-document.md index 10b6fdf..ef2a268 100644 --- a/docs/examples/kotlin/databases/create-document.md +++ b/docs/examples/kotlin/databases/create-document.md @@ -4,14 +4,14 @@ import io.appwrite.services.Databases val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val databases = Databases(client) val result = databases.createDocument( - databaseId = "", - collectionId = "", - documentId = "", + databaseId = "{$example}", + collectionId = "{$example}", + documentId = "{$example}", data = mapOf( "a" to "b" ), permissions = listOf("read("any")"), // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/databases/delete-document.md b/docs/examples/kotlin/databases/delete-document.md index 3eb1147..240e308 100644 --- a/docs/examples/kotlin/databases/delete-document.md +++ b/docs/examples/kotlin/databases/delete-document.md @@ -4,12 +4,12 @@ import io.appwrite.services.Databases val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val databases = Databases(client) val result = databases.deleteDocument( - databaseId = "", - collectionId = "", - documentId = "", + databaseId = "{$example}", + collectionId = "{$example}", + documentId = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/databases/get-document.md b/docs/examples/kotlin/databases/get-document.md index 6c5f92a..fb13fb1 100644 --- a/docs/examples/kotlin/databases/get-document.md +++ b/docs/examples/kotlin/databases/get-document.md @@ -4,13 +4,13 @@ import io.appwrite.services.Databases val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val databases = Databases(client) val result = databases.getDocument( - databaseId = "", - collectionId = "", - documentId = "", + databaseId = "{$example}", + collectionId = "{$example}", + documentId = "{$example}", queries = listOf(), // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/databases/list-documents.md b/docs/examples/kotlin/databases/list-documents.md index 7b1e851..2f4c8ae 100644 --- a/docs/examples/kotlin/databases/list-documents.md +++ b/docs/examples/kotlin/databases/list-documents.md @@ -4,12 +4,12 @@ import io.appwrite.services.Databases val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val databases = Databases(client) val result = databases.listDocuments( - databaseId = "", - collectionId = "", + databaseId = "{$example}", + collectionId = "{$example}", queries = listOf(), // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/databases/update-document.md b/docs/examples/kotlin/databases/update-document.md index de6b192..fb9b17c 100644 --- a/docs/examples/kotlin/databases/update-document.md +++ b/docs/examples/kotlin/databases/update-document.md @@ -4,14 +4,14 @@ import io.appwrite.services.Databases val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val databases = Databases(client) val result = databases.updateDocument( - databaseId = "", - collectionId = "", - documentId = "", + databaseId = "{$example}", + collectionId = "{$example}", + documentId = "{$example}", data = mapOf( "a" to "b" ), // (optional) permissions = listOf("read("any")"), // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/functions/create-execution.md b/docs/examples/kotlin/functions/create-execution.md index de84186..d6ca800 100644 --- a/docs/examples/kotlin/functions/create-execution.md +++ b/docs/examples/kotlin/functions/create-execution.md @@ -4,15 +4,16 @@ import io.appwrite.services.Functions val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val functions = Functions(client) val result = functions.createExecution( - functionId = "", - body = "", // (optional) + functionId = "{$example}", + body = Payload.fromJson(mapOf("x" to "y" as Any)), // (optional) async = false, // (optional) - path = "", // (optional) + path = "{$example}", // (optional) method = ExecutionMethod.GET, // (optional) headers = mapOf( "a" to "b" ), // (optional) + scheduledAt = "", // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/functions/get-execution.md b/docs/examples/kotlin/functions/get-execution.md index 0c4de1e..2e2c54e 100644 --- a/docs/examples/kotlin/functions/get-execution.md +++ b/docs/examples/kotlin/functions/get-execution.md @@ -4,11 +4,11 @@ import io.appwrite.services.Functions val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val functions = Functions(client) val result = functions.getExecution( - functionId = "", - executionId = "", + functionId = "{$example}", + executionId = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/functions/list-executions.md b/docs/examples/kotlin/functions/list-executions.md index d28b32c..f916c9d 100644 --- a/docs/examples/kotlin/functions/list-executions.md +++ b/docs/examples/kotlin/functions/list-executions.md @@ -4,12 +4,12 @@ import io.appwrite.services.Functions val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val functions = Functions(client) val result = functions.listExecutions( - functionId = "", + functionId = "{$example}", queries = listOf(), // (optional) - search = "", // (optional) + search = "{$example}", // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/graphql/mutation.md b/docs/examples/kotlin/graphql/mutation.md index a429a66..e90c9ae 100644 --- a/docs/examples/kotlin/graphql/mutation.md +++ b/docs/examples/kotlin/graphql/mutation.md @@ -4,7 +4,7 @@ import io.appwrite.services.Graphql val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val graphql = Graphql(client) diff --git a/docs/examples/kotlin/graphql/query.md b/docs/examples/kotlin/graphql/query.md index 0c39edd..2ce0cb1 100644 --- a/docs/examples/kotlin/graphql/query.md +++ b/docs/examples/kotlin/graphql/query.md @@ -4,7 +4,7 @@ import io.appwrite.services.Graphql val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val graphql = Graphql(client) diff --git a/docs/examples/kotlin/locale/get.md b/docs/examples/kotlin/locale/get.md index d38572a..f2f235a 100644 --- a/docs/examples/kotlin/locale/get.md +++ b/docs/examples/kotlin/locale/get.md @@ -4,7 +4,7 @@ import io.appwrite.services.Locale val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val locale = Locale(client) diff --git a/docs/examples/kotlin/locale/list-codes.md b/docs/examples/kotlin/locale/list-codes.md index 9f506f0..895c96d 100644 --- a/docs/examples/kotlin/locale/list-codes.md +++ b/docs/examples/kotlin/locale/list-codes.md @@ -4,7 +4,7 @@ import io.appwrite.services.Locale val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val locale = Locale(client) diff --git a/docs/examples/kotlin/locale/list-continents.md b/docs/examples/kotlin/locale/list-continents.md index 96cfda5..e320344 100644 --- a/docs/examples/kotlin/locale/list-continents.md +++ b/docs/examples/kotlin/locale/list-continents.md @@ -4,7 +4,7 @@ import io.appwrite.services.Locale val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val locale = Locale(client) diff --git a/docs/examples/kotlin/locale/list-countries-e-u.md b/docs/examples/kotlin/locale/list-countries-e-u.md index 54faf5e..b9182aa 100644 --- a/docs/examples/kotlin/locale/list-countries-e-u.md +++ b/docs/examples/kotlin/locale/list-countries-e-u.md @@ -4,7 +4,7 @@ import io.appwrite.services.Locale val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val locale = Locale(client) diff --git a/docs/examples/kotlin/locale/list-countries-phones.md b/docs/examples/kotlin/locale/list-countries-phones.md index 9e4bec1..961ebd3 100644 --- a/docs/examples/kotlin/locale/list-countries-phones.md +++ b/docs/examples/kotlin/locale/list-countries-phones.md @@ -4,7 +4,7 @@ import io.appwrite.services.Locale val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val locale = Locale(client) diff --git a/docs/examples/kotlin/locale/list-countries.md b/docs/examples/kotlin/locale/list-countries.md index 4299efb..1ebae69 100644 --- a/docs/examples/kotlin/locale/list-countries.md +++ b/docs/examples/kotlin/locale/list-countries.md @@ -4,7 +4,7 @@ import io.appwrite.services.Locale val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val locale = Locale(client) diff --git a/docs/examples/kotlin/locale/list-currencies.md b/docs/examples/kotlin/locale/list-currencies.md index 2bb7ca7..7500aa7 100644 --- a/docs/examples/kotlin/locale/list-currencies.md +++ b/docs/examples/kotlin/locale/list-currencies.md @@ -4,7 +4,7 @@ import io.appwrite.services.Locale val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val locale = Locale(client) diff --git a/docs/examples/kotlin/locale/list-languages.md b/docs/examples/kotlin/locale/list-languages.md index a9035e9..2be0ba5 100644 --- a/docs/examples/kotlin/locale/list-languages.md +++ b/docs/examples/kotlin/locale/list-languages.md @@ -4,7 +4,7 @@ import io.appwrite.services.Locale val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val locale = Locale(client) diff --git a/docs/examples/kotlin/messaging/create-subscriber.md b/docs/examples/kotlin/messaging/create-subscriber.md index 3f1d476..4292dec 100644 --- a/docs/examples/kotlin/messaging/create-subscriber.md +++ b/docs/examples/kotlin/messaging/create-subscriber.md @@ -4,12 +4,12 @@ import io.appwrite.services.Messaging val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val messaging = Messaging(client) val result = messaging.createSubscriber( - topicId = "", - subscriberId = "", - targetId = "", + topicId = "{$example}", + subscriberId = "{$example}", + targetId = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/messaging/delete-subscriber.md b/docs/examples/kotlin/messaging/delete-subscriber.md index febf622..0617824 100644 --- a/docs/examples/kotlin/messaging/delete-subscriber.md +++ b/docs/examples/kotlin/messaging/delete-subscriber.md @@ -4,11 +4,11 @@ import io.appwrite.services.Messaging val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val messaging = Messaging(client) val result = messaging.deleteSubscriber( - topicId = "", - subscriberId = "", + topicId = "{$example}", + subscriberId = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/storage/create-file.md b/docs/examples/kotlin/storage/create-file.md index ccd342e..816ece1 100644 --- a/docs/examples/kotlin/storage/create-file.md +++ b/docs/examples/kotlin/storage/create-file.md @@ -1,17 +1,17 @@ import io.appwrite.Client import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.models.InputFile +import io.appwrite.models.Payload import io.appwrite.services.Storage val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val storage = Storage(client) val result = storage.createFile( - bucketId = "", - fileId = "", - file = InputFile.fromPath("file.png"), + bucketId = "{$example}", + fileId = "{$example}", + file = Payload.fromFile("/path/to/file.png"), permissions = listOf("read("any")"), // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/storage/delete-file.md b/docs/examples/kotlin/storage/delete-file.md index 8def7d9..d4f802b 100644 --- a/docs/examples/kotlin/storage/delete-file.md +++ b/docs/examples/kotlin/storage/delete-file.md @@ -4,11 +4,11 @@ import io.appwrite.services.Storage val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val storage = Storage(client) val result = storage.deleteFile( - bucketId = "", - fileId = "", + bucketId = "{$example}", + fileId = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/storage/get-file-download.md b/docs/examples/kotlin/storage/get-file-download.md index c6e8fa4..3ae382e 100644 --- a/docs/examples/kotlin/storage/get-file-download.md +++ b/docs/examples/kotlin/storage/get-file-download.md @@ -4,11 +4,11 @@ import io.appwrite.services.Storage val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val storage = Storage(client) val result = storage.getFileDownload( - bucketId = "", - fileId = "", + bucketId = "{$example}", + fileId = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/storage/get-file-preview.md b/docs/examples/kotlin/storage/get-file-preview.md index 9c9993c..cc6911a 100644 --- a/docs/examples/kotlin/storage/get-file-preview.md +++ b/docs/examples/kotlin/storage/get-file-preview.md @@ -4,13 +4,13 @@ import io.appwrite.services.Storage val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val storage = Storage(client) val result = storage.getFilePreview( - bucketId = "", - fileId = "", + bucketId = "{$example}", + fileId = "{$example}", width = 0, // (optional) height = 0, // (optional) gravity = ImageGravity.CENTER, // (optional) diff --git a/docs/examples/kotlin/storage/get-file-view.md b/docs/examples/kotlin/storage/get-file-view.md index 83f8b31..bf50695 100644 --- a/docs/examples/kotlin/storage/get-file-view.md +++ b/docs/examples/kotlin/storage/get-file-view.md @@ -4,11 +4,11 @@ import io.appwrite.services.Storage val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val storage = Storage(client) val result = storage.getFileView( - bucketId = "", - fileId = "", + bucketId = "{$example}", + fileId = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/storage/get-file.md b/docs/examples/kotlin/storage/get-file.md index df662ea..040559b 100644 --- a/docs/examples/kotlin/storage/get-file.md +++ b/docs/examples/kotlin/storage/get-file.md @@ -4,11 +4,11 @@ import io.appwrite.services.Storage val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val storage = Storage(client) val result = storage.getFile( - bucketId = "", - fileId = "", + bucketId = "{$example}", + fileId = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/storage/list-files.md b/docs/examples/kotlin/storage/list-files.md index 4e28fc5..e7f09a2 100644 --- a/docs/examples/kotlin/storage/list-files.md +++ b/docs/examples/kotlin/storage/list-files.md @@ -4,12 +4,12 @@ import io.appwrite.services.Storage val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val storage = Storage(client) val result = storage.listFiles( - bucketId = "", + bucketId = "{$example}", queries = listOf(), // (optional) - search = "", // (optional) + search = "{$example}", // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/storage/update-file.md b/docs/examples/kotlin/storage/update-file.md index c84dadb..325fc44 100644 --- a/docs/examples/kotlin/storage/update-file.md +++ b/docs/examples/kotlin/storage/update-file.md @@ -4,13 +4,13 @@ import io.appwrite.services.Storage val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val storage = Storage(client) val result = storage.updateFile( - bucketId = "", - fileId = "", - name = "", // (optional) + bucketId = "{$example}", + fileId = "{$example}", + name = "{$example}", // (optional) permissions = listOf("read("any")"), // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/create-membership.md b/docs/examples/kotlin/teams/create-membership.md index a892663..6b4b6f1 100644 --- a/docs/examples/kotlin/teams/create-membership.md +++ b/docs/examples/kotlin/teams/create-membership.md @@ -4,16 +4,16 @@ import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val teams = Teams(client) val result = teams.createMembership( - teamId = "", + teamId = "{$example}", roles = listOf(), - email = "email@example.com", // (optional) - userId = "", // (optional) - phone = "+12065550100", // (optional) - url = "https://example.com", // (optional) - name = "", // (optional) + email = "{$example}", // (optional) + userId = "{$example}", // (optional) + phone = "{$example}", // (optional) + url = "{$example}", // (optional) + name = "{$example}", // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/create.md b/docs/examples/kotlin/teams/create.md index 22d6e7f..93ef2c6 100644 --- a/docs/examples/kotlin/teams/create.md +++ b/docs/examples/kotlin/teams/create.md @@ -4,12 +4,12 @@ import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val teams = Teams(client) val result = teams.create( - teamId = "", - name = "", + teamId = "{$example}", + name = "{$example}", roles = listOf(), // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/delete-membership.md b/docs/examples/kotlin/teams/delete-membership.md index 66e5716..97cf4d5 100644 --- a/docs/examples/kotlin/teams/delete-membership.md +++ b/docs/examples/kotlin/teams/delete-membership.md @@ -4,11 +4,11 @@ import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val teams = Teams(client) val result = teams.deleteMembership( - teamId = "", - membershipId = "", + teamId = "{$example}", + membershipId = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/delete.md b/docs/examples/kotlin/teams/delete.md index a73fa75..9ffc6db 100644 --- a/docs/examples/kotlin/teams/delete.md +++ b/docs/examples/kotlin/teams/delete.md @@ -4,10 +4,10 @@ import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val teams = Teams(client) val result = teams.delete( - teamId = "", + teamId = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/get-membership.md b/docs/examples/kotlin/teams/get-membership.md index 80640c7..3277431 100644 --- a/docs/examples/kotlin/teams/get-membership.md +++ b/docs/examples/kotlin/teams/get-membership.md @@ -4,11 +4,11 @@ import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val teams = Teams(client) val result = teams.getMembership( - teamId = "", - membershipId = "", + teamId = "{$example}", + membershipId = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/get-prefs.md b/docs/examples/kotlin/teams/get-prefs.md index 31001bd..2791cda 100644 --- a/docs/examples/kotlin/teams/get-prefs.md +++ b/docs/examples/kotlin/teams/get-prefs.md @@ -4,10 +4,10 @@ import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val teams = Teams(client) val result = teams.getPrefs( - teamId = "", + teamId = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/get.md b/docs/examples/kotlin/teams/get.md index 4387118..9278e43 100644 --- a/docs/examples/kotlin/teams/get.md +++ b/docs/examples/kotlin/teams/get.md @@ -4,10 +4,10 @@ import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val teams = Teams(client) val result = teams.get( - teamId = "", + teamId = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/list-memberships.md b/docs/examples/kotlin/teams/list-memberships.md index 7c8c686..789a810 100644 --- a/docs/examples/kotlin/teams/list-memberships.md +++ b/docs/examples/kotlin/teams/list-memberships.md @@ -4,12 +4,12 @@ import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val teams = Teams(client) val result = teams.listMemberships( - teamId = "", + teamId = "{$example}", queries = listOf(), // (optional) - search = "", // (optional) + search = "{$example}", // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/list.md b/docs/examples/kotlin/teams/list.md index e73d9e4..0cffc22 100644 --- a/docs/examples/kotlin/teams/list.md +++ b/docs/examples/kotlin/teams/list.md @@ -4,11 +4,11 @@ import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val teams = Teams(client) val result = teams.list( queries = listOf(), // (optional) - search = "", // (optional) + search = "{$example}", // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/update-membership-status.md b/docs/examples/kotlin/teams/update-membership-status.md index 0866892..d9454eb 100644 --- a/docs/examples/kotlin/teams/update-membership-status.md +++ b/docs/examples/kotlin/teams/update-membership-status.md @@ -4,13 +4,13 @@ import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val teams = Teams(client) val result = teams.updateMembershipStatus( - teamId = "", - membershipId = "", - userId = "", - secret = "", + teamId = "{$example}", + membershipId = "{$example}", + userId = "{$example}", + secret = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/update-membership.md b/docs/examples/kotlin/teams/update-membership.md index 799c594..5fbec70 100644 --- a/docs/examples/kotlin/teams/update-membership.md +++ b/docs/examples/kotlin/teams/update-membership.md @@ -4,12 +4,12 @@ import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val teams = Teams(client) val result = teams.updateMembership( - teamId = "", - membershipId = "", + teamId = "{$example}", + membershipId = "{$example}", roles = listOf(), ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/update-name.md b/docs/examples/kotlin/teams/update-name.md index 5e2399a..aec0dcb 100644 --- a/docs/examples/kotlin/teams/update-name.md +++ b/docs/examples/kotlin/teams/update-name.md @@ -4,11 +4,11 @@ import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val teams = Teams(client) val result = teams.updateName( - teamId = "", - name = "", + teamId = "{$example}", + name = "{$example}", ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/update-prefs.md b/docs/examples/kotlin/teams/update-prefs.md index 62febab..a292333 100644 --- a/docs/examples/kotlin/teams/update-prefs.md +++ b/docs/examples/kotlin/teams/update-prefs.md @@ -4,11 +4,11 @@ import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("5df5acd0d48c2") // Your project ID + .setProject("") // Your project ID val teams = Teams(client) val result = teams.updatePrefs( - teamId = "", + teamId = "{$example}", prefs = mapOf( "a" to "b" ), ) \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/Client.kt b/library/src/main/java/io/appwrite/Client.kt index a27cf48..6520241 100644 --- a/library/src/main/java/io/appwrite/Client.kt +++ b/library/src/main/java/io/appwrite/Client.kt @@ -7,8 +7,9 @@ import io.appwrite.cookies.ListenableCookieJar import io.appwrite.cookies.stores.SharedPreferencesCookieStore import io.appwrite.exceptions.AppwriteException import io.appwrite.extensions.fromJson +import io.appwrite.extensions.fromMultiPart import io.appwrite.extensions.toJson -import io.appwrite.models.InputFile +import io.appwrite.models.Payload import io.appwrite.models.UploadProgress import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -44,6 +45,9 @@ class Client @JvmOverloads constructor( ) : CoroutineScope { companion object { + /** + * The size for chunked uploads in bytes. + */ internal const val CHUNK_SIZE = 5*1024*1024; // 5MB internal const val GLOBAL_PREFS = "io.appwrite" internal const val COOKIE_PREFS = "myCookie" @@ -57,7 +61,7 @@ class Client @JvmOverloads constructor( internal lateinit var http: OkHttpClient internal val headers: MutableMap - + val config: MutableMap internal val cookieJar = ListenableCookieJar(CookieManager( @@ -83,11 +87,11 @@ class Client @JvmOverloads constructor( "x-sdk-name" to "Android", "x-sdk-platform" to "client", "x-sdk-language" to "android", - "x-sdk-version" to "5.1.1", - "x-appwrite-response-format" to "1.5.0" + "x-sdk-version" to "6.0.0", + "x-appwrite-response-format" to "1.6.0" ) config = mutableMapOf() - + setSelfSigned(selfSigned) } @@ -151,10 +155,10 @@ class Client @JvmOverloads constructor( /** * Set self Signed - * + * * @param status * - * @return this + * @return this */ fun setSelfSigned(status: Boolean): Client { selfSigned = status @@ -203,10 +207,10 @@ class Client @JvmOverloads constructor( /** * Set endpoint and realtime endpoint. - * + * * @param endpoint * - * @return this + * @return this */ fun setEndpoint(endpoint: String): Client { this.endpoint = endpoint @@ -232,11 +236,11 @@ class Client @JvmOverloads constructor( /** * Add Header - * + * * @param key * @param value * - * @return this + * @return this */ fun addHeader(key: String, value: String): Client { headers[key] = value @@ -245,19 +249,19 @@ class Client @JvmOverloads constructor( /** * Send the HTTP request - * + * * @param method * @param path * @param headers * @param params * - * @return [T] + * @return [T] */ @Throws(AppwriteException::class) suspend fun call( - method: String, - path: String, - headers: Map = mapOf(), + method: String, + path: String, + headers: Map = mapOf(), params: Map = mapOf(), responseType: Class, converter: ((Any) -> T)? = null @@ -358,14 +362,14 @@ class Client @JvmOverloads constructor( onProgress: ((UploadProgress) -> Unit)? = null, ): T { var file: RandomAccessFile? = null - val input = params[paramName] as InputFile + val input = params[paramName] as Payload val size: Long = when(input.sourceType) { "path", "file" -> { file = RandomAccessFile(input.path, "r") file.length() } "bytes" -> { - (input.data as ByteArray).size.toLong() + input.toBinary().size.toLong() } else -> throw UnsupportedOperationException() } @@ -373,7 +377,7 @@ class Client @JvmOverloads constructor( if (size < CHUNK_SIZE) { val data = when(input.sourceType) { "file", "path" -> File(input.path).asRequestBody() - "bytes" -> (input.data as ByteArray).toRequestBody(input.mimeType.toMediaType()) + "bytes" -> input.toBinary().toRequestBody(input.mimeType?.toMediaType()) else -> throw UnsupportedOperationException() } params[paramName] = MultipartBody.Part.createFormData( @@ -420,7 +424,7 @@ class Client @JvmOverloads constructor( } else { size - 1 } - (input.data as ByteArray).copyInto( + input.toBinary().copyInto( buffer, startIndex = offset.toInt(), endIndex = end.toInt() @@ -492,14 +496,14 @@ class Client @JvmOverloads constructor( .charStream() .buffered() .use(BufferedReader::readText) - + val error = if (response.headers["content-type"]?.contains("application/json") == true) { val map = body.fromJson>() AppwriteException( - map["message"] as? String ?: "", + map["message"] as? String ?: "", (map["code"] as Number).toInt(), - map["type"] as? String ?: "", + map["type"] as? String ?: "", body ) } else { @@ -508,6 +512,14 @@ class Client @JvmOverloads constructor( it.cancel(error) return } + + val warnings = response.headers["x-appwrite-warning"] + if (warnings != null) { + warnings.split(";").forEach { warning -> + println("Warning: $warning") + } + } + when { responseType == Boolean::class.java -> { it.resume(true as T) @@ -526,6 +538,14 @@ class Client @JvmOverloads constructor( return } } + if (response.headers["content-type"]?.contains("multipart/form-data") == true) { + val binaryBody = response.body!!.bytes() + val body = String(binaryBody) + val map = body.fromMultiPart(binaryBody) + it.resume(converter?.invoke(map) ?: map as T) + return + } + val body = response.body!! .charStream() .buffered() @@ -543,4 +563,4 @@ class Client @JvmOverloads constructor( } }) } -} \ No newline at end of file +} diff --git a/library/src/main/java/io/appwrite/ID.kt b/library/src/main/java/io/appwrite/ID.kt index e661192..b89957b 100644 --- a/library/src/main/java/io/appwrite/ID.kt +++ b/library/src/main/java/io/appwrite/ID.kt @@ -4,6 +4,9 @@ import java.time.Instant import kotlin.math.floor import kotlin.random.Random +/** + * Helper class to generate ID strings for resources. + */ class ID { companion object { // Generate an hex ID based on timestamp @@ -21,7 +24,12 @@ class ID { fun custom(id: String): String = id - // Generate a unique ID with padding to have a longer ID + /** + * Generate a unique ID with padding to have a longer ID + * + * @param padding The number of characters to add to the ID + * @returns The unique ID + */ fun unique(padding: Int = 7): String { val baseId = hexTimestamp() val randomPadding = (1..padding) diff --git a/library/src/main/java/io/appwrite/Permission.kt b/library/src/main/java/io/appwrite/Permission.kt index a540dcf..462b8e4 100644 --- a/library/src/main/java/io/appwrite/Permission.kt +++ b/library/src/main/java/io/appwrite/Permission.kt @@ -1,19 +1,60 @@ package io.appwrite +/** + * Helper class to generate permission strings for resources. + */ class Permission { companion object { + + /** + * Generate read permission string for the provided role. + * + * @param role The role for which to generate the permission. + * @returns The read permission string. + */ fun read(role: String): String { return "read(\"${role}\")" - } + } + + /** + * Generate write permission string for the provided role. + * + * This is an alias of update, delete, and possibly create. + * Don't use write in combination with update, delete, or create. + * + * @param role The role for which to generate the permission. + * @returns The write permission string. + */ fun write(role: String): String { return "write(\"${role}\")" } + + /** + * Generate create permission string for the provided role. + * + * @param role The role for which to generate the permission. + * @returns The create permission string. + */ fun create(role: String): String { return "create(\"${role}\")" - } + } + + /** + * Generate update permission string for the provided role. + * + * @param role The role for which to generate the permission. + * @returns The update permission string. + */ fun update(role: String): String { return "update(\"${role}\")" - } + } + + /** + * Generate delete permission string for the provided role. + * + * @param role The role for which to generate the permission. + * @returns The delete permission string. + */ fun delete(role: String): String { return "delete(\"${role}\")" } diff --git a/library/src/main/java/io/appwrite/Query.kt b/library/src/main/java/io/appwrite/Query.kt index 6efbb11..e326335 100644 --- a/library/src/main/java/io/appwrite/Query.kt +++ b/library/src/main/java/io/appwrite/Query.kt @@ -3,58 +3,217 @@ package io.appwrite import io.appwrite.extensions.toJson import io.appwrite.extensions.fromJson +/** + * Helper class to generate query strings. + */ class Query( val method: String, val attribute: String? = null, val values: List? = null, ) { + /** + * Convert the query object to a JSON string. + * + * @returns The JSON string representation of the query object. + */ override fun toString() = this.toJson() companion object { + + /** + * Filter resources where attribute is equal to value. + * + * @param attribute The attribute to filter on. + * @param value The value to compare against. + * @returns The query string. + */ fun equal(attribute: String, value: Any) = Query("equal", attribute, parseValue(value)).toJson() + /** + * Filter resources where attribute is not equal to value. + * + * @param attribute The attribute to filter on. + * @param value The value to compare against. + * @returns The query string. + */ fun notEqual(attribute: String, value: Any) = Query("notEqual", attribute, parseValue(value)).toJson() + /** + * Filter resources where attribute is less than value. + * + * @param attribute The attribute to filter on. + * @param value The value to compare against. + * @returns The query string. + */ fun lessThan(attribute: String, value: Any) = Query("lessThan", attribute, parseValue(value)).toJson() + /** + * Filter resources where attribute is less than or equal to value. + * + * @param attribute The attribute to filter on. + * @param value The value to compare against. + * @returns The query string. + */ fun lessThanEqual(attribute: String, value: Any) = Query("lessThanEqual", attribute, parseValue(value)).toJson() + /** + * Filter resources where attribute is greater than value. + * + * @param attribute The attribute to filter on. + * @param value The value to compare against. + * @returns The query string. + */ fun greaterThan(attribute: String, value: Any) = Query("greaterThan", attribute, parseValue(value)).toJson() + /** + * Filter resources where attribute is greater than or equal to value. + * + * @param attribute The attribute to filter on. + * @param value The value to compare against. + * @returns The query string. + */ fun greaterThanEqual(attribute: String, value: Any) = Query("greaterThanEqual", attribute, parseValue(value)).toJson() + /** + * Filter resources where attribute matches the search value. + * + * @param attribute The attribute to filter on. + * @param value The search value to match against. + * @returns The query string. + */ fun search(attribute: String, value: String) = Query("search", attribute, listOf(value)).toJson() + /** + * Filter resources where attribute is null. + * + * @param attribute The attribute to filter on. + * @returns The query string. + */ fun isNull(attribute: String) = Query("isNull", attribute).toJson() + /** + * Filter resources where attribute is not null. + * + * @param attribute The attribute to filter on. + * @returns The query string. + */ fun isNotNull(attribute: String) = Query("isNotNull", attribute).toJson() + /** + * Filter resources where attribute is between start and end (inclusive). + * + * @param attribute The attribute to filter on. + * @param start The start value of the range. + * @param end The end value of the range. + * @returns The query string. + */ fun between(attribute: String, start: Any, end: Any) = Query("between", attribute, listOf(start, end)).toJson() + /** + * Filter resources where attribute starts with value. + * + * @param attribute The attribute to filter on. + * @param value The value to compare against. + * @returns The query string. + */ fun startsWith(attribute: String, value: String) = Query("startsWith", attribute, listOf(value)).toJson() + /** + * Filter resources where attribute ends with value. + * + * @param attribute The attribute to filter on. + * @param value The value to compare against. + * @returns The query string. + */ fun endsWith(attribute: String, value: String) = Query("endsWith", attribute, listOf(value)).toJson() + /** + * Specify which attributes should be returned by the API call. + * + * @param attributes The list of attributes to select. + * @returns The query string. + */ fun select(attributes: List) = Query("select", null, attributes).toJson() + /** + * Sort results by attribute ascending. + * + * @param attribute The attribute to sort by. + * @returns The query string. + */ fun orderAsc(attribute: String) = Query("orderAsc", attribute).toJson() + /** + * Sort results by attribute descending. + * + * @param attribute The attribute to sort by. + * @returns The query string. + */ fun orderDesc(attribute: String) = Query("orderDesc", attribute).toJson() + /** + * Return results before documentId. + * + * @param documentId The document ID to use as cursor. + * @returns The query string. + */ fun cursorBefore(documentId: String) = Query("cursorBefore", null, listOf(documentId)).toJson() + /** + * Return results after documentId. + * + * @param documentId The document ID to use as cursor. + * @returns The query string. + */ fun cursorAfter(documentId: String) = Query("cursorAfter", null, listOf(documentId)).toJson() - + + /** + * Return only limit results. + * + * @param limit The number of results to return. + * @returns The query string. + */ fun limit(limit: Int) = Query("limit", null, listOf(limit)).toJson() + /** + * Filter resources by skipping the first offset results. + * + * @param offset The number of results to skip. + * @returns The query string. + */ fun offset(offset: Int) = Query("offset", null, listOf(offset)).toJson() + /** + * Filter resources where attribute contains the specified value. + * + * @param attribute The attribute to filter on. + * @param value The value to compare against. + * @returns The query string. + */ fun contains(attribute: String, value: Any) = Query("contains", attribute, parseValue(value)).toJson() + /** + * Combine multiple queries using logical OR operator. + * + * @param queries The list of query strings to combine. + * @returns The query string. + */ fun or(queries: List) = Query("or", null, queries.map { it.fromJson() }).toJson() + /** + * Combine multiple queries using logical AND operator. + * + * @param queries The list of query strings to combine. + * @returns The query string. + */ fun and(queries: List) = Query("and", null, queries.map { it.fromJson() }).toJson() + /** + * Parse the value to a list of values. + * + * @param value The value to parse. + * @returns The list of parsed values. + */ private fun parseValue(value: Any): List { return when (value) { is List<*> -> value as List diff --git a/library/src/main/java/io/appwrite/Service.kt b/library/src/main/java/io/appwrite/Service.kt index 8efdb9b..7a01b4b 100644 --- a/library/src/main/java/io/appwrite/Service.kt +++ b/library/src/main/java/io/appwrite/Service.kt @@ -2,4 +2,9 @@ package io.appwrite import io.appwrite.Client +/** + * Abstract class for services. + * + * @param client The Appwrite client. + */ abstract class Service(val client: Client) diff --git a/library/src/main/java/io/appwrite/extensions/TypeExtensions.kt b/library/src/main/java/io/appwrite/extensions/TypeExtensions.kt index e699a54..ad26379 100644 --- a/library/src/main/java/io/appwrite/extensions/TypeExtensions.kt +++ b/library/src/main/java/io/appwrite/extensions/TypeExtensions.kt @@ -1,9 +1,104 @@ package io.appwrite.extensions +import io.appwrite.models.Payload import kotlin.reflect.KClass import kotlin.reflect.typeOf inline fun classOf(): Class { - @Suppress("UNCHECKED_CAST") - return (typeOf().classifier!! as KClass).java -} \ No newline at end of file + @Suppress("UNCHECKED_CAST") return (typeOf().classifier!! as KClass).java +} + +fun String.fromMultiPart(binaryBody: ByteArray): Map { + val match = Regex("(-+\\w+)--").find(this) ?: return emptyMap() + // For kotlin + + val boundary = match.groupValues[1] + + var map = + mutableMapOf( + "\$id" to "", + "\$createdAt" to "", + "\$updatedAt" to "", + "\$permissions" to emptyList(), + "functionId" to "", + "trigger" to "", + "status" to "", + "requestMethod" to "", + "requestPath" to "", + "requestHeaders" to emptyList>(), + "responseStatusCode" to 0, + "responseBody" to Payload.fromBinary(ByteArray(0)), + "responseHeaders" to emptyList>(), + "logs" to "", + "errors" to "", + "duration" to 0.0, + "scheduledAt" to "", + ) + val parts = this.split(boundary) + for (part in parts) { + var lines = part.split("\r\n") + + val name = Regex("name=\"?(\\w+)").find(part) ?: continue + + lines = + lines + .dropWhile { it.isEmpty() } + .drop(1) + .dropWhile { it.isEmpty() } + .dropLastWhile { it.isEmpty() } + val key = name.groupValues[1] + + if (lines.isEmpty()) { + continue + } + + if (key == "responseBody") { + val needle = "name=\"responseBody\"\r\n\r\n" + val indexOf = this.indexOf(needle) + needle.length + val endBytes = "\r\n-------".toByteArray() + val list = ByteArray(binaryBody.size - indexOf) + val multipart = binaryBody.drop(indexOf) + var weHitTheEnd = false + var j = 0 + for (i in multipart) { + if (multipart.size > j + endBytes.size) { + var jj = 0 + for (byte in endBytes) { + if (byte != multipart[j + jj]) break + jj++ + if (jj != endBytes.size - 1) continue + weHitTheEnd = true + } + } + if (weHitTheEnd) { + break + } + + list[j] = multipart[j] + j++ + } + + map["responseBody"] = + Payload.fromBinary(list.dropLastWhile { it == 0.toByte() }.toByteArray()) + continue + } + + if (lines[0] == "Content-Type: application/json") { + lines = lines.drop(1).dropWhile { it.isEmpty() } + val list = lines.joinToString("\r\n").fromJson>() + map[key] = list + continue + } + + val value = lines.joinToString("\r\n") + + map[key] = + when (key) { + "responseStatusCode" -> value.toInt() + "duration" -> value.toFloat() + else -> value + } + } + + return map +} diff --git a/library/src/main/java/io/appwrite/models/Execution.kt b/library/src/main/java/io/appwrite/models/Execution.kt index 8252aa1..44724fa 100644 --- a/library/src/main/java/io/appwrite/models/Execution.kt +++ b/library/src/main/java/io/appwrite/models/Execution.kt @@ -103,6 +103,12 @@ data class Execution( @SerializedName("duration") val duration: Double, + /** + * The scheduled time for execution. If left empty, execution will be queued immediately. + */ + @SerializedName("scheduledAt") + var scheduledAt: String?, + ) { fun toMap(): Map = mapOf( "\$id" to id as Any, @@ -121,6 +127,7 @@ data class Execution( "logs" to logs as Any, "errors" to errors as Any, "duration" to duration as Any, + "scheduledAt" to scheduledAt as Any, ) companion object { @@ -145,6 +152,7 @@ data class Execution( logs = map["logs"] as String, errors = map["errors"] as String, duration = (map["duration"] as Number).toDouble(), + scheduledAt = map["scheduledAt"] as? String?, ) } } \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/InputFile.kt b/library/src/main/java/io/appwrite/models/InputFile.kt deleted file mode 100644 index afbb2e9..0000000 --- a/library/src/main/java/io/appwrite/models/InputFile.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.appwrite.models - -import java.io.File -import java.net.URLConnection -import java.nio.file.Files -import java.nio.file.Paths - -class InputFile private constructor() { - - lateinit var path: String - lateinit var filename: String - lateinit var mimeType: String - lateinit var sourceType: String - lateinit var data: Any - - companion object { - fun fromFile(file: File) = InputFile().apply { - path = file.canonicalPath - filename = file.name - mimeType = Files.probeContentType(Paths.get(file.canonicalPath)) - ?: URLConnection.guessContentTypeFromName(filename) - ?: "" - sourceType = "file" - } - - fun fromPath(path: String): InputFile = fromFile(File(path)).apply { - sourceType = "path" - } - - fun fromBytes(bytes: ByteArray, filename: String = "", mimeType: String = "") = InputFile().apply { - this.filename = filename - this.mimeType = mimeType - data = bytes - sourceType = "bytes" - } - } -} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/Payload.kt b/library/src/main/java/io/appwrite/models/Payload.kt new file mode 100644 index 0000000..46a13e3 --- /dev/null +++ b/library/src/main/java/io/appwrite/models/Payload.kt @@ -0,0 +1,71 @@ +package io.appwrite.models + +import io.appwrite.extensions.gson +import java.io.File +import java.net.URLConnection +import java.nio.file.Files +import java.nio.file.Paths + +class Payload private constructor() { + + lateinit var path: String + lateinit var filename: String + lateinit var sourceType: String + lateinit var data: Any + var mimeType: String? = null + + override fun toString(): String { + if (sourceType != "bytes") { + throw IllegalArgumentException("source type is not supported: $sourceType") + } + + return String(data as ByteArray) + } + + fun toBinary(): ByteArray { + if (sourceType != "bytes") { + throw IllegalArgumentException("source type is not supported: $sourceType") + } + + return data as ByteArray + } + + fun toJson(): MutableMap { + if (sourceType != "bytes") { + throw IllegalArgumentException("source type is not supported: $sourceType") + } + + return gson.fromJson(toString(), MutableMap::class.java) as MutableMap + } + + fun toFile(path: String): File { + val file = File(path) + file.appendBytes(toBinary()) + return file + } + + companion object { + fun fromFile(path: String,filename: String = ""): Payload = fromFileObject(File(path), filename).apply { + sourceType = "path" + } + + fun fromBinary(bytes: ByteArray, filename: String = "") = Payload().apply { + this.filename = filename + data = bytes + sourceType = "bytes" + } + + fun fromString(string: String) = fromBinary(string.toByteArray()) + + fun fromJson(data: Any) = fromString(gson.toJson(data)) + + fun fromFileObject(file: File, name: String = "") = Payload().apply { + path = file.canonicalPath + filename = if (name != "") name else file.name + mimeType = Files.probeContentType(Paths.get(file.canonicalPath)) + ?: URLConnection.guessContentTypeFromName(filename) + ?: "" + sourceType = "file" + } + } +} diff --git a/library/src/main/java/io/appwrite/services/Account.kt b/library/src/main/java/io/appwrite/services/Account.kt index 95dd107..0962796 100644 --- a/library/src/main/java/io/appwrite/services/Account.kt +++ b/library/src/main/java/io/appwrite/services/Account.kt @@ -28,19 +28,19 @@ class Account(client: Client) : Service(client) { */ suspend fun get( nestedType: Class, - ): io.appwrite.models.User { + ): io.appwrite.models.User { val apiPath = "/account" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.User = { @Suppress("UNCHECKED_CAST") io.appwrite.models.User.from(map = it as Map, nestedType) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -59,9 +59,9 @@ class Account(client: Client) : Service(client) { */ @Throws(AppwriteException::class) suspend fun get( - ): io.appwrite.models.User> = get( + ): io.appwrite.models.User> = get( nestedType = classOf(), - ) + ) /** * Create account @@ -81,23 +81,23 @@ class Account(client: Client) : Service(client) { password: String, name: String? = null, nestedType: Class, - ): io.appwrite.models.User { + ): io.appwrite.models.User { val apiPath = "/account" val apiParams = mutableMapOf( - "userId" to userId, - "email" to email, - "password" to password, - "name" to name, + "userId" to userId, + "email" to email, + "password" to password, + "name" to name, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.User = { @Suppress("UNCHECKED_CAST") io.appwrite.models.User.from(map = it as Map, nestedType) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -125,13 +125,13 @@ class Account(client: Client) : Service(client) { email: String, password: String, name: String? = null, - ): io.appwrite.models.User> = create( + ): io.appwrite.models.User> = create( userId, email, password, name, nestedType = classOf(), - ) + ) /** * Update email @@ -146,21 +146,21 @@ class Account(client: Client) : Service(client) { email: String, password: String, nestedType: Class, - ): io.appwrite.models.User { + ): io.appwrite.models.User { val apiPath = "/account/email" val apiParams = mutableMapOf( - "email" to email, - "password" to password, + "email" to email, + "password" to password, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.User = { @Suppress("UNCHECKED_CAST") io.appwrite.models.User.from(map = it as Map, nestedType) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -183,11 +183,11 @@ class Account(client: Client) : Service(client) { suspend fun updateEmail( email: String, password: String, - ): io.appwrite.models.User> = updateEmail( + ): io.appwrite.models.User> = updateEmail( email, password, nestedType = classOf(), - ) + ) /** * List Identities @@ -200,20 +200,20 @@ class Account(client: Client) : Service(client) { @JvmOverloads suspend fun listIdentities( queries: List? = null, - ): io.appwrite.models.IdentityList { + ): io.appwrite.models.IdentityList { val apiPath = "/account/identities" val apiParams = mutableMapOf( - "queries" to queries, + "queries" to queries, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.IdentityList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.IdentityList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -234,16 +234,16 @@ class Account(client: Client) : Service(client) { */ suspend fun deleteIdentity( identityId: String, - ): Any { + ): Any { val apiPath = "/account/identities/{identityId}" .replace("{identityId}", identityId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - return client.call( + return client.call( "DELETE", apiPath, apiHeaders, @@ -261,19 +261,19 @@ class Account(client: Client) : Service(client) { * @return [io.appwrite.models.Jwt] */ suspend fun createJWT( - ): io.appwrite.models.Jwt { - val apiPath = "/account/jwt" + ): io.appwrite.models.Jwt { + val apiPath = "/account/jwts" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Jwt = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Jwt.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -295,20 +295,20 @@ class Account(client: Client) : Service(client) { @JvmOverloads suspend fun listLogs( queries: List? = null, - ): io.appwrite.models.LogList { + ): io.appwrite.models.LogList { val apiPath = "/account/logs" val apiParams = mutableMapOf( - "queries" to queries, + "queries" to queries, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.LogList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.LogList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -330,20 +330,20 @@ class Account(client: Client) : Service(client) { suspend fun updateMFA( mfa: Boolean, nestedType: Class, - ): io.appwrite.models.User { + ): io.appwrite.models.User { val apiPath = "/account/mfa" val apiParams = mutableMapOf( - "mfa" to mfa, + "mfa" to mfa, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.User = { @Suppress("UNCHECKED_CAST") io.appwrite.models.User.from(map = it as Map, nestedType) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -364,13 +364,13 @@ class Account(client: Client) : Service(client) { @Throws(AppwriteException::class) suspend fun updateMFA( mfa: Boolean, - ): io.appwrite.models.User> = updateMFA( + ): io.appwrite.models.User> = updateMFA( mfa, nestedType = classOf(), - ) + ) /** - * Add Authenticator + * Create Authenticator * * Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method. * @@ -379,20 +379,20 @@ class Account(client: Client) : Service(client) { */ suspend fun createMfaAuthenticator( type: io.appwrite.enums.AuthenticatorType, - ): io.appwrite.models.MfaType { + ): io.appwrite.models.MfaType { val apiPath = "/account/mfa/authenticators/{type}" .replace("{type}", type.value) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.MfaType = { @Suppress("UNCHECKED_CAST") io.appwrite.models.MfaType.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -406,7 +406,7 @@ class Account(client: Client) : Service(client) { /** * Verify Authenticator * - * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. add + * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. * * @param type Type of authenticator. * @param otp Valid verification token. @@ -416,21 +416,21 @@ class Account(client: Client) : Service(client) { type: io.appwrite.enums.AuthenticatorType, otp: String, nestedType: Class, - ): io.appwrite.models.User { + ): io.appwrite.models.User { val apiPath = "/account/mfa/authenticators/{type}" .replace("{type}", type.value) val apiParams = mutableMapOf( - "otp" to otp, + "otp" to otp, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.User = { @Suppress("UNCHECKED_CAST") io.appwrite.models.User.from(map = it as Map, nestedType) } - return client.call( + return client.call( "PUT", apiPath, apiHeaders, @@ -443,7 +443,7 @@ class Account(client: Client) : Service(client) { /** * Verify Authenticator * - * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. add + * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. * * @param type Type of authenticator. * @param otp Valid verification token. @@ -453,11 +453,11 @@ class Account(client: Client) : Service(client) { suspend fun updateMfaAuthenticator( type: io.appwrite.enums.AuthenticatorType, otp: String, - ): io.appwrite.models.User> = updateMfaAuthenticator( + ): io.appwrite.models.User> = updateMfaAuthenticator( type, otp, nestedType = classOf(), - ) + ) /** * Delete Authenticator @@ -465,23 +465,20 @@ class Account(client: Client) : Service(client) { * Delete an authenticator for a user by ID. * * @param type Type of authenticator. - * @param otp Valid verification token. * @return [Any] */ suspend fun deleteMfaAuthenticator( type: io.appwrite.enums.AuthenticatorType, - otp: String, - ): Any { + ): Any { val apiPath = "/account/mfa/authenticators/{type}" .replace("{type}", type.value) val apiParams = mutableMapOf( - "otp" to otp, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - return client.call( + return client.call( "DELETE", apiPath, apiHeaders, @@ -492,7 +489,7 @@ class Account(client: Client) : Service(client) { /** - * Create 2FA Challenge + * Create MFA Challenge * * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. * @@ -501,20 +498,20 @@ class Account(client: Client) : Service(client) { */ suspend fun createMfaChallenge( factor: io.appwrite.enums.AuthenticationFactor, - ): io.appwrite.models.MfaChallenge { + ): io.appwrite.models.MfaChallenge { val apiPath = "/account/mfa/challenge" val apiParams = mutableMapOf( - "factor" to factor, + "factor" to factor, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.MfaChallenge = { @Suppress("UNCHECKED_CAST") io.appwrite.models.MfaChallenge.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -537,17 +534,17 @@ class Account(client: Client) : Service(client) { suspend fun updateMfaChallenge( challengeId: String, otp: String, - ): Any { + ): Any { val apiPath = "/account/mfa/challenge" val apiParams = mutableMapOf( - "challengeId" to challengeId, - "otp" to otp, + "challengeId" to challengeId, + "otp" to otp, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - return client.call( + return client.call( "PUT", apiPath, apiHeaders, @@ -565,19 +562,19 @@ class Account(client: Client) : Service(client) { * @return [io.appwrite.models.MfaFactors] */ suspend fun listMfaFactors( - ): io.appwrite.models.MfaFactors { + ): io.appwrite.models.MfaFactors { val apiPath = "/account/mfa/factors" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.MfaFactors = { @Suppress("UNCHECKED_CAST") io.appwrite.models.MfaFactors.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -596,19 +593,19 @@ class Account(client: Client) : Service(client) { * @return [io.appwrite.models.MfaRecoveryCodes] */ suspend fun getMfaRecoveryCodes( - ): io.appwrite.models.MfaRecoveryCodes { + ): io.appwrite.models.MfaRecoveryCodes { val apiPath = "/account/mfa/recovery-codes" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.MfaRecoveryCodes = { @Suppress("UNCHECKED_CAST") io.appwrite.models.MfaRecoveryCodes.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -627,19 +624,19 @@ class Account(client: Client) : Service(client) { * @return [io.appwrite.models.MfaRecoveryCodes] */ suspend fun createMfaRecoveryCodes( - ): io.appwrite.models.MfaRecoveryCodes { + ): io.appwrite.models.MfaRecoveryCodes { val apiPath = "/account/mfa/recovery-codes" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.MfaRecoveryCodes = { @Suppress("UNCHECKED_CAST") io.appwrite.models.MfaRecoveryCodes.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -658,19 +655,19 @@ class Account(client: Client) : Service(client) { * @return [io.appwrite.models.MfaRecoveryCodes] */ suspend fun updateMfaRecoveryCodes( - ): io.appwrite.models.MfaRecoveryCodes { + ): io.appwrite.models.MfaRecoveryCodes { val apiPath = "/account/mfa/recovery-codes" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.MfaRecoveryCodes = { @Suppress("UNCHECKED_CAST") io.appwrite.models.MfaRecoveryCodes.from(map = it as Map) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -692,20 +689,20 @@ class Account(client: Client) : Service(client) { suspend fun updateName( name: String, nestedType: Class, - ): io.appwrite.models.User { + ): io.appwrite.models.User { val apiPath = "/account/name" val apiParams = mutableMapOf( - "name" to name, + "name" to name, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.User = { @Suppress("UNCHECKED_CAST") io.appwrite.models.User.from(map = it as Map, nestedType) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -726,10 +723,10 @@ class Account(client: Client) : Service(client) { @Throws(AppwriteException::class) suspend fun updateName( name: String, - ): io.appwrite.models.User> = updateName( + ): io.appwrite.models.User> = updateName( name, nestedType = classOf(), - ) + ) /** * Update password @@ -745,21 +742,21 @@ class Account(client: Client) : Service(client) { password: String, oldPassword: String? = null, nestedType: Class, - ): io.appwrite.models.User { + ): io.appwrite.models.User { val apiPath = "/account/password" val apiParams = mutableMapOf( - "password" to password, - "oldPassword" to oldPassword, + "password" to password, + "oldPassword" to oldPassword, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.User = { @Suppress("UNCHECKED_CAST") io.appwrite.models.User.from(map = it as Map, nestedType) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -783,11 +780,11 @@ class Account(client: Client) : Service(client) { suspend fun updatePassword( password: String, oldPassword: String? = null, - ): io.appwrite.models.User> = updatePassword( + ): io.appwrite.models.User> = updatePassword( password, oldPassword, nestedType = classOf(), - ) + ) /** * Update phone @@ -802,21 +799,21 @@ class Account(client: Client) : Service(client) { phone: String, password: String, nestedType: Class, - ): io.appwrite.models.User { + ): io.appwrite.models.User { val apiPath = "/account/phone" val apiParams = mutableMapOf( - "phone" to phone, - "password" to password, + "phone" to phone, + "password" to password, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.User = { @Suppress("UNCHECKED_CAST") io.appwrite.models.User.from(map = it as Map, nestedType) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -839,11 +836,11 @@ class Account(client: Client) : Service(client) { suspend fun updatePhone( phone: String, password: String, - ): io.appwrite.models.User> = updatePhone( + ): io.appwrite.models.User> = updatePhone( phone, password, nestedType = classOf(), - ) + ) /** * Get account preferences @@ -854,19 +851,19 @@ class Account(client: Client) : Service(client) { */ suspend fun getPrefs( nestedType: Class, - ): io.appwrite.models.Preferences { + ): io.appwrite.models.Preferences { val apiPath = "/account/prefs" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Preferences = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Preferences.from(map = it as Map, nestedType) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -885,9 +882,9 @@ class Account(client: Client) : Service(client) { */ @Throws(AppwriteException::class) suspend fun getPrefs( - ): io.appwrite.models.Preferences> = getPrefs( + ): io.appwrite.models.Preferences> = getPrefs( nestedType = classOf(), - ) + ) /** * Update preferences @@ -900,20 +897,20 @@ class Account(client: Client) : Service(client) { suspend fun updatePrefs( prefs: Any, nestedType: Class, - ): io.appwrite.models.User { + ): io.appwrite.models.User { val apiPath = "/account/prefs" val apiParams = mutableMapOf( - "prefs" to prefs, + "prefs" to prefs, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.User = { @Suppress("UNCHECKED_CAST") io.appwrite.models.User.from(map = it as Map, nestedType) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -934,10 +931,10 @@ class Account(client: Client) : Service(client) { @Throws(AppwriteException::class) suspend fun updatePrefs( prefs: Any, - ): io.appwrite.models.User> = updatePrefs( + ): io.appwrite.models.User> = updatePrefs( prefs, nestedType = classOf(), - ) + ) /** * Create password recovery @@ -951,21 +948,21 @@ class Account(client: Client) : Service(client) { suspend fun createRecovery( email: String, url: String, - ): io.appwrite.models.Token { + ): io.appwrite.models.Token { val apiPath = "/account/recovery" val apiParams = mutableMapOf( - "email" to email, - "url" to url, + "email" to email, + "url" to url, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Token = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Token.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -990,22 +987,22 @@ class Account(client: Client) : Service(client) { userId: String, secret: String, password: String, - ): io.appwrite.models.Token { + ): io.appwrite.models.Token { val apiPath = "/account/recovery" val apiParams = mutableMapOf( - "userId" to userId, - "secret" to secret, - "password" to password, + "userId" to userId, + "secret" to secret, + "password" to password, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Token = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Token.from(map = it as Map) } - return client.call( + return client.call( "PUT", apiPath, apiHeaders, @@ -1024,19 +1021,19 @@ class Account(client: Client) : Service(client) { * @return [io.appwrite.models.SessionList] */ suspend fun listSessions( - ): io.appwrite.models.SessionList { + ): io.appwrite.models.SessionList { val apiPath = "/account/sessions" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.SessionList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.SessionList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -1055,15 +1052,15 @@ class Account(client: Client) : Service(client) { * @return [Any] */ suspend fun deleteSessions( - ): Any { + ): Any { val apiPath = "/account/sessions" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - return client.call( + return client.call( "DELETE", apiPath, apiHeaders, @@ -1081,19 +1078,19 @@ class Account(client: Client) : Service(client) { * @return [io.appwrite.models.Session] */ suspend fun createAnonymousSession( - ): io.appwrite.models.Session { + ): io.appwrite.models.Session { val apiPath = "/account/sessions/anonymous" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Session = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Session.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -1116,21 +1113,21 @@ class Account(client: Client) : Service(client) { suspend fun createEmailPasswordSession( email: String, password: String, - ): io.appwrite.models.Session { + ): io.appwrite.models.Session { val apiPath = "/account/sessions/email" val apiParams = mutableMapOf( - "email" to email, - "password" to password, + "email" to email, + "password" to password, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Session = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Session.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -1153,21 +1150,21 @@ class Account(client: Client) : Service(client) { suspend fun updateMagicURLSession( userId: String, secret: String, - ): io.appwrite.models.Session { + ): io.appwrite.models.Session { val apiPath = "/account/sessions/magic-url" val apiParams = mutableMapOf( - "userId" to userId, - "secret" to secret, + "userId" to userId, + "secret" to secret, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Session = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Session.from(map = it as Map) } - return client.call( + return client.call( "PUT", apiPath, apiHeaders, @@ -1195,14 +1192,14 @@ class Account(client: Client) : Service(client) { success: String? = null, failure: String? = null, scopes: List? = null, - ) { + ) { val apiPath = "/account/sessions/oauth2/{provider}" .replace("{provider}", provider.value) val apiParams = mutableMapOf( - "success" to success, - "failure" to failure, - "scopes" to scopes, + "success" to success, + "failure" to failure, + "scopes" to scopes, "project" to client.config["project"], ) val apiQuery = mutableListOf() @@ -1212,7 +1209,9 @@ class Account(client: Client) : Service(client) { return@forEach } is List<*> -> { - apiQuery.add("${it.key}[]=${it.value.toString()}") + (it.value as List<*>).forEach { v -> + apiQuery.add("${it.key}[]=${v.toString()}") + } } else -> { apiQuery.add("${it.key}=${it.value.toString()}") @@ -1241,7 +1240,7 @@ class Account(client: Client) : Service(client) { .domain(Uri.parse(client.endpoint).host!!) .httpOnly() .build() - + client.http.cookieJar.saveFromResponse( client.endpoint.toHttpUrl(), listOf(cookie) @@ -1262,21 +1261,21 @@ class Account(client: Client) : Service(client) { suspend fun updatePhoneSession( userId: String, secret: String, - ): io.appwrite.models.Session { + ): io.appwrite.models.Session { val apiPath = "/account/sessions/phone" val apiParams = mutableMapOf( - "userId" to userId, - "secret" to secret, + "userId" to userId, + "secret" to secret, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Session = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Session.from(map = it as Map) } - return client.call( + return client.call( "PUT", apiPath, apiHeaders, @@ -1299,21 +1298,21 @@ class Account(client: Client) : Service(client) { suspend fun createSession( userId: String, secret: String, - ): io.appwrite.models.Session { + ): io.appwrite.models.Session { val apiPath = "/account/sessions/token" val apiParams = mutableMapOf( - "userId" to userId, - "secret" to secret, + "userId" to userId, + "secret" to secret, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Session = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Session.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -1334,20 +1333,20 @@ class Account(client: Client) : Service(client) { */ suspend fun getSession( sessionId: String, - ): io.appwrite.models.Session { + ): io.appwrite.models.Session { val apiPath = "/account/sessions/{sessionId}" .replace("{sessionId}", sessionId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Session = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Session.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -1368,20 +1367,20 @@ class Account(client: Client) : Service(client) { */ suspend fun updateSession( sessionId: String, - ): io.appwrite.models.Session { + ): io.appwrite.models.Session { val apiPath = "/account/sessions/{sessionId}" .replace("{sessionId}", sessionId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Session = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Session.from(map = it as Map) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -1402,16 +1401,16 @@ class Account(client: Client) : Service(client) { */ suspend fun deleteSession( sessionId: String, - ): Any { + ): Any { val apiPath = "/account/sessions/{sessionId}" .replace("{sessionId}", sessionId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - return client.call( + return client.call( "DELETE", apiPath, apiHeaders, @@ -1430,19 +1429,19 @@ class Account(client: Client) : Service(client) { */ suspend fun updateStatus( nestedType: Class, - ): io.appwrite.models.User { + ): io.appwrite.models.User { val apiPath = "/account/status" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.User = { @Suppress("UNCHECKED_CAST") io.appwrite.models.User.from(map = it as Map, nestedType) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -1461,9 +1460,9 @@ class Account(client: Client) : Service(client) { */ @Throws(AppwriteException::class) suspend fun updateStatus( - ): io.appwrite.models.User> = updateStatus( + ): io.appwrite.models.User> = updateStatus( nestedType = classOf(), - ) + ) /** * Create push target @@ -1480,22 +1479,22 @@ class Account(client: Client) : Service(client) { targetId: String, identifier: String, providerId: String? = null, - ): io.appwrite.models.Target { + ): io.appwrite.models.Target { val apiPath = "/account/targets/push" val apiParams = mutableMapOf( - "targetId" to targetId, - "identifier" to identifier, - "providerId" to providerId, + "targetId" to targetId, + "identifier" to identifier, + "providerId" to providerId, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Target = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Target.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -1518,21 +1517,21 @@ class Account(client: Client) : Service(client) { suspend fun updatePushTarget( targetId: String, identifier: String, - ): io.appwrite.models.Target { + ): io.appwrite.models.Target { val apiPath = "/account/targets/{targetId}/push" .replace("{targetId}", targetId) val apiParams = mutableMapOf( - "identifier" to identifier, + "identifier" to identifier, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Target = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Target.from(map = it as Map) } - return client.call( + return client.call( "PUT", apiPath, apiHeaders, @@ -1553,16 +1552,16 @@ class Account(client: Client) : Service(client) { */ suspend fun deletePushTarget( targetId: String, - ): Any { + ): Any { val apiPath = "/account/targets/{targetId}/push" .replace("{targetId}", targetId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - return client.call( + return client.call( "DELETE", apiPath, apiHeaders, @@ -1587,22 +1586,22 @@ class Account(client: Client) : Service(client) { userId: String, email: String, phrase: Boolean? = null, - ): io.appwrite.models.Token { + ): io.appwrite.models.Token { val apiPath = "/account/tokens/email" val apiParams = mutableMapOf( - "userId" to userId, - "email" to email, - "phrase" to phrase, + "userId" to userId, + "email" to email, + "phrase" to phrase, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Token = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Token.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -1630,23 +1629,23 @@ class Account(client: Client) : Service(client) { email: String, url: String? = null, phrase: Boolean? = null, - ): io.appwrite.models.Token { + ): io.appwrite.models.Token { val apiPath = "/account/tokens/magic-url" val apiParams = mutableMapOf( - "userId" to userId, - "email" to email, - "url" to url, - "phrase" to phrase, + "userId" to userId, + "email" to email, + "url" to url, + "phrase" to phrase, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Token = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Token.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -1674,14 +1673,14 @@ class Account(client: Client) : Service(client) { success: String? = null, failure: String? = null, scopes: List? = null, - ) { + ) { val apiPath = "/account/tokens/oauth2/{provider}" .replace("{provider}", provider.value) val apiParams = mutableMapOf( - "success" to success, - "failure" to failure, - "scopes" to scopes, + "success" to success, + "failure" to failure, + "scopes" to scopes, "project" to client.config["project"], ) val apiQuery = mutableListOf() @@ -1691,7 +1690,9 @@ class Account(client: Client) : Service(client) { return@forEach } is List<*> -> { - apiQuery.add("${it.key}[]=${it.value.toString()}") + (it.value as List<*>).forEach { v -> + apiQuery.add("${it.key}[]=${v.toString()}") + } } else -> { apiQuery.add("${it.key}=${it.value.toString()}") @@ -1720,7 +1721,7 @@ class Account(client: Client) : Service(client) { .domain(Uri.parse(client.endpoint).host!!) .httpOnly() .build() - + client.http.cookieJar.saveFromResponse( client.endpoint.toHttpUrl(), listOf(cookie) @@ -1741,21 +1742,21 @@ class Account(client: Client) : Service(client) { suspend fun createPhoneToken( userId: String, phone: String, - ): io.appwrite.models.Token { + ): io.appwrite.models.Token { val apiPath = "/account/tokens/phone" val apiParams = mutableMapOf( - "userId" to userId, - "phone" to phone, + "userId" to userId, + "phone" to phone, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Token = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Token.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -1776,20 +1777,20 @@ class Account(client: Client) : Service(client) { */ suspend fun createVerification( url: String, - ): io.appwrite.models.Token { + ): io.appwrite.models.Token { val apiPath = "/account/verification" val apiParams = mutableMapOf( - "url" to url, + "url" to url, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Token = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Token.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -1812,21 +1813,21 @@ class Account(client: Client) : Service(client) { suspend fun updateVerification( userId: String, secret: String, - ): io.appwrite.models.Token { + ): io.appwrite.models.Token { val apiPath = "/account/verification" val apiParams = mutableMapOf( - "userId" to userId, - "secret" to secret, + "userId" to userId, + "secret" to secret, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Token = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Token.from(map = it as Map) } - return client.call( + return client.call( "PUT", apiPath, apiHeaders, @@ -1845,19 +1846,19 @@ class Account(client: Client) : Service(client) { * @return [io.appwrite.models.Token] */ suspend fun createPhoneVerification( - ): io.appwrite.models.Token { + ): io.appwrite.models.Token { val apiPath = "/account/verification/phone" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Token = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Token.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -1869,7 +1870,7 @@ class Account(client: Client) : Service(client) { /** - * Create phone verification (confirmation) + * Update phone verification (confirmation) * * Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code. * @@ -1880,21 +1881,21 @@ class Account(client: Client) : Service(client) { suspend fun updatePhoneVerification( userId: String, secret: String, - ): io.appwrite.models.Token { + ): io.appwrite.models.Token { val apiPath = "/account/verification/phone" val apiParams = mutableMapOf( - "userId" to userId, - "secret" to secret, + "userId" to userId, + "secret" to secret, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Token = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Token.from(map = it as Map) } - return client.call( + return client.call( "PUT", apiPath, apiHeaders, @@ -1905,4 +1906,4 @@ class Account(client: Client) : Service(client) { } -} \ No newline at end of file +} diff --git a/library/src/main/java/io/appwrite/services/Avatars.kt b/library/src/main/java/io/appwrite/services/Avatars.kt index 2cb130d..fb926f0 100644 --- a/library/src/main/java/io/appwrite/services/Avatars.kt +++ b/library/src/main/java/io/appwrite/services/Avatars.kt @@ -34,14 +34,14 @@ class Avatars(client: Client) : Service(client) { width: Long? = null, height: Long? = null, quality: Long? = null, - ): ByteArray { + ): ByteArray { val apiPath = "/avatars/browsers/{code}" .replace("{code}", code.value) val apiParams = mutableMapOf( - "width" to width, - "height" to height, - "quality" to quality, + "width" to width, + "height" to height, + "quality" to quality, "project" to client.config["project"], ) return client.call( @@ -70,14 +70,14 @@ class Avatars(client: Client) : Service(client) { width: Long? = null, height: Long? = null, quality: Long? = null, - ): ByteArray { + ): ByteArray { val apiPath = "/avatars/credit-cards/{code}" .replace("{code}", code.value) val apiParams = mutableMapOf( - "width" to width, - "height" to height, - "quality" to quality, + "width" to width, + "height" to height, + "quality" to quality, "project" to client.config["project"], ) return client.call( @@ -92,18 +92,18 @@ class Avatars(client: Client) : Service(client) { /** * Get favicon * - * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL. + * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.This endpoint does not follow HTTP redirects. * * @param url Website URL which you want to fetch the favicon from. * @return [ByteArray] */ suspend fun getFavicon( url: String, - ): ByteArray { + ): ByteArray { val apiPath = "/avatars/favicon" val apiParams = mutableMapOf( - "url" to url, + "url" to url, "project" to client.config["project"], ) return client.call( @@ -132,14 +132,14 @@ class Avatars(client: Client) : Service(client) { width: Long? = null, height: Long? = null, quality: Long? = null, - ): ByteArray { + ): ByteArray { val apiPath = "/avatars/flags/{code}" .replace("{code}", code.value) val apiParams = mutableMapOf( - "width" to width, - "height" to height, - "quality" to quality, + "width" to width, + "height" to height, + "quality" to quality, "project" to client.config["project"], ) return client.call( @@ -154,7 +154,7 @@ class Avatars(client: Client) : Service(client) { /** * Get image from URL * - * Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol.When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 400x400px. + * Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol.When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 400x400px.This endpoint does not follow HTTP redirects. * * @param url Image URL which you want to crop. * @param width Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400. @@ -166,13 +166,13 @@ class Avatars(client: Client) : Service(client) { url: String, width: Long? = null, height: Long? = null, - ): ByteArray { + ): ByteArray { val apiPath = "/avatars/image" val apiParams = mutableMapOf( - "url" to url, - "width" to width, - "height" to height, + "url" to url, + "width" to width, + "height" to height, "project" to client.config["project"], ) return client.call( @@ -201,14 +201,14 @@ class Avatars(client: Client) : Service(client) { width: Long? = null, height: Long? = null, background: String? = null, - ): ByteArray { + ): ByteArray { val apiPath = "/avatars/initials" val apiParams = mutableMapOf( - "name" to name, - "width" to width, - "height" to height, - "background" to background, + "name" to name, + "width" to width, + "height" to height, + "background" to background, "project" to client.config["project"], ) return client.call( @@ -237,14 +237,14 @@ class Avatars(client: Client) : Service(client) { size: Long? = null, margin: Long? = null, download: Boolean? = null, - ): ByteArray { + ): ByteArray { val apiPath = "/avatars/qr" val apiParams = mutableMapOf( - "text" to text, - "size" to size, - "margin" to margin, - "download" to download, + "text" to text, + "size" to size, + "margin" to margin, + "download" to download, "project" to client.config["project"], ) return client.call( @@ -256,4 +256,4 @@ class Avatars(client: Client) : Service(client) { } -} \ No newline at end of file +} diff --git a/library/src/main/java/io/appwrite/services/Databases.kt b/library/src/main/java/io/appwrite/services/Databases.kt index 70ecf23..22d5375 100644 --- a/library/src/main/java/io/appwrite/services/Databases.kt +++ b/library/src/main/java/io/appwrite/services/Databases.kt @@ -31,22 +31,22 @@ class Databases(client: Client) : Service(client) { collectionId: String, queries: List? = null, nestedType: Class, - ): io.appwrite.models.DocumentList { + ): io.appwrite.models.DocumentList { val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents" .replace("{databaseId}", databaseId) .replace("{collectionId}", collectionId) val apiParams = mutableMapOf( - "queries" to queries, + "queries" to queries, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.DocumentList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.DocumentList.from(map = it as Map, nestedType) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -72,12 +72,12 @@ class Databases(client: Client) : Service(client) { databaseId: String, collectionId: String, queries: List? = null, - ): io.appwrite.models.DocumentList> = listDocuments( + ): io.appwrite.models.DocumentList> = listDocuments( databaseId, collectionId, queries, nestedType = classOf(), - ) + ) /** * Create document @@ -99,24 +99,24 @@ class Databases(client: Client) : Service(client) { data: Any, permissions: List? = null, nestedType: Class, - ): io.appwrite.models.Document { + ): io.appwrite.models.Document { val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents" .replace("{databaseId}", databaseId) .replace("{collectionId}", collectionId) val apiParams = mutableMapOf( - "documentId" to documentId, - "data" to data, - "permissions" to permissions, + "documentId" to documentId, + "data" to data, + "permissions" to permissions, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Document = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Document.from(map = it as Map, nestedType) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -146,14 +146,14 @@ class Databases(client: Client) : Service(client) { documentId: String, data: Any, permissions: List? = null, - ): io.appwrite.models.Document> = createDocument( + ): io.appwrite.models.Document> = createDocument( databaseId, collectionId, documentId, data, permissions, nestedType = classOf(), - ) + ) /** * Get document @@ -173,23 +173,23 @@ class Databases(client: Client) : Service(client) { documentId: String, queries: List? = null, nestedType: Class, - ): io.appwrite.models.Document { + ): io.appwrite.models.Document { val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" .replace("{databaseId}", databaseId) .replace("{collectionId}", collectionId) .replace("{documentId}", documentId) val apiParams = mutableMapOf( - "queries" to queries, + "queries" to queries, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Document = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Document.from(map = it as Map, nestedType) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -217,13 +217,13 @@ class Databases(client: Client) : Service(client) { collectionId: String, documentId: String, queries: List? = null, - ): io.appwrite.models.Document> = getDocument( + ): io.appwrite.models.Document> = getDocument( databaseId, collectionId, documentId, queries, nestedType = classOf(), - ) + ) /** * Update document @@ -245,24 +245,24 @@ class Databases(client: Client) : Service(client) { data: Any? = null, permissions: List? = null, nestedType: Class, - ): io.appwrite.models.Document { + ): io.appwrite.models.Document { val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" .replace("{databaseId}", databaseId) .replace("{collectionId}", collectionId) .replace("{documentId}", documentId) val apiParams = mutableMapOf( - "data" to data, - "permissions" to permissions, + "data" to data, + "permissions" to permissions, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Document = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Document.from(map = it as Map, nestedType) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -292,14 +292,14 @@ class Databases(client: Client) : Service(client) { documentId: String, data: Any? = null, permissions: List? = null, - ): io.appwrite.models.Document> = updateDocument( + ): io.appwrite.models.Document> = updateDocument( databaseId, collectionId, documentId, data, permissions, nestedType = classOf(), - ) + ) /** * Delete document @@ -315,7 +315,7 @@ class Databases(client: Client) : Service(client) { databaseId: String, collectionId: String, documentId: String, - ): Any { + ): Any { val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" .replace("{databaseId}", databaseId) .replace("{collectionId}", collectionId) @@ -323,10 +323,10 @@ class Databases(client: Client) : Service(client) { val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - return client.call( + return client.call( "DELETE", apiPath, apiHeaders, @@ -336,4 +336,4 @@ class Databases(client: Client) : Service(client) { } -} \ No newline at end of file +} diff --git a/library/src/main/java/io/appwrite/services/Functions.kt b/library/src/main/java/io/appwrite/services/Functions.kt index c7a81ad..59809dc 100644 --- a/library/src/main/java/io/appwrite/services/Functions.kt +++ b/library/src/main/java/io/appwrite/services/Functions.kt @@ -21,7 +21,7 @@ class Functions(client: Client) : Service(client) { * Get a list of all the current user function execution logs. You can use the query params to filter your results. * * @param functionId Function ID. - * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration + * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId * @param search Search term to filter your list results. Max length: 256 chars. * @return [io.appwrite.models.ExecutionList] */ @@ -30,22 +30,22 @@ class Functions(client: Client) : Service(client) { functionId: String, queries: List? = null, search: String? = null, - ): io.appwrite.models.ExecutionList { + ): io.appwrite.models.ExecutionList { val apiPath = "/functions/{functionId}/executions" .replace("{functionId}", functionId) val apiParams = mutableMapOf( - "queries" to queries, - "search" to search, + "queries" to queries, + "search" to search, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.ExecutionList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.ExecutionList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -67,35 +67,39 @@ class Functions(client: Client) : Service(client) { * @param path HTTP path of execution. Path can include query params. Default value is / * @param method HTTP method of execution. Default value is GET. * @param headers HTTP headers of execution. Defaults to empty. + * @param scheduledAt Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes. * @return [io.appwrite.models.Execution] */ @JvmOverloads suspend fun createExecution( functionId: String, - body: String? = null, + body: Payload? = null, async: Boolean? = null, path: String? = null, method: io.appwrite.enums.ExecutionMethod? = null, headers: Any? = null, - ): io.appwrite.models.Execution { + scheduledAt: String? = null, + ): io.appwrite.models.Execution { val apiPath = "/functions/{functionId}/executions" .replace("{functionId}", functionId) val apiParams = mutableMapOf( - "body" to body, - "async" to async, - "path" to path, - "method" to method, - "headers" to headers, + "body" to (body?.toBinary() ?: ""), + "async" to async, + "path" to path, + "method" to method, + "headers" to headers, + "scheduledAt" to scheduledAt, ) - val apiHeaders = mutableMapOf( - "content-type" to "application/json", + val apiHeaders = mutableMapOf( + "content-type" to "multipart/form-data", + "accept" to "multipart/form-data", ) val converter: (Any) -> io.appwrite.models.Execution = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Execution.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -118,21 +122,21 @@ class Functions(client: Client) : Service(client) { suspend fun getExecution( functionId: String, executionId: String, - ): io.appwrite.models.Execution { + ): io.appwrite.models.Execution { val apiPath = "/functions/{functionId}/executions/{executionId}" .replace("{functionId}", functionId) .replace("{executionId}", executionId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Execution = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Execution.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -143,4 +147,4 @@ class Functions(client: Client) : Service(client) { } -} \ No newline at end of file +} diff --git a/library/src/main/java/io/appwrite/services/Graphql.kt b/library/src/main/java/io/appwrite/services/Graphql.kt index 6c977a2..1052e67 100644 --- a/library/src/main/java/io/appwrite/services/Graphql.kt +++ b/library/src/main/java/io/appwrite/services/Graphql.kt @@ -25,20 +25,20 @@ class Graphql(client: Client) : Service(client) { */ suspend fun query( query: Any, - ): Any { + ): Any { val apiPath = "/graphql" val apiParams = mutableMapOf( - "query" to query, + "query" to query, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "x-sdk-graphql" to "true", "content-type" to "application/json", ) val converter: (Any) -> Any = { it } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -59,20 +59,20 @@ class Graphql(client: Client) : Service(client) { */ suspend fun mutation( query: Any, - ): Any { + ): Any { val apiPath = "/graphql/mutation" val apiParams = mutableMapOf( - "query" to query, + "query" to query, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "x-sdk-graphql" to "true", "content-type" to "application/json", ) val converter: (Any) -> Any = { it } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -83,4 +83,4 @@ class Graphql(client: Client) : Service(client) { } -} \ No newline at end of file +} diff --git a/library/src/main/java/io/appwrite/services/Locale.kt b/library/src/main/java/io/appwrite/services/Locale.kt index ad3a6f6..bcee309 100644 --- a/library/src/main/java/io/appwrite/services/Locale.kt +++ b/library/src/main/java/io/appwrite/services/Locale.kt @@ -23,19 +23,19 @@ class Locale(client: Client) : Service(client) { * @return [io.appwrite.models.Locale] */ suspend fun get( - ): io.appwrite.models.Locale { + ): io.appwrite.models.Locale { val apiPath = "/locale" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Locale = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Locale.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -54,19 +54,19 @@ class Locale(client: Client) : Service(client) { * @return [io.appwrite.models.LocaleCodeList] */ suspend fun listCodes( - ): io.appwrite.models.LocaleCodeList { + ): io.appwrite.models.LocaleCodeList { val apiPath = "/locale/codes" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.LocaleCodeList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.LocaleCodeList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -85,19 +85,19 @@ class Locale(client: Client) : Service(client) { * @return [io.appwrite.models.ContinentList] */ suspend fun listContinents( - ): io.appwrite.models.ContinentList { + ): io.appwrite.models.ContinentList { val apiPath = "/locale/continents" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.ContinentList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.ContinentList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -116,19 +116,19 @@ class Locale(client: Client) : Service(client) { * @return [io.appwrite.models.CountryList] */ suspend fun listCountries( - ): io.appwrite.models.CountryList { + ): io.appwrite.models.CountryList { val apiPath = "/locale/countries" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.CountryList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.CountryList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -147,19 +147,19 @@ class Locale(client: Client) : Service(client) { * @return [io.appwrite.models.CountryList] */ suspend fun listCountriesEU( - ): io.appwrite.models.CountryList { + ): io.appwrite.models.CountryList { val apiPath = "/locale/countries/eu" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.CountryList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.CountryList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -178,19 +178,19 @@ class Locale(client: Client) : Service(client) { * @return [io.appwrite.models.PhoneList] */ suspend fun listCountriesPhones( - ): io.appwrite.models.PhoneList { + ): io.appwrite.models.PhoneList { val apiPath = "/locale/countries/phones" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.PhoneList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.PhoneList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -209,19 +209,19 @@ class Locale(client: Client) : Service(client) { * @return [io.appwrite.models.CurrencyList] */ suspend fun listCurrencies( - ): io.appwrite.models.CurrencyList { + ): io.appwrite.models.CurrencyList { val apiPath = "/locale/currencies" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.CurrencyList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.CurrencyList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -240,19 +240,19 @@ class Locale(client: Client) : Service(client) { * @return [io.appwrite.models.LanguageList] */ suspend fun listLanguages( - ): io.appwrite.models.LanguageList { + ): io.appwrite.models.LanguageList { val apiPath = "/locale/languages" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.LanguageList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.LanguageList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -263,4 +263,4 @@ class Locale(client: Client) : Service(client) { } -} \ No newline at end of file +} diff --git a/library/src/main/java/io/appwrite/services/Messaging.kt b/library/src/main/java/io/appwrite/services/Messaging.kt index baca2c4..5c6504f 100644 --- a/library/src/main/java/io/appwrite/services/Messaging.kt +++ b/library/src/main/java/io/appwrite/services/Messaging.kt @@ -29,22 +29,22 @@ class Messaging(client: Client) : Service(client) { topicId: String, subscriberId: String, targetId: String, - ): io.appwrite.models.Subscriber { + ): io.appwrite.models.Subscriber { val apiPath = "/messaging/topics/{topicId}/subscribers" .replace("{topicId}", topicId) val apiParams = mutableMapOf( - "subscriberId" to subscriberId, - "targetId" to targetId, + "subscriberId" to subscriberId, + "targetId" to targetId, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Subscriber = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Subscriber.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -67,17 +67,17 @@ class Messaging(client: Client) : Service(client) { suspend fun deleteSubscriber( topicId: String, subscriberId: String, - ): Any { + ): Any { val apiPath = "/messaging/topics/{topicId}/subscribers/{subscriberId}" .replace("{topicId}", topicId) .replace("{subscriberId}", subscriberId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - return client.call( + return client.call( "DELETE", apiPath, apiHeaders, @@ -87,4 +87,4 @@ class Messaging(client: Client) : Service(client) { } -} \ No newline at end of file +} diff --git a/library/src/main/java/io/appwrite/services/Storage.kt b/library/src/main/java/io/appwrite/services/Storage.kt index 80dd45b..a65d5e6 100644 --- a/library/src/main/java/io/appwrite/services/Storage.kt +++ b/library/src/main/java/io/appwrite/services/Storage.kt @@ -32,22 +32,22 @@ class Storage(client: Client) : Service(client) { bucketId: String, queries: List? = null, search: String? = null, - ): io.appwrite.models.FileList { + ): io.appwrite.models.FileList { val apiPath = "/storage/buckets/{bucketId}/files" .replace("{bucketId}", bucketId) val apiParams = mutableMapOf( - "queries" to queries, - "search" to search, + "queries" to queries, + "search" to search, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.FileList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.FileList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -65,7 +65,7 @@ class Storage(client: Client) : Service(client) { * * @param bucketId Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). * @param fileId File ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param file Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/storage#file-input). + * @param file Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file). * @param permissions An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). * @return [io.appwrite.models.File] */ @@ -73,26 +73,26 @@ class Storage(client: Client) : Service(client) { suspend fun createFile( bucketId: String, fileId: String, - file: InputFile, + file: Payload, permissions: List? = null, - onProgress: ((UploadProgress) -> Unit)? = null + onProgress: ((UploadProgress) -> Unit)? = null ): io.appwrite.models.File { val apiPath = "/storage/buckets/{bucketId}/files" .replace("{bucketId}", bucketId) val apiParams = mutableMapOf( - "fileId" to fileId, - "file" to file, - "permissions" to permissions, + "fileId" to fileId, + "file" to file, + "permissions" to permissions, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "multipart/form-data", ) val converter: (Any) -> io.appwrite.models.File = { @Suppress("UNCHECKED_CAST") io.appwrite.models.File.from(map = it as Map) } - val idParamName: String? = "fileId" + val idParamName: String? = "fileId" val paramName = "file" return client.chunkedUpload( apiPath, @@ -119,21 +119,21 @@ class Storage(client: Client) : Service(client) { suspend fun getFile( bucketId: String, fileId: String, - ): io.appwrite.models.File { + ): io.appwrite.models.File { val apiPath = "/storage/buckets/{bucketId}/files/{fileId}" .replace("{bucketId}", bucketId) .replace("{fileId}", fileId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.File = { @Suppress("UNCHECKED_CAST") io.appwrite.models.File.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -161,23 +161,23 @@ class Storage(client: Client) : Service(client) { fileId: String, name: String? = null, permissions: List? = null, - ): io.appwrite.models.File { + ): io.appwrite.models.File { val apiPath = "/storage/buckets/{bucketId}/files/{fileId}" .replace("{bucketId}", bucketId) .replace("{fileId}", fileId) val apiParams = mutableMapOf( - "name" to name, - "permissions" to permissions, + "name" to name, + "permissions" to permissions, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.File = { @Suppress("UNCHECKED_CAST") io.appwrite.models.File.from(map = it as Map) } - return client.call( + return client.call( "PUT", apiPath, apiHeaders, @@ -200,17 +200,17 @@ class Storage(client: Client) : Service(client) { suspend fun deleteFile( bucketId: String, fileId: String, - ): Any { + ): Any { val apiPath = "/storage/buckets/{bucketId}/files/{fileId}" .replace("{bucketId}", bucketId) .replace("{fileId}", fileId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - return client.call( + return client.call( "DELETE", apiPath, apiHeaders, @@ -232,7 +232,7 @@ class Storage(client: Client) : Service(client) { suspend fun getFileDownload( bucketId: String, fileId: String, - ): ByteArray { + ): ByteArray { val apiPath = "/storage/buckets/{bucketId}/files/{fileId}/download" .replace("{bucketId}", bucketId) .replace("{fileId}", fileId) @@ -284,23 +284,23 @@ class Storage(client: Client) : Service(client) { rotation: Long? = null, background: String? = null, output: io.appwrite.enums.ImageFormat? = null, - ): ByteArray { + ): ByteArray { val apiPath = "/storage/buckets/{bucketId}/files/{fileId}/preview" .replace("{bucketId}", bucketId) .replace("{fileId}", fileId) val apiParams = mutableMapOf( - "width" to width, - "height" to height, - "gravity" to gravity, - "quality" to quality, - "borderWidth" to borderWidth, - "borderColor" to borderColor, - "borderRadius" to borderRadius, - "opacity" to opacity, - "rotation" to rotation, - "background" to background, - "output" to output, + "width" to width, + "height" to height, + "gravity" to gravity, + "quality" to quality, + "borderWidth" to borderWidth, + "borderColor" to borderColor, + "borderRadius" to borderRadius, + "opacity" to opacity, + "rotation" to rotation, + "background" to background, + "output" to output, "project" to client.config["project"], ) return client.call( @@ -324,7 +324,7 @@ class Storage(client: Client) : Service(client) { suspend fun getFileView( bucketId: String, fileId: String, - ): ByteArray { + ): ByteArray { val apiPath = "/storage/buckets/{bucketId}/files/{fileId}/view" .replace("{bucketId}", bucketId) .replace("{fileId}", fileId) @@ -341,4 +341,4 @@ class Storage(client: Client) : Service(client) { } -} \ No newline at end of file +} diff --git a/library/src/main/java/io/appwrite/services/Teams.kt b/library/src/main/java/io/appwrite/services/Teams.kt index 304e60d..cf611ba 100644 --- a/library/src/main/java/io/appwrite/services/Teams.kt +++ b/library/src/main/java/io/appwrite/services/Teams.kt @@ -29,21 +29,21 @@ class Teams(client: Client) : Service(client) { queries: List? = null, search: String? = null, nestedType: Class, - ): io.appwrite.models.TeamList { + ): io.appwrite.models.TeamList { val apiPath = "/teams" val apiParams = mutableMapOf( - "queries" to queries, - "search" to search, + "queries" to queries, + "search" to search, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.TeamList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.TeamList.from(map = it as Map, nestedType) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -67,11 +67,11 @@ class Teams(client: Client) : Service(client) { suspend fun list( queries: List? = null, search: String? = null, - ): io.appwrite.models.TeamList> = list( + ): io.appwrite.models.TeamList> = list( queries, search, nestedType = classOf(), - ) + ) /** * Create team @@ -89,22 +89,22 @@ class Teams(client: Client) : Service(client) { name: String, roles: List? = null, nestedType: Class, - ): io.appwrite.models.Team { + ): io.appwrite.models.Team { val apiPath = "/teams" val apiParams = mutableMapOf( - "teamId" to teamId, - "name" to name, - "roles" to roles, + "teamId" to teamId, + "name" to name, + "roles" to roles, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Team = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Team.from(map = it as Map, nestedType) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -130,12 +130,12 @@ class Teams(client: Client) : Service(client) { teamId: String, name: String, roles: List? = null, - ): io.appwrite.models.Team> = create( + ): io.appwrite.models.Team> = create( teamId, name, roles, nestedType = classOf(), - ) + ) /** * Get team @@ -148,20 +148,20 @@ class Teams(client: Client) : Service(client) { suspend fun get( teamId: String, nestedType: Class, - ): io.appwrite.models.Team { + ): io.appwrite.models.Team { val apiPath = "/teams/{teamId}" .replace("{teamId}", teamId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Team = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Team.from(map = it as Map, nestedType) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -182,10 +182,10 @@ class Teams(client: Client) : Service(client) { @Throws(AppwriteException::class) suspend fun get( teamId: String, - ): io.appwrite.models.Team> = get( + ): io.appwrite.models.Team> = get( teamId, nestedType = classOf(), - ) + ) /** * Update name @@ -200,21 +200,21 @@ class Teams(client: Client) : Service(client) { teamId: String, name: String, nestedType: Class, - ): io.appwrite.models.Team { + ): io.appwrite.models.Team { val apiPath = "/teams/{teamId}" .replace("{teamId}", teamId) val apiParams = mutableMapOf( - "name" to name, + "name" to name, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Team = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Team.from(map = it as Map, nestedType) } - return client.call( + return client.call( "PUT", apiPath, apiHeaders, @@ -237,11 +237,11 @@ class Teams(client: Client) : Service(client) { suspend fun updateName( teamId: String, name: String, - ): io.appwrite.models.Team> = updateName( + ): io.appwrite.models.Team> = updateName( teamId, name, nestedType = classOf(), - ) + ) /** * Delete team @@ -253,16 +253,16 @@ class Teams(client: Client) : Service(client) { */ suspend fun delete( teamId: String, - ): Any { + ): Any { val apiPath = "/teams/{teamId}" .replace("{teamId}", teamId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - return client.call( + return client.call( "DELETE", apiPath, apiHeaders, @@ -287,22 +287,22 @@ class Teams(client: Client) : Service(client) { teamId: String, queries: List? = null, search: String? = null, - ): io.appwrite.models.MembershipList { + ): io.appwrite.models.MembershipList { val apiPath = "/teams/{teamId}/memberships" .replace("{teamId}", teamId) val apiParams = mutableMapOf( - "queries" to queries, - "search" to search, + "queries" to queries, + "search" to search, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.MembershipList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.MembershipList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -323,7 +323,7 @@ class Teams(client: Client) : Service(client) { * @param email Email of the new team member. * @param userId ID of the user to be added to a team. * @param phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param url URL to redirect the user back to your app from the invitation email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. + * @param url URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param name Name of the new team member. Max length: 128 chars. * @return [io.appwrite.models.Membership] */ @@ -336,26 +336,26 @@ class Teams(client: Client) : Service(client) { phone: String? = null, url: String? = null, name: String? = null, - ): io.appwrite.models.Membership { + ): io.appwrite.models.Membership { val apiPath = "/teams/{teamId}/memberships" .replace("{teamId}", teamId) val apiParams = mutableMapOf( - "email" to email, - "userId" to userId, - "phone" to phone, - "roles" to roles, - "url" to url, - "name" to name, - ) - val apiHeaders = mutableMapOf( + "email" to email, + "userId" to userId, + "phone" to phone, + "roles" to roles, + "url" to url, + "name" to name, + ) + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Membership = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Membership.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -378,21 +378,21 @@ class Teams(client: Client) : Service(client) { suspend fun getMembership( teamId: String, membershipId: String, - ): io.appwrite.models.Membership { + ): io.appwrite.models.Membership { val apiPath = "/teams/{teamId}/memberships/{membershipId}" .replace("{teamId}", teamId) .replace("{membershipId}", membershipId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Membership = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Membership.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -417,22 +417,22 @@ class Teams(client: Client) : Service(client) { teamId: String, membershipId: String, roles: List, - ): io.appwrite.models.Membership { + ): io.appwrite.models.Membership { val apiPath = "/teams/{teamId}/memberships/{membershipId}" .replace("{teamId}", teamId) .replace("{membershipId}", membershipId) val apiParams = mutableMapOf( - "roles" to roles, + "roles" to roles, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Membership = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Membership.from(map = it as Map) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -455,17 +455,17 @@ class Teams(client: Client) : Service(client) { suspend fun deleteMembership( teamId: String, membershipId: String, - ): Any { + ): Any { val apiPath = "/teams/{teamId}/memberships/{membershipId}" .replace("{teamId}", teamId) .replace("{membershipId}", membershipId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - return client.call( + return client.call( "DELETE", apiPath, apiHeaders, @@ -491,23 +491,23 @@ class Teams(client: Client) : Service(client) { membershipId: String, userId: String, secret: String, - ): io.appwrite.models.Membership { + ): io.appwrite.models.Membership { val apiPath = "/teams/{teamId}/memberships/{membershipId}/status" .replace("{teamId}", teamId) .replace("{membershipId}", membershipId) val apiParams = mutableMapOf( - "userId" to userId, - "secret" to secret, + "userId" to userId, + "secret" to secret, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Membership = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Membership.from(map = it as Map) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -529,20 +529,20 @@ class Teams(client: Client) : Service(client) { suspend fun getPrefs( teamId: String, nestedType: Class, - ): io.appwrite.models.Preferences { + ): io.appwrite.models.Preferences { val apiPath = "/teams/{teamId}/prefs" .replace("{teamId}", teamId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Preferences = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Preferences.from(map = it as Map, nestedType) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -563,10 +563,10 @@ class Teams(client: Client) : Service(client) { @Throws(AppwriteException::class) suspend fun getPrefs( teamId: String, - ): io.appwrite.models.Preferences> = getPrefs( + ): io.appwrite.models.Preferences> = getPrefs( teamId, nestedType = classOf(), - ) + ) /** * Update preferences @@ -581,21 +581,21 @@ class Teams(client: Client) : Service(client) { teamId: String, prefs: Any, nestedType: Class, - ): io.appwrite.models.Preferences { + ): io.appwrite.models.Preferences { val apiPath = "/teams/{teamId}/prefs" .replace("{teamId}", teamId) val apiParams = mutableMapOf( - "prefs" to prefs, + "prefs" to prefs, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Preferences = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Preferences.from(map = it as Map, nestedType) } - return client.call( + return client.call( "PUT", apiPath, apiHeaders, @@ -618,10 +618,10 @@ class Teams(client: Client) : Service(client) { suspend fun updatePrefs( teamId: String, prefs: Any, - ): io.appwrite.models.Preferences> = updatePrefs( + ): io.appwrite.models.Preferences> = updatePrefs( teamId, prefs, nestedType = classOf(), - ) + ) -} \ No newline at end of file +} From 3d4e23c83eb026264cd38f5579d4f27cdc6a8754 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 18 Sep 2024 15:55:09 +0000 Subject: [PATCH 3/8] SDK binary support for executions (fix version) --- README.md | 4 ++-- library/src/main/java/io/appwrite/Client.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f8dab1a..9252fc7 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ repositories { Next, add the dependency to your project's `build.gradle(.kts)` file: ```groovy -implementation("io.appwrite:sdk-for-android:6.0.0") +implementation("io.appwrite:sdk-for-android:7.0.0-rc1") ``` ### Maven @@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file: io.appwrite sdk-for-android - 6.0.0 + 7.0.0-rc1 ``` diff --git a/library/src/main/java/io/appwrite/Client.kt b/library/src/main/java/io/appwrite/Client.kt index 6520241..06a5bf6 100644 --- a/library/src/main/java/io/appwrite/Client.kt +++ b/library/src/main/java/io/appwrite/Client.kt @@ -87,7 +87,7 @@ class Client @JvmOverloads constructor( "x-sdk-name" to "Android", "x-sdk-platform" to "client", "x-sdk-language" to "android", - "x-sdk-version" to "6.0.0", + "x-sdk-version" to "7.0.0-rc1", "x-appwrite-response-format" to "1.6.0" ) config = mutableMapOf() From 9ac99f6d96d68c3ddd00753ea65e5b58a814c013 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Tue, 1 Oct 2024 21:27:09 +0100 Subject: [PATCH 4/8] fix: multipart testing --- README.md | 4 ++-- library/src/main/java/io/appwrite/Client.kt | 10 ++++++++- .../main/java/io/appwrite/models/Execution.kt | 4 ++-- .../main/java/io/appwrite/models/Payload.kt | 2 ++ .../main/java/io/appwrite/services/Account.kt | 22 +++++++++---------- .../main/java/io/appwrite/services/Locale.kt | 2 +- .../main/java/io/appwrite/services/Storage.kt | 2 +- 7 files changed, 28 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 9252fc7..f8dab1a 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ repositories { Next, add the dependency to your project's `build.gradle(.kts)` file: ```groovy -implementation("io.appwrite:sdk-for-android:7.0.0-rc1") +implementation("io.appwrite:sdk-for-android:6.0.0") ``` ### Maven @@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file: io.appwrite sdk-for-android - 7.0.0-rc1 + 6.0.0 ``` diff --git a/library/src/main/java/io/appwrite/Client.kt b/library/src/main/java/io/appwrite/Client.kt index 06a5bf6..635a902 100644 --- a/library/src/main/java/io/appwrite/Client.kt +++ b/library/src/main/java/io/appwrite/Client.kt @@ -87,7 +87,7 @@ class Client @JvmOverloads constructor( "x-sdk-name" to "Android", "x-sdk-platform" to "client", "x-sdk-language" to "android", - "x-sdk-version" to "7.0.0-rc1", + "x-sdk-version" to "6.0.0", "x-appwrite-response-format" to "1.6.0" ) config = mutableMapOf() @@ -320,6 +320,14 @@ class Client @JvmOverloads constructor( ) } } + it.value is Payload -> { + val payload = it.value as Payload + if (payload.sourceType == "path") { + builder.addFormDataPart(it.key, payload.filename, File(payload.path).asRequestBody()) + } else { + builder.addFormDataPart(it.key, payload.toString()) + } + } else -> { builder.addFormDataPart(it.key, it.value.toString()) } diff --git a/library/src/main/java/io/appwrite/models/Execution.kt b/library/src/main/java/io/appwrite/models/Execution.kt index 44724fa..c16659a 100644 --- a/library/src/main/java/io/appwrite/models/Execution.kt +++ b/library/src/main/java/io/appwrite/models/Execution.kt @@ -77,7 +77,7 @@ data class Execution( * HTTP response body. This will return empty unless execution is created as synchronous. */ @SerializedName("responseBody") - val responseBody: String, + val responseBody: Payload, /** * HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. @@ -147,7 +147,7 @@ data class Execution( requestPath = map["requestPath"] as String, requestHeaders = (map["requestHeaders"] as List>).map { Headers.from(map = it) }, responseStatusCode = (map["responseStatusCode"] as Number).toLong(), - responseBody = map["responseBody"] as String, + responseBody = map["responseBody"] as Payload, responseHeaders = (map["responseHeaders"] as List>).map { Headers.from(map = it) }, logs = map["logs"] as String, errors = map["errors"] as String, diff --git a/library/src/main/java/io/appwrite/models/Payload.kt b/library/src/main/java/io/appwrite/models/Payload.kt index 46a13e3..5c9ff7f 100644 --- a/library/src/main/java/io/appwrite/models/Payload.kt +++ b/library/src/main/java/io/appwrite/models/Payload.kt @@ -39,6 +39,8 @@ class Payload private constructor() { } fun toFile(path: String): File { + Files.createDirectories(Paths.get(path).parent); + val file = File(path) file.appendBytes(toBinary()) return file diff --git a/library/src/main/java/io/appwrite/services/Account.kt b/library/src/main/java/io/appwrite/services/Account.kt index 0962796..25c71e3 100644 --- a/library/src/main/java/io/appwrite/services/Account.kt +++ b/library/src/main/java/io/appwrite/services/Account.kt @@ -190,7 +190,7 @@ class Account(client: Client) : Service(client) { ) /** - * List Identities + * List identities * * Get the list of identities for the currently logged in user. * @@ -370,7 +370,7 @@ class Account(client: Client) : Service(client) { ) /** - * Create Authenticator + * Create authenticator * * Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method. * @@ -404,7 +404,7 @@ class Account(client: Client) : Service(client) { /** - * Verify Authenticator + * Verify authenticator * * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. * @@ -441,7 +441,7 @@ class Account(client: Client) : Service(client) { } /** - * Verify Authenticator + * Verify authenticator * * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. * @@ -460,7 +460,7 @@ class Account(client: Client) : Service(client) { ) /** - * Delete Authenticator + * Delete authenticator * * Delete an authenticator for a user by ID. * @@ -489,7 +489,7 @@ class Account(client: Client) : Service(client) { /** - * Create MFA Challenge + * Create MFA challenge * * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. * @@ -523,7 +523,7 @@ class Account(client: Client) : Service(client) { /** - * Create MFA Challenge (confirmation) + * Create MFA challenge (confirmation) * * Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. * @@ -555,7 +555,7 @@ class Account(client: Client) : Service(client) { /** - * List Factors + * List factors * * List the factors available on the account to be used as a MFA challange. * @@ -586,7 +586,7 @@ class Account(client: Client) : Service(client) { /** - * Get MFA Recovery Codes + * Get MFA recovery codes * * Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes. * @@ -617,7 +617,7 @@ class Account(client: Client) : Service(client) { /** - * Create MFA Recovery Codes + * Create MFA recovery codes * * Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. * @@ -648,7 +648,7 @@ class Account(client: Client) : Service(client) { /** - * Regenerate MFA Recovery Codes + * Regenerate MFA recovery codes * * Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes. * diff --git a/library/src/main/java/io/appwrite/services/Locale.kt b/library/src/main/java/io/appwrite/services/Locale.kt index bcee309..097e1f7 100644 --- a/library/src/main/java/io/appwrite/services/Locale.kt +++ b/library/src/main/java/io/appwrite/services/Locale.kt @@ -47,7 +47,7 @@ class Locale(client: Client) : Service(client) { /** - * List Locale Codes + * List locale codes * * List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). * diff --git a/library/src/main/java/io/appwrite/services/Storage.kt b/library/src/main/java/io/appwrite/services/Storage.kt index a65d5e6..c30d37c 100644 --- a/library/src/main/java/io/appwrite/services/Storage.kt +++ b/library/src/main/java/io/appwrite/services/Storage.kt @@ -189,7 +189,7 @@ class Storage(client: Client) : Service(client) { /** - * Delete File + * Delete file * * Delete a file by its unique ID. Only users with write permissions have access to delete this resource. * From fe1d18e03fea87fd481844156e3cecff9d7ff5c3 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Tue, 8 Oct 2024 16:17:10 +0100 Subject: [PATCH 5/8] feat: multipart --- library/src/main/java/io/appwrite/enums/ImageFormat.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/io/appwrite/enums/ImageFormat.kt b/library/src/main/java/io/appwrite/enums/ImageFormat.kt index c6a3b0f..25eea90 100644 --- a/library/src/main/java/io/appwrite/enums/ImageFormat.kt +++ b/library/src/main/java/io/appwrite/enums/ImageFormat.kt @@ -12,7 +12,9 @@ enum class ImageFormat(val value: String) { @SerializedName("png") PNG("png"), @SerializedName("webp") - WEBP("webp"); + WEBP("webp"), + @SerializedName("avif") + AVIF("avif"); override fun toString() = value } \ No newline at end of file From f07d83610c655e5762abbab801bc32893ec2c9c1 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 13 Dec 2024 13:10:34 +0000 Subject: [PATCH 6/8] feat: realtime heartbeat --- .../account/create-email-password-session.md | 4 +- .../java/account/create-email-token.md | 4 +- .../java/account/create-magic-u-r-l-token.md | 6 +- .../java/account/create-o-auth2session.md | 4 +- .../java/account/create-o-auth2token.md | 4 +- .../java/account/create-phone-token.md | 4 +- .../java/account/create-push-target.md | 6 +- docs/examples/java/account/create-recovery.md | 4 +- docs/examples/java/account/create-session.md | 4 +- .../java/account/create-verification.md | 2 +- docs/examples/java/account/create.md | 6 +- docs/examples/java/account/delete-identity.md | 2 +- .../java/account/delete-push-target.md | 2 +- docs/examples/java/account/delete-session.md | 2 +- docs/examples/java/account/get-session.md | 2 +- docs/examples/java/account/update-email.md | 4 +- .../account/update-magic-u-r-l-session.md | 4 +- .../java/account/update-mfa-authenticator.md | 2 +- .../java/account/update-mfa-challenge.md | 4 +- docs/examples/java/account/update-name.md | 2 +- docs/examples/java/account/update-password.md | 2 +- .../java/account/update-phone-session.md | 4 +- .../java/account/update-phone-verification.md | 4 +- docs/examples/java/account/update-phone.md | 4 +- .../java/account/update-push-target.md | 4 +- docs/examples/java/account/update-recovery.md | 4 +- docs/examples/java/account/update-session.md | 2 +- .../java/account/update-verification.md | 4 +- docs/examples/java/avatars/get-favicon.md | 2 +- docs/examples/java/avatars/get-image.md | 2 +- docs/examples/java/avatars/get-initials.md | 2 +- docs/examples/java/avatars/get-q-r.md | 2 +- .../java/databases/create-document.md | 6 +- .../java/databases/delete-document.md | 6 +- docs/examples/java/databases/get-document.md | 6 +- .../examples/java/databases/list-documents.md | 4 +- .../java/databases/update-document.md | 6 +- .../java/functions/create-execution.md | 6 +- docs/examples/java/functions/get-execution.md | 4 +- .../java/functions/list-executions.md | 4 +- .../java/messaging/create-subscriber.md | 6 +- .../java/messaging/delete-subscriber.md | 4 +- docs/examples/java/storage/create-file.md | 8 +- docs/examples/java/storage/delete-file.md | 4 +- .../java/storage/get-file-download.md | 4 +- .../examples/java/storage/get-file-preview.md | 4 +- docs/examples/java/storage/get-file-view.md | 4 +- docs/examples/java/storage/get-file.md | 4 +- docs/examples/java/storage/list-files.md | 4 +- docs/examples/java/storage/update-file.md | 6 +- docs/examples/java/teams/create-membership.md | 12 +- docs/examples/java/teams/create.md | 4 +- docs/examples/java/teams/delete-membership.md | 4 +- docs/examples/java/teams/delete.md | 2 +- docs/examples/java/teams/get-membership.md | 4 +- docs/examples/java/teams/get-prefs.md | 2 +- docs/examples/java/teams/get.md | 2 +- docs/examples/java/teams/list-memberships.md | 4 +- docs/examples/java/teams/list.md | 2 +- .../java/teams/update-membership-status.md | 8 +- docs/examples/java/teams/update-membership.md | 4 +- docs/examples/java/teams/update-name.md | 4 +- docs/examples/java/teams/update-prefs.md | 2 +- .../account/create-email-password-session.md | 4 +- .../kotlin/account/create-email-token.md | 4 +- .../account/create-magic-u-r-l-token.md | 6 +- .../kotlin/account/create-o-auth2session.md | 4 +- .../kotlin/account/create-o-auth2token.md | 4 +- .../kotlin/account/create-phone-token.md | 4 +- .../kotlin/account/create-push-target.md | 6 +- .../kotlin/account/create-recovery.md | 4 +- .../examples/kotlin/account/create-session.md | 4 +- .../kotlin/account/create-verification.md | 2 +- docs/examples/kotlin/account/create.md | 6 +- .../kotlin/account/delete-identity.md | 2 +- .../kotlin/account/delete-push-target.md | 2 +- .../examples/kotlin/account/delete-session.md | 2 +- docs/examples/kotlin/account/get-session.md | 2 +- docs/examples/kotlin/account/update-email.md | 4 +- .../account/update-magic-u-r-l-session.md | 4 +- .../account/update-mfa-authenticator.md | 2 +- .../kotlin/account/update-mfa-challenge.md | 4 +- docs/examples/kotlin/account/update-name.md | 2 +- .../kotlin/account/update-password.md | 2 +- .../kotlin/account/update-phone-session.md | 4 +- .../account/update-phone-verification.md | 4 +- docs/examples/kotlin/account/update-phone.md | 4 +- .../kotlin/account/update-push-target.md | 4 +- .../kotlin/account/update-recovery.md | 4 +- .../examples/kotlin/account/update-session.md | 2 +- .../kotlin/account/update-verification.md | 4 +- docs/examples/kotlin/avatars/get-favicon.md | 2 +- docs/examples/kotlin/avatars/get-image.md | 2 +- docs/examples/kotlin/avatars/get-initials.md | 2 +- docs/examples/kotlin/avatars/get-q-r.md | 2 +- .../kotlin/databases/create-document.md | 6 +- .../kotlin/databases/delete-document.md | 6 +- .../examples/kotlin/databases/get-document.md | 6 +- .../kotlin/databases/list-documents.md | 4 +- .../kotlin/databases/update-document.md | 6 +- .../kotlin/functions/create-execution.md | 6 +- .../kotlin/functions/get-execution.md | 4 +- .../kotlin/functions/list-executions.md | 4 +- .../kotlin/messaging/create-subscriber.md | 6 +- .../kotlin/messaging/delete-subscriber.md | 4 +- docs/examples/kotlin/storage/create-file.md | 8 +- docs/examples/kotlin/storage/delete-file.md | 4 +- .../kotlin/storage/get-file-download.md | 4 +- .../kotlin/storage/get-file-preview.md | 4 +- docs/examples/kotlin/storage/get-file-view.md | 4 +- docs/examples/kotlin/storage/get-file.md | 4 +- docs/examples/kotlin/storage/list-files.md | 4 +- docs/examples/kotlin/storage/update-file.md | 6 +- .../kotlin/teams/create-membership.md | 12 +- docs/examples/kotlin/teams/create.md | 4 +- .../kotlin/teams/delete-membership.md | 4 +- docs/examples/kotlin/teams/delete.md | 2 +- docs/examples/kotlin/teams/get-membership.md | 4 +- docs/examples/kotlin/teams/get-prefs.md | 2 +- docs/examples/kotlin/teams/get.md | 2 +- .../examples/kotlin/teams/list-memberships.md | 4 +- docs/examples/kotlin/teams/list.md | 2 +- .../kotlin/teams/update-membership-status.md | 8 +- .../kotlin/teams/update-membership.md | 4 +- docs/examples/kotlin/teams/update-name.md | 4 +- docs/examples/kotlin/teams/update-prefs.md | 2 +- .../android/ui/accounts/AccountsViewModel.kt | 4 +- library/src/main/java/io/appwrite/Client.kt | 63 +-- .../io/appwrite/extensions/TypeExtensions.kt | 101 +--- .../main/java/io/appwrite/models/Document.kt | 6 +- .../main/java/io/appwrite/models/Execution.kt | 8 +- .../src/main/java/io/appwrite/models/File.kt | 4 +- .../main/java/io/appwrite/models/InputFile.kt | 37 ++ .../java/io/appwrite/models/Membership.kt | 4 +- .../io/appwrite/models/MfaRecoveryCodes.kt | 4 +- .../main/java/io/appwrite/models/Payload.kt | 73 --- .../main/java/io/appwrite/models/Session.kt | 4 +- .../src/main/java/io/appwrite/models/User.kt | 6 +- .../main/java/io/appwrite/services/Account.kt | 436 +++++++++--------- .../main/java/io/appwrite/services/Avatars.kt | 58 +-- .../java/io/appwrite/services/Databases.kt | 62 +-- .../java/io/appwrite/services/Functions.kt | 41 +- .../main/java/io/appwrite/services/Graphql.kt | 18 +- .../main/java/io/appwrite/services/Locale.kt | 50 +- .../java/io/appwrite/services/Messaging.kt | 18 +- .../java/io/appwrite/services/Realtime.kt | 22 + .../main/java/io/appwrite/services/Storage.kt | 76 +-- .../main/java/io/appwrite/services/Teams.kt | 142 +++--- 148 files changed, 807 insertions(+), 934 deletions(-) create mode 100644 library/src/main/java/io/appwrite/models/InputFile.kt delete mode 100644 library/src/main/java/io/appwrite/models/Payload.kt diff --git a/docs/examples/java/account/create-email-password-session.md b/docs/examples/java/account/create-email-password-session.md index 112fb20..817bda0 100644 --- a/docs/examples/java/account/create-email-password-session.md +++ b/docs/examples/java/account/create-email-password-session.md @@ -9,8 +9,8 @@ Client client = new Client(context) Account account = new Account(client); account.createEmailPasswordSession( - "{$example}", // email - "{$example}", // password + "email@example.com", // email + "password", // password new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/create-email-token.md b/docs/examples/java/account/create-email-token.md index 3fafb5e..a4bc83b 100644 --- a/docs/examples/java/account/create-email-token.md +++ b/docs/examples/java/account/create-email-token.md @@ -9,8 +9,8 @@ Client client = new Client(context) Account account = new Account(client); account.createEmailToken( - "{$example}", // userId - "{$example}", // email + "", // userId + "email@example.com", // email false, // phrase (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/account/create-magic-u-r-l-token.md b/docs/examples/java/account/create-magic-u-r-l-token.md index e84b213..e57758a 100644 --- a/docs/examples/java/account/create-magic-u-r-l-token.md +++ b/docs/examples/java/account/create-magic-u-r-l-token.md @@ -9,9 +9,9 @@ Client client = new Client(context) Account account = new Account(client); account.createMagicURLToken( - "{$example}", // userId - "{$example}", // email - "{$example}", // url (optional) + "", // userId + "email@example.com", // email + "https://example.com", // url (optional) false, // phrase (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/account/create-o-auth2session.md b/docs/examples/java/account/create-o-auth2session.md index 591f85e..59f5b41 100644 --- a/docs/examples/java/account/create-o-auth2session.md +++ b/docs/examples/java/account/create-o-auth2session.md @@ -11,8 +11,8 @@ Account account = new Account(client); account.createOAuth2Session( OAuthProvider.AMAZON, // provider - "{$example}", // success (optional) - "{$example}", // failure (optional) + "https://example.com", // success (optional) + "https://example.com", // failure (optional) listOf(), // scopes (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/account/create-o-auth2token.md b/docs/examples/java/account/create-o-auth2token.md index 0866fef..6103196 100644 --- a/docs/examples/java/account/create-o-auth2token.md +++ b/docs/examples/java/account/create-o-auth2token.md @@ -11,8 +11,8 @@ Account account = new Account(client); account.createOAuth2Token( OAuthProvider.AMAZON, // provider - "{$example}", // success (optional) - "{$example}", // failure (optional) + "https://example.com", // success (optional) + "https://example.com", // failure (optional) listOf(), // scopes (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/account/create-phone-token.md b/docs/examples/java/account/create-phone-token.md index ef60cfa..a1ad85b 100644 --- a/docs/examples/java/account/create-phone-token.md +++ b/docs/examples/java/account/create-phone-token.md @@ -9,8 +9,8 @@ Client client = new Client(context) Account account = new Account(client); account.createPhoneToken( - "{$example}", // userId - "{$example}", // phone + "", // userId + "+12065550100", // phone new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/create-push-target.md b/docs/examples/java/account/create-push-target.md index a0dc5a8..34e8fcb 100644 --- a/docs/examples/java/account/create-push-target.md +++ b/docs/examples/java/account/create-push-target.md @@ -9,9 +9,9 @@ Client client = new Client(context) Account account = new Account(client); account.createPushTarget( - "{$example}", // targetId - "{$example}", // identifier - "{$example}", // providerId (optional) + "", // targetId + "", // identifier + "", // providerId (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/create-recovery.md b/docs/examples/java/account/create-recovery.md index 7fba792..4d2af8b 100644 --- a/docs/examples/java/account/create-recovery.md +++ b/docs/examples/java/account/create-recovery.md @@ -9,8 +9,8 @@ Client client = new Client(context) Account account = new Account(client); account.createRecovery( - "{$example}", // email - "{$example}", // url + "email@example.com", // email + "https://example.com", // url new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/create-session.md b/docs/examples/java/account/create-session.md index ff3391f..71d11a5 100644 --- a/docs/examples/java/account/create-session.md +++ b/docs/examples/java/account/create-session.md @@ -9,8 +9,8 @@ Client client = new Client(context) Account account = new Account(client); account.createSession( - "{$example}", // userId - "{$example}", // secret + "", // userId + "", // secret new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/create-verification.md b/docs/examples/java/account/create-verification.md index 74e5b3d..be4f7c9 100644 --- a/docs/examples/java/account/create-verification.md +++ b/docs/examples/java/account/create-verification.md @@ -9,7 +9,7 @@ Client client = new Client(context) Account account = new Account(client); account.createVerification( - "{$example}", // url + "https://example.com", // url new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/create.md b/docs/examples/java/account/create.md index d23bcac..e721248 100644 --- a/docs/examples/java/account/create.md +++ b/docs/examples/java/account/create.md @@ -9,10 +9,10 @@ Client client = new Client(context) Account account = new Account(client); account.create( - "{$example}", // userId - "{$example}", // email + "", // userId + "email@example.com", // email "", // password - "{$example}", // name (optional) + "", // name (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/delete-identity.md b/docs/examples/java/account/delete-identity.md index d72c1e6..6a62ea2 100644 --- a/docs/examples/java/account/delete-identity.md +++ b/docs/examples/java/account/delete-identity.md @@ -9,7 +9,7 @@ Client client = new Client(context) Account account = new Account(client); account.deleteIdentity( - "{$example}", // identityId + "", // identityId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/delete-push-target.md b/docs/examples/java/account/delete-push-target.md index 366a473..c320800 100644 --- a/docs/examples/java/account/delete-push-target.md +++ b/docs/examples/java/account/delete-push-target.md @@ -9,7 +9,7 @@ Client client = new Client(context) Account account = new Account(client); account.deletePushTarget( - "{$example}", // targetId + "", // targetId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/delete-session.md b/docs/examples/java/account/delete-session.md index cb152f4..2efc0f6 100644 --- a/docs/examples/java/account/delete-session.md +++ b/docs/examples/java/account/delete-session.md @@ -9,7 +9,7 @@ Client client = new Client(context) Account account = new Account(client); account.deleteSession( - "{$example}", // sessionId + "", // sessionId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/get-session.md b/docs/examples/java/account/get-session.md index 627026d..3ce4ab5 100644 --- a/docs/examples/java/account/get-session.md +++ b/docs/examples/java/account/get-session.md @@ -9,7 +9,7 @@ Client client = new Client(context) Account account = new Account(client); account.getSession( - "{$example}", // sessionId + "", // sessionId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-email.md b/docs/examples/java/account/update-email.md index 37894f7..98cf907 100644 --- a/docs/examples/java/account/update-email.md +++ b/docs/examples/java/account/update-email.md @@ -9,8 +9,8 @@ Client client = new Client(context) Account account = new Account(client); account.updateEmail( - "{$example}", // email - "{$example}", // password + "email@example.com", // email + "password", // password new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-magic-u-r-l-session.md b/docs/examples/java/account/update-magic-u-r-l-session.md index 4f09fb3..1b79b73 100644 --- a/docs/examples/java/account/update-magic-u-r-l-session.md +++ b/docs/examples/java/account/update-magic-u-r-l-session.md @@ -9,8 +9,8 @@ Client client = new Client(context) Account account = new Account(client); account.updateMagicURLSession( - "{$example}", // userId - "{$example}", // secret + "", // userId + "", // secret new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-mfa-authenticator.md b/docs/examples/java/account/update-mfa-authenticator.md index 9b3c3f6..74321be 100644 --- a/docs/examples/java/account/update-mfa-authenticator.md +++ b/docs/examples/java/account/update-mfa-authenticator.md @@ -11,7 +11,7 @@ Account account = new Account(client); account.updateMfaAuthenticator( AuthenticatorType.TOTP, // type - "{$example}", // otp + "", // otp new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-mfa-challenge.md b/docs/examples/java/account/update-mfa-challenge.md index c898904..a92f007 100644 --- a/docs/examples/java/account/update-mfa-challenge.md +++ b/docs/examples/java/account/update-mfa-challenge.md @@ -9,8 +9,8 @@ Client client = new Client(context) Account account = new Account(client); account.updateMfaChallenge( - "{$example}", // challengeId - "{$example}", // otp + "", // challengeId + "", // otp new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-name.md b/docs/examples/java/account/update-name.md index cd00362..40a5e2e 100644 --- a/docs/examples/java/account/update-name.md +++ b/docs/examples/java/account/update-name.md @@ -9,7 +9,7 @@ Client client = new Client(context) Account account = new Account(client); account.updateName( - "{$example}", // name + "", // name new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-password.md b/docs/examples/java/account/update-password.md index a8b9be7..355c06d 100644 --- a/docs/examples/java/account/update-password.md +++ b/docs/examples/java/account/update-password.md @@ -10,7 +10,7 @@ Account account = new Account(client); account.updatePassword( "", // password - "{$example}", // oldPassword (optional) + "password", // oldPassword (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-phone-session.md b/docs/examples/java/account/update-phone-session.md index 9166d36..042238e 100644 --- a/docs/examples/java/account/update-phone-session.md +++ b/docs/examples/java/account/update-phone-session.md @@ -9,8 +9,8 @@ Client client = new Client(context) Account account = new Account(client); account.updatePhoneSession( - "{$example}", // userId - "{$example}", // secret + "", // userId + "", // secret new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-phone-verification.md b/docs/examples/java/account/update-phone-verification.md index eb50644..ba7b69c 100644 --- a/docs/examples/java/account/update-phone-verification.md +++ b/docs/examples/java/account/update-phone-verification.md @@ -9,8 +9,8 @@ Client client = new Client(context) Account account = new Account(client); account.updatePhoneVerification( - "{$example}", // userId - "{$example}", // secret + "", // userId + "", // secret new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-phone.md b/docs/examples/java/account/update-phone.md index 1e7a1bc..b3ce0f6 100644 --- a/docs/examples/java/account/update-phone.md +++ b/docs/examples/java/account/update-phone.md @@ -9,8 +9,8 @@ Client client = new Client(context) Account account = new Account(client); account.updatePhone( - "{$example}", // phone - "{$example}", // password + "+12065550100", // phone + "password", // password new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-push-target.md b/docs/examples/java/account/update-push-target.md index 15f9b0a..f9491e0 100644 --- a/docs/examples/java/account/update-push-target.md +++ b/docs/examples/java/account/update-push-target.md @@ -9,8 +9,8 @@ Client client = new Client(context) Account account = new Account(client); account.updatePushTarget( - "{$example}", // targetId - "{$example}", // identifier + "", // targetId + "", // identifier new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-recovery.md b/docs/examples/java/account/update-recovery.md index 9ec90c3..e172f12 100644 --- a/docs/examples/java/account/update-recovery.md +++ b/docs/examples/java/account/update-recovery.md @@ -9,8 +9,8 @@ Client client = new Client(context) Account account = new Account(client); account.updateRecovery( - "{$example}", // userId - "{$example}", // secret + "", // userId + "", // secret "", // password new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/account/update-session.md b/docs/examples/java/account/update-session.md index d6093d9..b3e8706 100644 --- a/docs/examples/java/account/update-session.md +++ b/docs/examples/java/account/update-session.md @@ -9,7 +9,7 @@ Client client = new Client(context) Account account = new Account(client); account.updateSession( - "{$example}", // sessionId + "", // sessionId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/account/update-verification.md b/docs/examples/java/account/update-verification.md index ebced41..2594943 100644 --- a/docs/examples/java/account/update-verification.md +++ b/docs/examples/java/account/update-verification.md @@ -9,8 +9,8 @@ Client client = new Client(context) Account account = new Account(client); account.updateVerification( - "{$example}", // userId - "{$example}", // secret + "", // userId + "", // secret new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/avatars/get-favicon.md b/docs/examples/java/avatars/get-favicon.md index ac8e6e6..05bf590 100644 --- a/docs/examples/java/avatars/get-favicon.md +++ b/docs/examples/java/avatars/get-favicon.md @@ -9,7 +9,7 @@ Client client = new Client(context) Avatars avatars = new Avatars(client); avatars.getFavicon( - "{$example}", // url + "https://example.com", // url new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/avatars/get-image.md b/docs/examples/java/avatars/get-image.md index 85eacb1..78fbf98 100644 --- a/docs/examples/java/avatars/get-image.md +++ b/docs/examples/java/avatars/get-image.md @@ -9,7 +9,7 @@ Client client = new Client(context) Avatars avatars = new Avatars(client); avatars.getImage( - "{$example}", // url + "https://example.com", // url 0, // width (optional) 0, // height (optional) new CoroutineCallback<>((result, error) -> { diff --git a/docs/examples/java/avatars/get-initials.md b/docs/examples/java/avatars/get-initials.md index d687c7b..621798b 100644 --- a/docs/examples/java/avatars/get-initials.md +++ b/docs/examples/java/avatars/get-initials.md @@ -9,7 +9,7 @@ Client client = new Client(context) Avatars avatars = new Avatars(client); avatars.getInitials( - "{$example}", // name (optional) + "", // name (optional) 0, // width (optional) 0, // height (optional) "", // background (optional) diff --git a/docs/examples/java/avatars/get-q-r.md b/docs/examples/java/avatars/get-q-r.md index 05a5e8d..fc8bc43 100644 --- a/docs/examples/java/avatars/get-q-r.md +++ b/docs/examples/java/avatars/get-q-r.md @@ -9,7 +9,7 @@ Client client = new Client(context) Avatars avatars = new Avatars(client); avatars.getQR( - "{$example}", // text + "", // text 1, // size (optional) 0, // margin (optional) false, // download (optional) diff --git a/docs/examples/java/databases/create-document.md b/docs/examples/java/databases/create-document.md index fc0465f..6c7e068 100644 --- a/docs/examples/java/databases/create-document.md +++ b/docs/examples/java/databases/create-document.md @@ -9,9 +9,9 @@ Client client = new Client(context) Databases databases = new Databases(client); databases.createDocument( - "{$example}", // databaseId - "{$example}", // collectionId - "{$example}", // documentId + "", // databaseId + "", // collectionId + "", // documentId mapOf( "a" to "b" ), // data listOf("read("any")"), // permissions (optional) new CoroutineCallback<>((result, error) -> { diff --git a/docs/examples/java/databases/delete-document.md b/docs/examples/java/databases/delete-document.md index 50bd674..0cbd6b5 100644 --- a/docs/examples/java/databases/delete-document.md +++ b/docs/examples/java/databases/delete-document.md @@ -9,9 +9,9 @@ Client client = new Client(context) Databases databases = new Databases(client); databases.deleteDocument( - "{$example}", // databaseId - "{$example}", // collectionId - "{$example}", // documentId + "", // databaseId + "", // collectionId + "", // documentId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/databases/get-document.md b/docs/examples/java/databases/get-document.md index cbcca6e..0918c88 100644 --- a/docs/examples/java/databases/get-document.md +++ b/docs/examples/java/databases/get-document.md @@ -9,9 +9,9 @@ Client client = new Client(context) Databases databases = new Databases(client); databases.getDocument( - "{$example}", // databaseId - "{$example}", // collectionId - "{$example}", // documentId + "", // databaseId + "", // collectionId + "", // documentId listOf(), // queries (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/databases/list-documents.md b/docs/examples/java/databases/list-documents.md index a63e929..9cc722b 100644 --- a/docs/examples/java/databases/list-documents.md +++ b/docs/examples/java/databases/list-documents.md @@ -9,8 +9,8 @@ Client client = new Client(context) Databases databases = new Databases(client); databases.listDocuments( - "{$example}", // databaseId - "{$example}", // collectionId + "", // databaseId + "", // collectionId listOf(), // queries (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/databases/update-document.md b/docs/examples/java/databases/update-document.md index 3831c2d..ccfb498 100644 --- a/docs/examples/java/databases/update-document.md +++ b/docs/examples/java/databases/update-document.md @@ -9,9 +9,9 @@ Client client = new Client(context) Databases databases = new Databases(client); databases.updateDocument( - "{$example}", // databaseId - "{$example}", // collectionId - "{$example}", // documentId + "", // databaseId + "", // collectionId + "", // documentId mapOf( "a" to "b" ), // data (optional) listOf("read("any")"), // permissions (optional) new CoroutineCallback<>((result, error) -> { diff --git a/docs/examples/java/functions/create-execution.md b/docs/examples/java/functions/create-execution.md index 89bf4c1..845f02e 100644 --- a/docs/examples/java/functions/create-execution.md +++ b/docs/examples/java/functions/create-execution.md @@ -9,10 +9,10 @@ Client client = new Client(context) Functions functions = new Functions(client); functions.createExecution( - "{$example}", // functionId - Payload.fromJson(mapOf("x" to "y" as Any)), // body (optional) + "", // functionId + "", // body (optional) false, // async (optional) - "{$example}", // path (optional) + "", // path (optional) ExecutionMethod.GET, // method (optional) mapOf( "a" to "b" ), // headers (optional) "", // scheduledAt (optional) diff --git a/docs/examples/java/functions/get-execution.md b/docs/examples/java/functions/get-execution.md index feabf8f..c53ef0e 100644 --- a/docs/examples/java/functions/get-execution.md +++ b/docs/examples/java/functions/get-execution.md @@ -9,8 +9,8 @@ Client client = new Client(context) Functions functions = new Functions(client); functions.getExecution( - "{$example}", // functionId - "{$example}", // executionId + "", // functionId + "", // executionId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/functions/list-executions.md b/docs/examples/java/functions/list-executions.md index 1efd982..b796dc9 100644 --- a/docs/examples/java/functions/list-executions.md +++ b/docs/examples/java/functions/list-executions.md @@ -9,9 +9,9 @@ Client client = new Client(context) Functions functions = new Functions(client); functions.listExecutions( - "{$example}", // functionId + "", // functionId listOf(), // queries (optional) - "{$example}", // search (optional) + "", // search (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/messaging/create-subscriber.md b/docs/examples/java/messaging/create-subscriber.md index 1ce5d6d..e8fa79f 100644 --- a/docs/examples/java/messaging/create-subscriber.md +++ b/docs/examples/java/messaging/create-subscriber.md @@ -9,9 +9,9 @@ Client client = new Client(context) Messaging messaging = new Messaging(client); messaging.createSubscriber( - "{$example}", // topicId - "{$example}", // subscriberId - "{$example}", // targetId + "", // topicId + "", // subscriberId + "", // targetId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/messaging/delete-subscriber.md b/docs/examples/java/messaging/delete-subscriber.md index 07fbd2f..7e5b3d2 100644 --- a/docs/examples/java/messaging/delete-subscriber.md +++ b/docs/examples/java/messaging/delete-subscriber.md @@ -9,8 +9,8 @@ Client client = new Client(context) Messaging messaging = new Messaging(client); messaging.deleteSubscriber( - "{$example}", // topicId - "{$example}", // subscriberId + "", // topicId + "", // subscriberId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/storage/create-file.md b/docs/examples/java/storage/create-file.md index 6da1bf5..bc9ebed 100644 --- a/docs/examples/java/storage/create-file.md +++ b/docs/examples/java/storage/create-file.md @@ -1,6 +1,6 @@ import io.appwrite.Client; import io.appwrite.coroutines.CoroutineCallback; -import io.appwrite.models.Payload; +import io.appwrite.models.InputFile; import io.appwrite.services.Storage; Client client = new Client(context) @@ -10,9 +10,9 @@ Client client = new Client(context) Storage storage = new Storage(client); storage.createFile( - "{$example}", // bucketId - "{$example}", // fileId - Payload.fromFile("/path/to/file.png"), // file + "", // bucketId + "", // fileId + InputFile.fromPath("file.png"), // file listOf("read("any")"), // permissions (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/storage/delete-file.md b/docs/examples/java/storage/delete-file.md index 1defa04..eaeb47b 100644 --- a/docs/examples/java/storage/delete-file.md +++ b/docs/examples/java/storage/delete-file.md @@ -9,8 +9,8 @@ Client client = new Client(context) Storage storage = new Storage(client); storage.deleteFile( - "{$example}", // bucketId - "{$example}", // fileId + "", // bucketId + "", // fileId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/storage/get-file-download.md b/docs/examples/java/storage/get-file-download.md index 611b5c7..d0fdc41 100644 --- a/docs/examples/java/storage/get-file-download.md +++ b/docs/examples/java/storage/get-file-download.md @@ -9,8 +9,8 @@ Client client = new Client(context) Storage storage = new Storage(client); storage.getFileDownload( - "{$example}", // bucketId - "{$example}", // fileId + "", // bucketId + "", // fileId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/storage/get-file-preview.md b/docs/examples/java/storage/get-file-preview.md index c29be40..c935e6f 100644 --- a/docs/examples/java/storage/get-file-preview.md +++ b/docs/examples/java/storage/get-file-preview.md @@ -9,8 +9,8 @@ Client client = new Client(context) Storage storage = new Storage(client); storage.getFilePreview( - "{$example}", // bucketId - "{$example}", // fileId + "", // bucketId + "", // fileId 0, // width (optional) 0, // height (optional) ImageGravity.CENTER, // gravity (optional) diff --git a/docs/examples/java/storage/get-file-view.md b/docs/examples/java/storage/get-file-view.md index 5cac2ce..bbfd04d 100644 --- a/docs/examples/java/storage/get-file-view.md +++ b/docs/examples/java/storage/get-file-view.md @@ -9,8 +9,8 @@ Client client = new Client(context) Storage storage = new Storage(client); storage.getFileView( - "{$example}", // bucketId - "{$example}", // fileId + "", // bucketId + "", // fileId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/storage/get-file.md b/docs/examples/java/storage/get-file.md index 54dd453..a63122f 100644 --- a/docs/examples/java/storage/get-file.md +++ b/docs/examples/java/storage/get-file.md @@ -9,8 +9,8 @@ Client client = new Client(context) Storage storage = new Storage(client); storage.getFile( - "{$example}", // bucketId - "{$example}", // fileId + "", // bucketId + "", // fileId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/storage/list-files.md b/docs/examples/java/storage/list-files.md index 56ec1a8..dc327fc 100644 --- a/docs/examples/java/storage/list-files.md +++ b/docs/examples/java/storage/list-files.md @@ -9,9 +9,9 @@ Client client = new Client(context) Storage storage = new Storage(client); storage.listFiles( - "{$example}", // bucketId + "", // bucketId listOf(), // queries (optional) - "{$example}", // search (optional) + "", // search (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/storage/update-file.md b/docs/examples/java/storage/update-file.md index 563a413..ed81821 100644 --- a/docs/examples/java/storage/update-file.md +++ b/docs/examples/java/storage/update-file.md @@ -9,9 +9,9 @@ Client client = new Client(context) Storage storage = new Storage(client); storage.updateFile( - "{$example}", // bucketId - "{$example}", // fileId - "{$example}", // name (optional) + "", // bucketId + "", // fileId + "", // name (optional) listOf("read("any")"), // permissions (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/teams/create-membership.md b/docs/examples/java/teams/create-membership.md index 60461af..b30f176 100644 --- a/docs/examples/java/teams/create-membership.md +++ b/docs/examples/java/teams/create-membership.md @@ -9,13 +9,13 @@ Client client = new Client(context) Teams teams = new Teams(client); teams.createMembership( - "{$example}", // teamId + "", // teamId listOf(), // roles - "{$example}", // email (optional) - "{$example}", // userId (optional) - "{$example}", // phone (optional) - "{$example}", // url (optional) - "{$example}", // name (optional) + "email@example.com", // email (optional) + "", // userId (optional) + "+12065550100", // phone (optional) + "https://example.com", // url (optional) + "", // name (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/teams/create.md b/docs/examples/java/teams/create.md index 00f691b..a0d4f07 100644 --- a/docs/examples/java/teams/create.md +++ b/docs/examples/java/teams/create.md @@ -9,8 +9,8 @@ Client client = new Client(context) Teams teams = new Teams(client); teams.create( - "{$example}", // teamId - "{$example}", // name + "", // teamId + "", // name listOf(), // roles (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/teams/delete-membership.md b/docs/examples/java/teams/delete-membership.md index bf6c877..7f9189f 100644 --- a/docs/examples/java/teams/delete-membership.md +++ b/docs/examples/java/teams/delete-membership.md @@ -9,8 +9,8 @@ Client client = new Client(context) Teams teams = new Teams(client); teams.deleteMembership( - "{$example}", // teamId - "{$example}", // membershipId + "", // teamId + "", // membershipId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/teams/delete.md b/docs/examples/java/teams/delete.md index aa8bfac..2f4e861 100644 --- a/docs/examples/java/teams/delete.md +++ b/docs/examples/java/teams/delete.md @@ -9,7 +9,7 @@ Client client = new Client(context) Teams teams = new Teams(client); teams.delete( - "{$example}", // teamId + "", // teamId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/teams/get-membership.md b/docs/examples/java/teams/get-membership.md index 6da129e..529feb2 100644 --- a/docs/examples/java/teams/get-membership.md +++ b/docs/examples/java/teams/get-membership.md @@ -9,8 +9,8 @@ Client client = new Client(context) Teams teams = new Teams(client); teams.getMembership( - "{$example}", // teamId - "{$example}", // membershipId + "", // teamId + "", // membershipId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/teams/get-prefs.md b/docs/examples/java/teams/get-prefs.md index 81f344b..61da757 100644 --- a/docs/examples/java/teams/get-prefs.md +++ b/docs/examples/java/teams/get-prefs.md @@ -9,7 +9,7 @@ Client client = new Client(context) Teams teams = new Teams(client); teams.getPrefs( - "{$example}", // teamId + "", // teamId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/teams/get.md b/docs/examples/java/teams/get.md index c53aeba..39fe4d4 100644 --- a/docs/examples/java/teams/get.md +++ b/docs/examples/java/teams/get.md @@ -9,7 +9,7 @@ Client client = new Client(context) Teams teams = new Teams(client); teams.get( - "{$example}", // teamId + "", // teamId new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/teams/list-memberships.md b/docs/examples/java/teams/list-memberships.md index 137ee2a..58430f0 100644 --- a/docs/examples/java/teams/list-memberships.md +++ b/docs/examples/java/teams/list-memberships.md @@ -9,9 +9,9 @@ Client client = new Client(context) Teams teams = new Teams(client); teams.listMemberships( - "{$example}", // teamId + "", // teamId listOf(), // queries (optional) - "{$example}", // search (optional) + "", // search (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/teams/list.md b/docs/examples/java/teams/list.md index e918ac8..914509f 100644 --- a/docs/examples/java/teams/list.md +++ b/docs/examples/java/teams/list.md @@ -10,7 +10,7 @@ Teams teams = new Teams(client); teams.list( listOf(), // queries (optional) - "{$example}", // search (optional) + "", // search (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/teams/update-membership-status.md b/docs/examples/java/teams/update-membership-status.md index 80bfe17..5134613 100644 --- a/docs/examples/java/teams/update-membership-status.md +++ b/docs/examples/java/teams/update-membership-status.md @@ -9,10 +9,10 @@ Client client = new Client(context) Teams teams = new Teams(client); teams.updateMembershipStatus( - "{$example}", // teamId - "{$example}", // membershipId - "{$example}", // userId - "{$example}", // secret + "", // teamId + "", // membershipId + "", // userId + "", // secret new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/teams/update-membership.md b/docs/examples/java/teams/update-membership.md index 69c99b6..a60c2a0 100644 --- a/docs/examples/java/teams/update-membership.md +++ b/docs/examples/java/teams/update-membership.md @@ -9,8 +9,8 @@ Client client = new Client(context) Teams teams = new Teams(client); teams.updateMembership( - "{$example}", // teamId - "{$example}", // membershipId + "", // teamId + "", // membershipId listOf(), // roles new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/java/teams/update-name.md b/docs/examples/java/teams/update-name.md index 7d9d96d..54f218e 100644 --- a/docs/examples/java/teams/update-name.md +++ b/docs/examples/java/teams/update-name.md @@ -9,8 +9,8 @@ Client client = new Client(context) Teams teams = new Teams(client); teams.updateName( - "{$example}", // teamId - "{$example}", // name + "", // teamId + "", // name new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/java/teams/update-prefs.md b/docs/examples/java/teams/update-prefs.md index 334fd6d..eaa161e 100644 --- a/docs/examples/java/teams/update-prefs.md +++ b/docs/examples/java/teams/update-prefs.md @@ -9,7 +9,7 @@ Client client = new Client(context) Teams teams = new Teams(client); teams.updatePrefs( - "{$example}", // teamId + "", // teamId mapOf( "a" to "b" ), // prefs new CoroutineCallback<>((result, error) -> { if (error != null) { diff --git a/docs/examples/kotlin/account/create-email-password-session.md b/docs/examples/kotlin/account/create-email-password-session.md index 6b69b3a..8c44759 100644 --- a/docs/examples/kotlin/account/create-email-password-session.md +++ b/docs/examples/kotlin/account/create-email-password-session.md @@ -9,6 +9,6 @@ val client = Client(context) val account = Account(client) val result = account.createEmailPasswordSession( - email = "{$example}", - password = "{$example}", + email = "email@example.com", + password = "password", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/create-email-token.md b/docs/examples/kotlin/account/create-email-token.md index 46e6926..219e793 100644 --- a/docs/examples/kotlin/account/create-email-token.md +++ b/docs/examples/kotlin/account/create-email-token.md @@ -9,7 +9,7 @@ val client = Client(context) val account = Account(client) val result = account.createEmailToken( - userId = "{$example}", - email = "{$example}", + userId = "", + email = "email@example.com", phrase = false, // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/create-magic-u-r-l-token.md b/docs/examples/kotlin/account/create-magic-u-r-l-token.md index 9851dab..905e942 100644 --- a/docs/examples/kotlin/account/create-magic-u-r-l-token.md +++ b/docs/examples/kotlin/account/create-magic-u-r-l-token.md @@ -9,8 +9,8 @@ val client = Client(context) val account = Account(client) val result = account.createMagicURLToken( - userId = "{$example}", - email = "{$example}", - url = "{$example}", // (optional) + userId = "", + email = "email@example.com", + url = "https://example.com", // (optional) phrase = false, // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/create-o-auth2session.md b/docs/examples/kotlin/account/create-o-auth2session.md index 7f63375..fc9d822 100644 --- a/docs/examples/kotlin/account/create-o-auth2session.md +++ b/docs/examples/kotlin/account/create-o-auth2session.md @@ -11,7 +11,7 @@ val account = Account(client) account.createOAuth2Session( provider = OAuthProvider.AMAZON, - success = "{$example}", // (optional) - failure = "{$example}", // (optional) + success = "https://example.com", // (optional) + failure = "https://example.com", // (optional) scopes = listOf(), // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/create-o-auth2token.md b/docs/examples/kotlin/account/create-o-auth2token.md index 7607380..11a814b 100644 --- a/docs/examples/kotlin/account/create-o-auth2token.md +++ b/docs/examples/kotlin/account/create-o-auth2token.md @@ -11,7 +11,7 @@ val account = Account(client) account.createOAuth2Token( provider = OAuthProvider.AMAZON, - success = "{$example}", // (optional) - failure = "{$example}", // (optional) + success = "https://example.com", // (optional) + failure = "https://example.com", // (optional) scopes = listOf(), // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/create-phone-token.md b/docs/examples/kotlin/account/create-phone-token.md index acea79b..56b53c2 100644 --- a/docs/examples/kotlin/account/create-phone-token.md +++ b/docs/examples/kotlin/account/create-phone-token.md @@ -9,6 +9,6 @@ val client = Client(context) val account = Account(client) val result = account.createPhoneToken( - userId = "{$example}", - phone = "{$example}", + userId = "", + phone = "+12065550100", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/create-push-target.md b/docs/examples/kotlin/account/create-push-target.md index df6d9fe..7dd2101 100644 --- a/docs/examples/kotlin/account/create-push-target.md +++ b/docs/examples/kotlin/account/create-push-target.md @@ -9,7 +9,7 @@ val client = Client(context) val account = Account(client) val result = account.createPushTarget( - targetId = "{$example}", - identifier = "{$example}", - providerId = "{$example}", // (optional) + targetId = "", + identifier = "", + providerId = "", // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/create-recovery.md b/docs/examples/kotlin/account/create-recovery.md index 13e8fbc..d03bd32 100644 --- a/docs/examples/kotlin/account/create-recovery.md +++ b/docs/examples/kotlin/account/create-recovery.md @@ -9,6 +9,6 @@ val client = Client(context) val account = Account(client) val result = account.createRecovery( - email = "{$example}", - url = "{$example}", + email = "email@example.com", + url = "https://example.com", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/create-session.md b/docs/examples/kotlin/account/create-session.md index 000ddb8..2b3da6d 100644 --- a/docs/examples/kotlin/account/create-session.md +++ b/docs/examples/kotlin/account/create-session.md @@ -9,6 +9,6 @@ val client = Client(context) val account = Account(client) val result = account.createSession( - userId = "{$example}", - secret = "{$example}", + userId = "", + secret = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/create-verification.md b/docs/examples/kotlin/account/create-verification.md index e0a6b38..54174be 100644 --- a/docs/examples/kotlin/account/create-verification.md +++ b/docs/examples/kotlin/account/create-verification.md @@ -9,5 +9,5 @@ val client = Client(context) val account = Account(client) val result = account.createVerification( - url = "{$example}", + url = "https://example.com", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/create.md b/docs/examples/kotlin/account/create.md index 38fbca9..2ee3ae4 100644 --- a/docs/examples/kotlin/account/create.md +++ b/docs/examples/kotlin/account/create.md @@ -9,8 +9,8 @@ val client = Client(context) val account = Account(client) val result = account.create( - userId = "{$example}", - email = "{$example}", + userId = "", + email = "email@example.com", password = "", - name = "{$example}", // (optional) + name = "", // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/delete-identity.md b/docs/examples/kotlin/account/delete-identity.md index 78bdc8d..1e5d206 100644 --- a/docs/examples/kotlin/account/delete-identity.md +++ b/docs/examples/kotlin/account/delete-identity.md @@ -9,5 +9,5 @@ val client = Client(context) val account = Account(client) val result = account.deleteIdentity( - identityId = "{$example}", + identityId = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/delete-push-target.md b/docs/examples/kotlin/account/delete-push-target.md index 257bd3e..e67b180 100644 --- a/docs/examples/kotlin/account/delete-push-target.md +++ b/docs/examples/kotlin/account/delete-push-target.md @@ -9,5 +9,5 @@ val client = Client(context) val account = Account(client) val result = account.deletePushTarget( - targetId = "{$example}", + targetId = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/delete-session.md b/docs/examples/kotlin/account/delete-session.md index 53db6d4..0990989 100644 --- a/docs/examples/kotlin/account/delete-session.md +++ b/docs/examples/kotlin/account/delete-session.md @@ -9,5 +9,5 @@ val client = Client(context) val account = Account(client) val result = account.deleteSession( - sessionId = "{$example}", + sessionId = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/get-session.md b/docs/examples/kotlin/account/get-session.md index bb39027..42e61fd 100644 --- a/docs/examples/kotlin/account/get-session.md +++ b/docs/examples/kotlin/account/get-session.md @@ -9,5 +9,5 @@ val client = Client(context) val account = Account(client) val result = account.getSession( - sessionId = "{$example}", + sessionId = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-email.md b/docs/examples/kotlin/account/update-email.md index b2d749a..072d6db 100644 --- a/docs/examples/kotlin/account/update-email.md +++ b/docs/examples/kotlin/account/update-email.md @@ -9,6 +9,6 @@ val client = Client(context) val account = Account(client) val result = account.updateEmail( - email = "{$example}", - password = "{$example}", + email = "email@example.com", + password = "password", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-magic-u-r-l-session.md b/docs/examples/kotlin/account/update-magic-u-r-l-session.md index d4f2043..52d0ad7 100644 --- a/docs/examples/kotlin/account/update-magic-u-r-l-session.md +++ b/docs/examples/kotlin/account/update-magic-u-r-l-session.md @@ -9,6 +9,6 @@ val client = Client(context) val account = Account(client) val result = account.updateMagicURLSession( - userId = "{$example}", - secret = "{$example}", + userId = "", + secret = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-mfa-authenticator.md b/docs/examples/kotlin/account/update-mfa-authenticator.md index 3959917..321f25b 100644 --- a/docs/examples/kotlin/account/update-mfa-authenticator.md +++ b/docs/examples/kotlin/account/update-mfa-authenticator.md @@ -11,5 +11,5 @@ val account = Account(client) val result = account.updateMfaAuthenticator( type = AuthenticatorType.TOTP, - otp = "{$example}", + otp = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-mfa-challenge.md b/docs/examples/kotlin/account/update-mfa-challenge.md index 40fa58e..021f515 100644 --- a/docs/examples/kotlin/account/update-mfa-challenge.md +++ b/docs/examples/kotlin/account/update-mfa-challenge.md @@ -9,6 +9,6 @@ val client = Client(context) val account = Account(client) val result = account.updateMfaChallenge( - challengeId = "{$example}", - otp = "{$example}", + challengeId = "", + otp = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-name.md b/docs/examples/kotlin/account/update-name.md index 0a52615..374f84f 100644 --- a/docs/examples/kotlin/account/update-name.md +++ b/docs/examples/kotlin/account/update-name.md @@ -9,5 +9,5 @@ val client = Client(context) val account = Account(client) val result = account.updateName( - name = "{$example}", + name = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-password.md b/docs/examples/kotlin/account/update-password.md index 75c57f4..edf5117 100644 --- a/docs/examples/kotlin/account/update-password.md +++ b/docs/examples/kotlin/account/update-password.md @@ -10,5 +10,5 @@ val account = Account(client) val result = account.updatePassword( password = "", - oldPassword = "{$example}", // (optional) + oldPassword = "password", // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-phone-session.md b/docs/examples/kotlin/account/update-phone-session.md index 31ccdef..93e080d 100644 --- a/docs/examples/kotlin/account/update-phone-session.md +++ b/docs/examples/kotlin/account/update-phone-session.md @@ -9,6 +9,6 @@ val client = Client(context) val account = Account(client) val result = account.updatePhoneSession( - userId = "{$example}", - secret = "{$example}", + userId = "", + secret = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-phone-verification.md b/docs/examples/kotlin/account/update-phone-verification.md index 9636ecd..226b21d 100644 --- a/docs/examples/kotlin/account/update-phone-verification.md +++ b/docs/examples/kotlin/account/update-phone-verification.md @@ -9,6 +9,6 @@ val client = Client(context) val account = Account(client) val result = account.updatePhoneVerification( - userId = "{$example}", - secret = "{$example}", + userId = "", + secret = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-phone.md b/docs/examples/kotlin/account/update-phone.md index 3f882b2..772c099 100644 --- a/docs/examples/kotlin/account/update-phone.md +++ b/docs/examples/kotlin/account/update-phone.md @@ -9,6 +9,6 @@ val client = Client(context) val account = Account(client) val result = account.updatePhone( - phone = "{$example}", - password = "{$example}", + phone = "+12065550100", + password = "password", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-push-target.md b/docs/examples/kotlin/account/update-push-target.md index 315d770..c6e6f21 100644 --- a/docs/examples/kotlin/account/update-push-target.md +++ b/docs/examples/kotlin/account/update-push-target.md @@ -9,6 +9,6 @@ val client = Client(context) val account = Account(client) val result = account.updatePushTarget( - targetId = "{$example}", - identifier = "{$example}", + targetId = "", + identifier = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-recovery.md b/docs/examples/kotlin/account/update-recovery.md index 5e9866d..b448114 100644 --- a/docs/examples/kotlin/account/update-recovery.md +++ b/docs/examples/kotlin/account/update-recovery.md @@ -9,7 +9,7 @@ val client = Client(context) val account = Account(client) val result = account.updateRecovery( - userId = "{$example}", - secret = "{$example}", + userId = "", + secret = "", password = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-session.md b/docs/examples/kotlin/account/update-session.md index e4b85a8..43d84e1 100644 --- a/docs/examples/kotlin/account/update-session.md +++ b/docs/examples/kotlin/account/update-session.md @@ -9,5 +9,5 @@ val client = Client(context) val account = Account(client) val result = account.updateSession( - sessionId = "{$example}", + sessionId = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/account/update-verification.md b/docs/examples/kotlin/account/update-verification.md index 7a58116..3c9c465 100644 --- a/docs/examples/kotlin/account/update-verification.md +++ b/docs/examples/kotlin/account/update-verification.md @@ -9,6 +9,6 @@ val client = Client(context) val account = Account(client) val result = account.updateVerification( - userId = "{$example}", - secret = "{$example}", + userId = "", + secret = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/avatars/get-favicon.md b/docs/examples/kotlin/avatars/get-favicon.md index b95f9c8..5f83bdd 100644 --- a/docs/examples/kotlin/avatars/get-favicon.md +++ b/docs/examples/kotlin/avatars/get-favicon.md @@ -9,5 +9,5 @@ val client = Client(context) val avatars = Avatars(client) val result = avatars.getFavicon( - url = "{$example}", + url = "https://example.com", ) \ No newline at end of file diff --git a/docs/examples/kotlin/avatars/get-image.md b/docs/examples/kotlin/avatars/get-image.md index 64d8619..a9a7c2a 100644 --- a/docs/examples/kotlin/avatars/get-image.md +++ b/docs/examples/kotlin/avatars/get-image.md @@ -9,7 +9,7 @@ val client = Client(context) val avatars = Avatars(client) val result = avatars.getImage( - url = "{$example}", + url = "https://example.com", width = 0, // (optional) height = 0, // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/avatars/get-initials.md b/docs/examples/kotlin/avatars/get-initials.md index c7388b0..bd2ae1b 100644 --- a/docs/examples/kotlin/avatars/get-initials.md +++ b/docs/examples/kotlin/avatars/get-initials.md @@ -9,7 +9,7 @@ val client = Client(context) val avatars = Avatars(client) val result = avatars.getInitials( - name = "{$example}", // (optional) + name = "", // (optional) width = 0, // (optional) height = 0, // (optional) background = "", // (optional) diff --git a/docs/examples/kotlin/avatars/get-q-r.md b/docs/examples/kotlin/avatars/get-q-r.md index 1157d95..9e02a0c 100644 --- a/docs/examples/kotlin/avatars/get-q-r.md +++ b/docs/examples/kotlin/avatars/get-q-r.md @@ -9,7 +9,7 @@ val client = Client(context) val avatars = Avatars(client) val result = avatars.getQR( - text = "{$example}", + text = "", size = 1, // (optional) margin = 0, // (optional) download = false, // (optional) diff --git a/docs/examples/kotlin/databases/create-document.md b/docs/examples/kotlin/databases/create-document.md index ef2a268..2b77405 100644 --- a/docs/examples/kotlin/databases/create-document.md +++ b/docs/examples/kotlin/databases/create-document.md @@ -9,9 +9,9 @@ val client = Client(context) val databases = Databases(client) val result = databases.createDocument( - databaseId = "{$example}", - collectionId = "{$example}", - documentId = "{$example}", + databaseId = "", + collectionId = "", + documentId = "", data = mapOf( "a" to "b" ), permissions = listOf("read("any")"), // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/databases/delete-document.md b/docs/examples/kotlin/databases/delete-document.md index 240e308..e3e6de3 100644 --- a/docs/examples/kotlin/databases/delete-document.md +++ b/docs/examples/kotlin/databases/delete-document.md @@ -9,7 +9,7 @@ val client = Client(context) val databases = Databases(client) val result = databases.deleteDocument( - databaseId = "{$example}", - collectionId = "{$example}", - documentId = "{$example}", + databaseId = "", + collectionId = "", + documentId = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/databases/get-document.md b/docs/examples/kotlin/databases/get-document.md index fb13fb1..6ed6c8b 100644 --- a/docs/examples/kotlin/databases/get-document.md +++ b/docs/examples/kotlin/databases/get-document.md @@ -9,8 +9,8 @@ val client = Client(context) val databases = Databases(client) val result = databases.getDocument( - databaseId = "{$example}", - collectionId = "{$example}", - documentId = "{$example}", + databaseId = "", + collectionId = "", + documentId = "", queries = listOf(), // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/databases/list-documents.md b/docs/examples/kotlin/databases/list-documents.md index 2f4c8ae..ff419c4 100644 --- a/docs/examples/kotlin/databases/list-documents.md +++ b/docs/examples/kotlin/databases/list-documents.md @@ -9,7 +9,7 @@ val client = Client(context) val databases = Databases(client) val result = databases.listDocuments( - databaseId = "{$example}", - collectionId = "{$example}", + databaseId = "", + collectionId = "", queries = listOf(), // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/databases/update-document.md b/docs/examples/kotlin/databases/update-document.md index fb9b17c..630e2b6 100644 --- a/docs/examples/kotlin/databases/update-document.md +++ b/docs/examples/kotlin/databases/update-document.md @@ -9,9 +9,9 @@ val client = Client(context) val databases = Databases(client) val result = databases.updateDocument( - databaseId = "{$example}", - collectionId = "{$example}", - documentId = "{$example}", + databaseId = "", + collectionId = "", + documentId = "", data = mapOf( "a" to "b" ), // (optional) permissions = listOf("read("any")"), // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/functions/create-execution.md b/docs/examples/kotlin/functions/create-execution.md index d6ca800..937bb4f 100644 --- a/docs/examples/kotlin/functions/create-execution.md +++ b/docs/examples/kotlin/functions/create-execution.md @@ -9,10 +9,10 @@ val client = Client(context) val functions = Functions(client) val result = functions.createExecution( - functionId = "{$example}", - body = Payload.fromJson(mapOf("x" to "y" as Any)), // (optional) + functionId = "", + body = "", // (optional) async = false, // (optional) - path = "{$example}", // (optional) + path = "", // (optional) method = ExecutionMethod.GET, // (optional) headers = mapOf( "a" to "b" ), // (optional) scheduledAt = "", // (optional) diff --git a/docs/examples/kotlin/functions/get-execution.md b/docs/examples/kotlin/functions/get-execution.md index 2e2c54e..60b2e0f 100644 --- a/docs/examples/kotlin/functions/get-execution.md +++ b/docs/examples/kotlin/functions/get-execution.md @@ -9,6 +9,6 @@ val client = Client(context) val functions = Functions(client) val result = functions.getExecution( - functionId = "{$example}", - executionId = "{$example}", + functionId = "", + executionId = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/functions/list-executions.md b/docs/examples/kotlin/functions/list-executions.md index f916c9d..90b2bf6 100644 --- a/docs/examples/kotlin/functions/list-executions.md +++ b/docs/examples/kotlin/functions/list-executions.md @@ -9,7 +9,7 @@ val client = Client(context) val functions = Functions(client) val result = functions.listExecutions( - functionId = "{$example}", + functionId = "", queries = listOf(), // (optional) - search = "{$example}", // (optional) + search = "", // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/messaging/create-subscriber.md b/docs/examples/kotlin/messaging/create-subscriber.md index 4292dec..db23342 100644 --- a/docs/examples/kotlin/messaging/create-subscriber.md +++ b/docs/examples/kotlin/messaging/create-subscriber.md @@ -9,7 +9,7 @@ val client = Client(context) val messaging = Messaging(client) val result = messaging.createSubscriber( - topicId = "{$example}", - subscriberId = "{$example}", - targetId = "{$example}", + topicId = "", + subscriberId = "", + targetId = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/messaging/delete-subscriber.md b/docs/examples/kotlin/messaging/delete-subscriber.md index 0617824..ab0d479 100644 --- a/docs/examples/kotlin/messaging/delete-subscriber.md +++ b/docs/examples/kotlin/messaging/delete-subscriber.md @@ -9,6 +9,6 @@ val client = Client(context) val messaging = Messaging(client) val result = messaging.deleteSubscriber( - topicId = "{$example}", - subscriberId = "{$example}", + topicId = "", + subscriberId = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/storage/create-file.md b/docs/examples/kotlin/storage/create-file.md index 816ece1..d327e72 100644 --- a/docs/examples/kotlin/storage/create-file.md +++ b/docs/examples/kotlin/storage/create-file.md @@ -1,6 +1,6 @@ import io.appwrite.Client import io.appwrite.coroutines.CoroutineCallback -import io.appwrite.models.Payload +import io.appwrite.models.InputFile import io.appwrite.services.Storage val client = Client(context) @@ -10,8 +10,8 @@ val client = Client(context) val storage = Storage(client) val result = storage.createFile( - bucketId = "{$example}", - fileId = "{$example}", - file = Payload.fromFile("/path/to/file.png"), + bucketId = "", + fileId = "", + file = InputFile.fromPath("file.png"), permissions = listOf("read("any")"), // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/storage/delete-file.md b/docs/examples/kotlin/storage/delete-file.md index d4f802b..60df78e 100644 --- a/docs/examples/kotlin/storage/delete-file.md +++ b/docs/examples/kotlin/storage/delete-file.md @@ -9,6 +9,6 @@ val client = Client(context) val storage = Storage(client) val result = storage.deleteFile( - bucketId = "{$example}", - fileId = "{$example}", + bucketId = "", + fileId = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/storage/get-file-download.md b/docs/examples/kotlin/storage/get-file-download.md index 3ae382e..bb97541 100644 --- a/docs/examples/kotlin/storage/get-file-download.md +++ b/docs/examples/kotlin/storage/get-file-download.md @@ -9,6 +9,6 @@ val client = Client(context) val storage = Storage(client) val result = storage.getFileDownload( - bucketId = "{$example}", - fileId = "{$example}", + bucketId = "", + fileId = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/storage/get-file-preview.md b/docs/examples/kotlin/storage/get-file-preview.md index cc6911a..904f3ec 100644 --- a/docs/examples/kotlin/storage/get-file-preview.md +++ b/docs/examples/kotlin/storage/get-file-preview.md @@ -9,8 +9,8 @@ val client = Client(context) val storage = Storage(client) val result = storage.getFilePreview( - bucketId = "{$example}", - fileId = "{$example}", + bucketId = "", + fileId = "", width = 0, // (optional) height = 0, // (optional) gravity = ImageGravity.CENTER, // (optional) diff --git a/docs/examples/kotlin/storage/get-file-view.md b/docs/examples/kotlin/storage/get-file-view.md index bf50695..898c1ee 100644 --- a/docs/examples/kotlin/storage/get-file-view.md +++ b/docs/examples/kotlin/storage/get-file-view.md @@ -9,6 +9,6 @@ val client = Client(context) val storage = Storage(client) val result = storage.getFileView( - bucketId = "{$example}", - fileId = "{$example}", + bucketId = "", + fileId = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/storage/get-file.md b/docs/examples/kotlin/storage/get-file.md index 040559b..a07095d 100644 --- a/docs/examples/kotlin/storage/get-file.md +++ b/docs/examples/kotlin/storage/get-file.md @@ -9,6 +9,6 @@ val client = Client(context) val storage = Storage(client) val result = storage.getFile( - bucketId = "{$example}", - fileId = "{$example}", + bucketId = "", + fileId = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/storage/list-files.md b/docs/examples/kotlin/storage/list-files.md index e7f09a2..640b705 100644 --- a/docs/examples/kotlin/storage/list-files.md +++ b/docs/examples/kotlin/storage/list-files.md @@ -9,7 +9,7 @@ val client = Client(context) val storage = Storage(client) val result = storage.listFiles( - bucketId = "{$example}", + bucketId = "", queries = listOf(), // (optional) - search = "{$example}", // (optional) + search = "", // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/storage/update-file.md b/docs/examples/kotlin/storage/update-file.md index 325fc44..f7a20f0 100644 --- a/docs/examples/kotlin/storage/update-file.md +++ b/docs/examples/kotlin/storage/update-file.md @@ -9,8 +9,8 @@ val client = Client(context) val storage = Storage(client) val result = storage.updateFile( - bucketId = "{$example}", - fileId = "{$example}", - name = "{$example}", // (optional) + bucketId = "", + fileId = "", + name = "", // (optional) permissions = listOf("read("any")"), // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/create-membership.md b/docs/examples/kotlin/teams/create-membership.md index 6b4b6f1..63f3c67 100644 --- a/docs/examples/kotlin/teams/create-membership.md +++ b/docs/examples/kotlin/teams/create-membership.md @@ -9,11 +9,11 @@ val client = Client(context) val teams = Teams(client) val result = teams.createMembership( - teamId = "{$example}", + teamId = "", roles = listOf(), - email = "{$example}", // (optional) - userId = "{$example}", // (optional) - phone = "{$example}", // (optional) - url = "{$example}", // (optional) - name = "{$example}", // (optional) + email = "email@example.com", // (optional) + userId = "", // (optional) + phone = "+12065550100", // (optional) + url = "https://example.com", // (optional) + name = "", // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/create.md b/docs/examples/kotlin/teams/create.md index 93ef2c6..f214a37 100644 --- a/docs/examples/kotlin/teams/create.md +++ b/docs/examples/kotlin/teams/create.md @@ -9,7 +9,7 @@ val client = Client(context) val teams = Teams(client) val result = teams.create( - teamId = "{$example}", - name = "{$example}", + teamId = "", + name = "", roles = listOf(), // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/delete-membership.md b/docs/examples/kotlin/teams/delete-membership.md index 97cf4d5..f3a54b3 100644 --- a/docs/examples/kotlin/teams/delete-membership.md +++ b/docs/examples/kotlin/teams/delete-membership.md @@ -9,6 +9,6 @@ val client = Client(context) val teams = Teams(client) val result = teams.deleteMembership( - teamId = "{$example}", - membershipId = "{$example}", + teamId = "", + membershipId = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/delete.md b/docs/examples/kotlin/teams/delete.md index 9ffc6db..bc8e8d0 100644 --- a/docs/examples/kotlin/teams/delete.md +++ b/docs/examples/kotlin/teams/delete.md @@ -9,5 +9,5 @@ val client = Client(context) val teams = Teams(client) val result = teams.delete( - teamId = "{$example}", + teamId = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/get-membership.md b/docs/examples/kotlin/teams/get-membership.md index 3277431..e5a589e 100644 --- a/docs/examples/kotlin/teams/get-membership.md +++ b/docs/examples/kotlin/teams/get-membership.md @@ -9,6 +9,6 @@ val client = Client(context) val teams = Teams(client) val result = teams.getMembership( - teamId = "{$example}", - membershipId = "{$example}", + teamId = "", + membershipId = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/get-prefs.md b/docs/examples/kotlin/teams/get-prefs.md index 2791cda..af7503a 100644 --- a/docs/examples/kotlin/teams/get-prefs.md +++ b/docs/examples/kotlin/teams/get-prefs.md @@ -9,5 +9,5 @@ val client = Client(context) val teams = Teams(client) val result = teams.getPrefs( - teamId = "{$example}", + teamId = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/get.md b/docs/examples/kotlin/teams/get.md index 9278e43..70759bc 100644 --- a/docs/examples/kotlin/teams/get.md +++ b/docs/examples/kotlin/teams/get.md @@ -9,5 +9,5 @@ val client = Client(context) val teams = Teams(client) val result = teams.get( - teamId = "{$example}", + teamId = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/list-memberships.md b/docs/examples/kotlin/teams/list-memberships.md index 789a810..abb140e 100644 --- a/docs/examples/kotlin/teams/list-memberships.md +++ b/docs/examples/kotlin/teams/list-memberships.md @@ -9,7 +9,7 @@ val client = Client(context) val teams = Teams(client) val result = teams.listMemberships( - teamId = "{$example}", + teamId = "", queries = listOf(), // (optional) - search = "{$example}", // (optional) + search = "", // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/list.md b/docs/examples/kotlin/teams/list.md index 0cffc22..5d80873 100644 --- a/docs/examples/kotlin/teams/list.md +++ b/docs/examples/kotlin/teams/list.md @@ -10,5 +10,5 @@ val teams = Teams(client) val result = teams.list( queries = listOf(), // (optional) - search = "{$example}", // (optional) + search = "", // (optional) ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/update-membership-status.md b/docs/examples/kotlin/teams/update-membership-status.md index d9454eb..9ecf417 100644 --- a/docs/examples/kotlin/teams/update-membership-status.md +++ b/docs/examples/kotlin/teams/update-membership-status.md @@ -9,8 +9,8 @@ val client = Client(context) val teams = Teams(client) val result = teams.updateMembershipStatus( - teamId = "{$example}", - membershipId = "{$example}", - userId = "{$example}", - secret = "{$example}", + teamId = "", + membershipId = "", + userId = "", + secret = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/update-membership.md b/docs/examples/kotlin/teams/update-membership.md index 5fbec70..15b2ac0 100644 --- a/docs/examples/kotlin/teams/update-membership.md +++ b/docs/examples/kotlin/teams/update-membership.md @@ -9,7 +9,7 @@ val client = Client(context) val teams = Teams(client) val result = teams.updateMembership( - teamId = "{$example}", - membershipId = "{$example}", + teamId = "", + membershipId = "", roles = listOf(), ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/update-name.md b/docs/examples/kotlin/teams/update-name.md index aec0dcb..0040737 100644 --- a/docs/examples/kotlin/teams/update-name.md +++ b/docs/examples/kotlin/teams/update-name.md @@ -9,6 +9,6 @@ val client = Client(context) val teams = Teams(client) val result = teams.updateName( - teamId = "{$example}", - name = "{$example}", + teamId = "", + name = "", ) \ No newline at end of file diff --git a/docs/examples/kotlin/teams/update-prefs.md b/docs/examples/kotlin/teams/update-prefs.md index a292333..f70a5eb 100644 --- a/docs/examples/kotlin/teams/update-prefs.md +++ b/docs/examples/kotlin/teams/update-prefs.md @@ -9,6 +9,6 @@ val client = Client(context) val teams = Teams(client) val result = teams.updatePrefs( - teamId = "{$example}", + teamId = "", prefs = mapOf( "a" to "b" ), ) \ No newline at end of file diff --git a/example/src/main/java/io/appwrite/android/ui/accounts/AccountsViewModel.kt b/example/src/main/java/io/appwrite/android/ui/accounts/AccountsViewModel.kt index f53113d..4302327 100644 --- a/example/src/main/java/io/appwrite/android/ui/accounts/AccountsViewModel.kt +++ b/example/src/main/java/io/appwrite/android/ui/accounts/AccountsViewModel.kt @@ -81,8 +81,8 @@ class AccountsViewModel : ViewModel() { account.createOAuth2Session( activity, OAuthProvider.FACEBOOK, - "appwrite-callback-6070749e6acd4://demo.appwrite.io/auth/oauth2/success", - "appwrite-callback-6070749e6acd4://demo.appwrite.io/auth/oauth2/failure" + "appwrite-callback-6070749e6acd4://cloud.appwrite.io/auth/oauth2/success", + "appwrite-callback-6070749e6acd4://cloud.appwrite.io/auth/oauth2/failure" ) } catch (e: Exception) { _error.postValue(Event(e)) diff --git a/library/src/main/java/io/appwrite/Client.kt b/library/src/main/java/io/appwrite/Client.kt index 635a902..93a3e06 100644 --- a/library/src/main/java/io/appwrite/Client.kt +++ b/library/src/main/java/io/appwrite/Client.kt @@ -7,9 +7,8 @@ import io.appwrite.cookies.ListenableCookieJar import io.appwrite.cookies.stores.SharedPreferencesCookieStore import io.appwrite.exceptions.AppwriteException import io.appwrite.extensions.fromJson -import io.appwrite.extensions.fromMultiPart import io.appwrite.extensions.toJson -import io.appwrite.models.Payload +import io.appwrite.models.InputFile import io.appwrite.models.UploadProgress import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -61,7 +60,7 @@ class Client @JvmOverloads constructor( internal lateinit var http: OkHttpClient internal val headers: MutableMap - + val config: MutableMap internal val cookieJar = ListenableCookieJar(CookieManager( @@ -87,11 +86,11 @@ class Client @JvmOverloads constructor( "x-sdk-name" to "Android", "x-sdk-platform" to "client", "x-sdk-language" to "android", - "x-sdk-version" to "6.0.0", + "x-sdk-version" to "6.0.0", "x-appwrite-response-format" to "1.6.0" ) config = mutableMapOf() - + setSelfSigned(selfSigned) } @@ -155,10 +154,10 @@ class Client @JvmOverloads constructor( /** * Set self Signed - * + * * @param status * - * @return this + * @return this */ fun setSelfSigned(status: Boolean): Client { selfSigned = status @@ -207,10 +206,10 @@ class Client @JvmOverloads constructor( /** * Set endpoint and realtime endpoint. - * + * * @param endpoint * - * @return this + * @return this */ fun setEndpoint(endpoint: String): Client { this.endpoint = endpoint @@ -236,11 +235,11 @@ class Client @JvmOverloads constructor( /** * Add Header - * + * * @param key * @param value * - * @return this + * @return this */ fun addHeader(key: String, value: String): Client { headers[key] = value @@ -249,19 +248,19 @@ class Client @JvmOverloads constructor( /** * Send the HTTP request - * + * * @param method * @param path * @param headers * @param params * - * @return [T] + * @return [T] */ @Throws(AppwriteException::class) suspend fun call( - method: String, - path: String, - headers: Map = mapOf(), + method: String, + path: String, + headers: Map = mapOf(), params: Map = mapOf(), responseType: Class, converter: ((Any) -> T)? = null @@ -320,14 +319,6 @@ class Client @JvmOverloads constructor( ) } } - it.value is Payload -> { - val payload = it.value as Payload - if (payload.sourceType == "path") { - builder.addFormDataPart(it.key, payload.filename, File(payload.path).asRequestBody()) - } else { - builder.addFormDataPart(it.key, payload.toString()) - } - } else -> { builder.addFormDataPart(it.key, it.value.toString()) } @@ -370,14 +361,14 @@ class Client @JvmOverloads constructor( onProgress: ((UploadProgress) -> Unit)? = null, ): T { var file: RandomAccessFile? = null - val input = params[paramName] as Payload + val input = params[paramName] as InputFile val size: Long = when(input.sourceType) { "path", "file" -> { file = RandomAccessFile(input.path, "r") file.length() } "bytes" -> { - input.toBinary().size.toLong() + (input.data as ByteArray).size.toLong() } else -> throw UnsupportedOperationException() } @@ -385,7 +376,7 @@ class Client @JvmOverloads constructor( if (size < CHUNK_SIZE) { val data = when(input.sourceType) { "file", "path" -> File(input.path).asRequestBody() - "bytes" -> input.toBinary().toRequestBody(input.mimeType?.toMediaType()) + "bytes" -> (input.data as ByteArray).toRequestBody(input.mimeType.toMediaType()) else -> throw UnsupportedOperationException() } params[paramName] = MultipartBody.Part.createFormData( @@ -432,7 +423,7 @@ class Client @JvmOverloads constructor( } else { size - 1 } - input.toBinary().copyInto( + (input.data as ByteArray).copyInto( buffer, startIndex = offset.toInt(), endIndex = end.toInt() @@ -504,14 +495,14 @@ class Client @JvmOverloads constructor( .charStream() .buffered() .use(BufferedReader::readText) - + val error = if (response.headers["content-type"]?.contains("application/json") == true) { val map = body.fromJson>() AppwriteException( - map["message"] as? String ?: "", + map["message"] as? String ?: "", (map["code"] as Number).toInt(), - map["type"] as? String ?: "", + map["type"] as? String ?: "", body ) } else { @@ -546,14 +537,6 @@ class Client @JvmOverloads constructor( return } } - if (response.headers["content-type"]?.contains("multipart/form-data") == true) { - val binaryBody = response.body!!.bytes() - val body = String(binaryBody) - val map = body.fromMultiPart(binaryBody) - it.resume(converter?.invoke(map) ?: map as T) - return - } - val body = response.body!! .charStream() .buffered() @@ -571,4 +554,4 @@ class Client @JvmOverloads constructor( } }) } -} +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/extensions/TypeExtensions.kt b/library/src/main/java/io/appwrite/extensions/TypeExtensions.kt index ad26379..e699a54 100644 --- a/library/src/main/java/io/appwrite/extensions/TypeExtensions.kt +++ b/library/src/main/java/io/appwrite/extensions/TypeExtensions.kt @@ -1,104 +1,9 @@ package io.appwrite.extensions -import io.appwrite.models.Payload import kotlin.reflect.KClass import kotlin.reflect.typeOf inline fun classOf(): Class { - @Suppress("UNCHECKED_CAST") return (typeOf().classifier!! as KClass).java -} - -fun String.fromMultiPart(binaryBody: ByteArray): Map { - val match = Regex("(-+\\w+)--").find(this) ?: return emptyMap() - // For kotlin - - val boundary = match.groupValues[1] - - var map = - mutableMapOf( - "\$id" to "", - "\$createdAt" to "", - "\$updatedAt" to "", - "\$permissions" to emptyList(), - "functionId" to "", - "trigger" to "", - "status" to "", - "requestMethod" to "", - "requestPath" to "", - "requestHeaders" to emptyList>(), - "responseStatusCode" to 0, - "responseBody" to Payload.fromBinary(ByteArray(0)), - "responseHeaders" to emptyList>(), - "logs" to "", - "errors" to "", - "duration" to 0.0, - "scheduledAt" to "", - ) - val parts = this.split(boundary) - for (part in parts) { - var lines = part.split("\r\n") - - val name = Regex("name=\"?(\\w+)").find(part) ?: continue - - lines = - lines - .dropWhile { it.isEmpty() } - .drop(1) - .dropWhile { it.isEmpty() } - .dropLastWhile { it.isEmpty() } - val key = name.groupValues[1] - - if (lines.isEmpty()) { - continue - } - - if (key == "responseBody") { - val needle = "name=\"responseBody\"\r\n\r\n" - val indexOf = this.indexOf(needle) + needle.length - val endBytes = "\r\n-------".toByteArray() - val list = ByteArray(binaryBody.size - indexOf) - val multipart = binaryBody.drop(indexOf) - var weHitTheEnd = false - var j = 0 - for (i in multipart) { - if (multipart.size > j + endBytes.size) { - var jj = 0 - for (byte in endBytes) { - if (byte != multipart[j + jj]) break - jj++ - if (jj != endBytes.size - 1) continue - weHitTheEnd = true - } - } - if (weHitTheEnd) { - break - } - - list[j] = multipart[j] - j++ - } - - map["responseBody"] = - Payload.fromBinary(list.dropLastWhile { it == 0.toByte() }.toByteArray()) - continue - } - - if (lines[0] == "Content-Type: application/json") { - lines = lines.drop(1).dropWhile { it.isEmpty() } - val list = lines.joinToString("\r\n").fromJson>() - map[key] = list - continue - } - - val value = lines.joinToString("\r\n") - - map[key] = - when (key) { - "responseStatusCode" -> value.toInt() - "duration" -> value.toFloat() - else -> value - } - } - - return map -} + @Suppress("UNCHECKED_CAST") + return (typeOf().classifier!! as KClass).java +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/Document.kt b/library/src/main/java/io/appwrite/models/Document.kt index 5a7d371..01204de 100644 --- a/library/src/main/java/io/appwrite/models/Document.kt +++ b/library/src/main/java/io/appwrite/models/Document.kt @@ -41,7 +41,7 @@ data class Document( * Document permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). */ @SerializedName("\$permissions") - val permissions: List, + val permissions: List, /** * Additional properties @@ -66,7 +66,7 @@ data class Document( databaseId: String, createdAt: String, updatedAt: String, - permissions: List, + permissions: List, data: Map ) = Document>( id, @@ -88,7 +88,7 @@ data class Document( databaseId = map["\$databaseId"] as String, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, - permissions = map["\$permissions"] as List, + permissions = map["\$permissions"] as List, data = map.jsonCast(to = nestedType) ) } diff --git a/library/src/main/java/io/appwrite/models/Execution.kt b/library/src/main/java/io/appwrite/models/Execution.kt index c16659a..1b6226a 100644 --- a/library/src/main/java/io/appwrite/models/Execution.kt +++ b/library/src/main/java/io/appwrite/models/Execution.kt @@ -29,7 +29,7 @@ data class Execution( * Execution roles. */ @SerializedName("\$permissions") - val permissions: List, + val permissions: List, /** * Function ID. @@ -77,7 +77,7 @@ data class Execution( * HTTP response body. This will return empty unless execution is created as synchronous. */ @SerializedName("responseBody") - val responseBody: Payload, + val responseBody: String, /** * HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. @@ -139,7 +139,7 @@ data class Execution( id = map["\$id"] as String, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, - permissions = map["\$permissions"] as List, + permissions = map["\$permissions"] as List, functionId = map["functionId"] as String, trigger = map["trigger"] as String, status = map["status"] as String, @@ -147,7 +147,7 @@ data class Execution( requestPath = map["requestPath"] as String, requestHeaders = (map["requestHeaders"] as List>).map { Headers.from(map = it) }, responseStatusCode = (map["responseStatusCode"] as Number).toLong(), - responseBody = map["responseBody"] as Payload, + responseBody = map["responseBody"] as String, responseHeaders = (map["responseHeaders"] as List>).map { Headers.from(map = it) }, logs = map["logs"] as String, errors = map["errors"] as String, diff --git a/library/src/main/java/io/appwrite/models/File.kt b/library/src/main/java/io/appwrite/models/File.kt index 5c2b731..897fc4a 100644 --- a/library/src/main/java/io/appwrite/models/File.kt +++ b/library/src/main/java/io/appwrite/models/File.kt @@ -35,7 +35,7 @@ data class File( * File permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). */ @SerializedName("\$permissions") - val permissions: List, + val permissions: List, /** * File name. @@ -98,7 +98,7 @@ data class File( bucketId = map["bucketId"] as String, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, - permissions = map["\$permissions"] as List, + permissions = map["\$permissions"] as List, name = map["name"] as String, signature = map["signature"] as String, mimeType = map["mimeType"] as String, diff --git a/library/src/main/java/io/appwrite/models/InputFile.kt b/library/src/main/java/io/appwrite/models/InputFile.kt new file mode 100644 index 0000000..afbb2e9 --- /dev/null +++ b/library/src/main/java/io/appwrite/models/InputFile.kt @@ -0,0 +1,37 @@ +package io.appwrite.models + +import java.io.File +import java.net.URLConnection +import java.nio.file.Files +import java.nio.file.Paths + +class InputFile private constructor() { + + lateinit var path: String + lateinit var filename: String + lateinit var mimeType: String + lateinit var sourceType: String + lateinit var data: Any + + companion object { + fun fromFile(file: File) = InputFile().apply { + path = file.canonicalPath + filename = file.name + mimeType = Files.probeContentType(Paths.get(file.canonicalPath)) + ?: URLConnection.guessContentTypeFromName(filename) + ?: "" + sourceType = "file" + } + + fun fromPath(path: String): InputFile = fromFile(File(path)).apply { + sourceType = "path" + } + + fun fromBytes(bytes: ByteArray, filename: String = "", mimeType: String = "") = InputFile().apply { + this.filename = filename + this.mimeType = mimeType + data = bytes + sourceType = "bytes" + } + } +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/Membership.kt b/library/src/main/java/io/appwrite/models/Membership.kt index 17ab303..1f20394 100644 --- a/library/src/main/java/io/appwrite/models/Membership.kt +++ b/library/src/main/java/io/appwrite/models/Membership.kt @@ -83,7 +83,7 @@ data class Membership( * User list of roles */ @SerializedName("roles") - val roles: List, + val roles: List, ) { fun toMap(): Map = mapOf( @@ -120,7 +120,7 @@ data class Membership( joined = map["joined"] as String, confirm = map["confirm"] as Boolean, mfa = map["mfa"] as Boolean, - roles = map["roles"] as List, + roles = map["roles"] as List, ) } } \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/MfaRecoveryCodes.kt b/library/src/main/java/io/appwrite/models/MfaRecoveryCodes.kt index ad8bc45..3fab41a 100644 --- a/library/src/main/java/io/appwrite/models/MfaRecoveryCodes.kt +++ b/library/src/main/java/io/appwrite/models/MfaRecoveryCodes.kt @@ -11,7 +11,7 @@ data class MfaRecoveryCodes( * Recovery codes. */ @SerializedName("recoveryCodes") - val recoveryCodes: List, + val recoveryCodes: List, ) { fun toMap(): Map = mapOf( @@ -24,7 +24,7 @@ data class MfaRecoveryCodes( fun from( map: Map, ) = MfaRecoveryCodes( - recoveryCodes = map["recoveryCodes"] as List, + recoveryCodes = map["recoveryCodes"] as List, ) } } \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/Payload.kt b/library/src/main/java/io/appwrite/models/Payload.kt deleted file mode 100644 index 5c9ff7f..0000000 --- a/library/src/main/java/io/appwrite/models/Payload.kt +++ /dev/null @@ -1,73 +0,0 @@ -package io.appwrite.models - -import io.appwrite.extensions.gson -import java.io.File -import java.net.URLConnection -import java.nio.file.Files -import java.nio.file.Paths - -class Payload private constructor() { - - lateinit var path: String - lateinit var filename: String - lateinit var sourceType: String - lateinit var data: Any - var mimeType: String? = null - - override fun toString(): String { - if (sourceType != "bytes") { - throw IllegalArgumentException("source type is not supported: $sourceType") - } - - return String(data as ByteArray) - } - - fun toBinary(): ByteArray { - if (sourceType != "bytes") { - throw IllegalArgumentException("source type is not supported: $sourceType") - } - - return data as ByteArray - } - - fun toJson(): MutableMap { - if (sourceType != "bytes") { - throw IllegalArgumentException("source type is not supported: $sourceType") - } - - return gson.fromJson(toString(), MutableMap::class.java) as MutableMap - } - - fun toFile(path: String): File { - Files.createDirectories(Paths.get(path).parent); - - val file = File(path) - file.appendBytes(toBinary()) - return file - } - - companion object { - fun fromFile(path: String,filename: String = ""): Payload = fromFileObject(File(path), filename).apply { - sourceType = "path" - } - - fun fromBinary(bytes: ByteArray, filename: String = "") = Payload().apply { - this.filename = filename - data = bytes - sourceType = "bytes" - } - - fun fromString(string: String) = fromBinary(string.toByteArray()) - - fun fromJson(data: Any) = fromString(gson.toJson(data)) - - fun fromFileObject(file: File, name: String = "") = Payload().apply { - path = file.canonicalPath - filename = if (name != "") name else file.name - mimeType = Files.probeContentType(Paths.get(file.canonicalPath)) - ?: URLConnection.guessContentTypeFromName(filename) - ?: "" - sourceType = "file" - } - } -} diff --git a/library/src/main/java/io/appwrite/models/Session.kt b/library/src/main/java/io/appwrite/models/Session.kt index 1c6a7b2..02dbb28 100644 --- a/library/src/main/java/io/appwrite/models/Session.kt +++ b/library/src/main/java/io/appwrite/models/Session.kt @@ -167,7 +167,7 @@ data class Session( * Returns a list of active session factors. */ @SerializedName("factors") - val factors: List, + val factors: List, /** * Secret used to authenticate the user. Only included if the request was made with an API key @@ -246,7 +246,7 @@ data class Session( countryCode = map["countryCode"] as String, countryName = map["countryName"] as String, current = map["current"] as Boolean, - factors = map["factors"] as List, + factors = map["factors"] as List, secret = map["secret"] as String, mfaUpdatedAt = map["mfaUpdatedAt"] as String, ) diff --git a/library/src/main/java/io/appwrite/models/User.kt b/library/src/main/java/io/appwrite/models/User.kt index 095467a..fd03fc2 100644 --- a/library/src/main/java/io/appwrite/models/User.kt +++ b/library/src/main/java/io/appwrite/models/User.kt @@ -65,7 +65,7 @@ data class User( * Labels for the user. */ @SerializedName("labels") - val labels: List, + val labels: List, /** * Password update time in ISO 8601 format. @@ -155,7 +155,7 @@ data class User( hashOptions: Any?, registration: String, status: Boolean, - labels: List, + labels: List, passwordUpdate: String, email: String, phone: String, @@ -201,7 +201,7 @@ data class User( hashOptions = map["hashOptions"] as? Any?, registration = map["registration"] as String, status = map["status"] as Boolean, - labels = map["labels"] as List, + labels = map["labels"] as List, passwordUpdate = map["passwordUpdate"] as String, email = map["email"] as String, phone = map["phone"] as String, diff --git a/library/src/main/java/io/appwrite/services/Account.kt b/library/src/main/java/io/appwrite/services/Account.kt index 25c71e3..6f4cbd8 100644 --- a/library/src/main/java/io/appwrite/services/Account.kt +++ b/library/src/main/java/io/appwrite/services/Account.kt @@ -28,19 +28,19 @@ class Account(client: Client) : Service(client) { */ suspend fun get( nestedType: Class, - ): io.appwrite.models.User { + ): io.appwrite.models.User { val apiPath = "/account" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.User = { @Suppress("UNCHECKED_CAST") io.appwrite.models.User.from(map = it as Map, nestedType) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -59,9 +59,9 @@ class Account(client: Client) : Service(client) { */ @Throws(AppwriteException::class) suspend fun get( - ): io.appwrite.models.User> = get( + ): io.appwrite.models.User> = get( nestedType = classOf(), - ) + ) /** * Create account @@ -81,23 +81,23 @@ class Account(client: Client) : Service(client) { password: String, name: String? = null, nestedType: Class, - ): io.appwrite.models.User { + ): io.appwrite.models.User { val apiPath = "/account" val apiParams = mutableMapOf( - "userId" to userId, - "email" to email, - "password" to password, - "name" to name, + "userId" to userId, + "email" to email, + "password" to password, + "name" to name, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.User = { @Suppress("UNCHECKED_CAST") io.appwrite.models.User.from(map = it as Map, nestedType) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -125,13 +125,13 @@ class Account(client: Client) : Service(client) { email: String, password: String, name: String? = null, - ): io.appwrite.models.User> = create( + ): io.appwrite.models.User> = create( userId, email, password, name, nestedType = classOf(), - ) + ) /** * Update email @@ -146,21 +146,21 @@ class Account(client: Client) : Service(client) { email: String, password: String, nestedType: Class, - ): io.appwrite.models.User { + ): io.appwrite.models.User { val apiPath = "/account/email" val apiParams = mutableMapOf( - "email" to email, - "password" to password, + "email" to email, + "password" to password, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.User = { @Suppress("UNCHECKED_CAST") io.appwrite.models.User.from(map = it as Map, nestedType) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -183,11 +183,11 @@ class Account(client: Client) : Service(client) { suspend fun updateEmail( email: String, password: String, - ): io.appwrite.models.User> = updateEmail( + ): io.appwrite.models.User> = updateEmail( email, password, nestedType = classOf(), - ) + ) /** * List identities @@ -200,20 +200,20 @@ class Account(client: Client) : Service(client) { @JvmOverloads suspend fun listIdentities( queries: List? = null, - ): io.appwrite.models.IdentityList { + ): io.appwrite.models.IdentityList { val apiPath = "/account/identities" val apiParams = mutableMapOf( - "queries" to queries, + "queries" to queries, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.IdentityList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.IdentityList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -234,16 +234,16 @@ class Account(client: Client) : Service(client) { */ suspend fun deleteIdentity( identityId: String, - ): Any { + ): Any { val apiPath = "/account/identities/{identityId}" .replace("{identityId}", identityId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - return client.call( + return client.call( "DELETE", apiPath, apiHeaders, @@ -261,19 +261,19 @@ class Account(client: Client) : Service(client) { * @return [io.appwrite.models.Jwt] */ suspend fun createJWT( - ): io.appwrite.models.Jwt { + ): io.appwrite.models.Jwt { val apiPath = "/account/jwts" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Jwt = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Jwt.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -295,20 +295,20 @@ class Account(client: Client) : Service(client) { @JvmOverloads suspend fun listLogs( queries: List? = null, - ): io.appwrite.models.LogList { + ): io.appwrite.models.LogList { val apiPath = "/account/logs" val apiParams = mutableMapOf( - "queries" to queries, + "queries" to queries, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.LogList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.LogList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -330,20 +330,20 @@ class Account(client: Client) : Service(client) { suspend fun updateMFA( mfa: Boolean, nestedType: Class, - ): io.appwrite.models.User { + ): io.appwrite.models.User { val apiPath = "/account/mfa" val apiParams = mutableMapOf( - "mfa" to mfa, + "mfa" to mfa, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.User = { @Suppress("UNCHECKED_CAST") io.appwrite.models.User.from(map = it as Map, nestedType) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -364,10 +364,10 @@ class Account(client: Client) : Service(client) { @Throws(AppwriteException::class) suspend fun updateMFA( mfa: Boolean, - ): io.appwrite.models.User> = updateMFA( + ): io.appwrite.models.User> = updateMFA( mfa, nestedType = classOf(), - ) + ) /** * Create authenticator @@ -379,20 +379,20 @@ class Account(client: Client) : Service(client) { */ suspend fun createMfaAuthenticator( type: io.appwrite.enums.AuthenticatorType, - ): io.appwrite.models.MfaType { + ): io.appwrite.models.MfaType { val apiPath = "/account/mfa/authenticators/{type}" .replace("{type}", type.value) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.MfaType = { @Suppress("UNCHECKED_CAST") io.appwrite.models.MfaType.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -416,21 +416,21 @@ class Account(client: Client) : Service(client) { type: io.appwrite.enums.AuthenticatorType, otp: String, nestedType: Class, - ): io.appwrite.models.User { + ): io.appwrite.models.User { val apiPath = "/account/mfa/authenticators/{type}" .replace("{type}", type.value) val apiParams = mutableMapOf( - "otp" to otp, + "otp" to otp, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.User = { @Suppress("UNCHECKED_CAST") io.appwrite.models.User.from(map = it as Map, nestedType) } - return client.call( + return client.call( "PUT", apiPath, apiHeaders, @@ -453,11 +453,11 @@ class Account(client: Client) : Service(client) { suspend fun updateMfaAuthenticator( type: io.appwrite.enums.AuthenticatorType, otp: String, - ): io.appwrite.models.User> = updateMfaAuthenticator( + ): io.appwrite.models.User> = updateMfaAuthenticator( type, otp, nestedType = classOf(), - ) + ) /** * Delete authenticator @@ -469,16 +469,16 @@ class Account(client: Client) : Service(client) { */ suspend fun deleteMfaAuthenticator( type: io.appwrite.enums.AuthenticatorType, - ): Any { + ): Any { val apiPath = "/account/mfa/authenticators/{type}" .replace("{type}", type.value) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - return client.call( + return client.call( "DELETE", apiPath, apiHeaders, @@ -498,20 +498,20 @@ class Account(client: Client) : Service(client) { */ suspend fun createMfaChallenge( factor: io.appwrite.enums.AuthenticationFactor, - ): io.appwrite.models.MfaChallenge { + ): io.appwrite.models.MfaChallenge { val apiPath = "/account/mfa/challenge" val apiParams = mutableMapOf( - "factor" to factor, + "factor" to factor, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.MfaChallenge = { @Suppress("UNCHECKED_CAST") io.appwrite.models.MfaChallenge.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -534,17 +534,17 @@ class Account(client: Client) : Service(client) { suspend fun updateMfaChallenge( challengeId: String, otp: String, - ): Any { + ): Any { val apiPath = "/account/mfa/challenge" val apiParams = mutableMapOf( - "challengeId" to challengeId, - "otp" to otp, + "challengeId" to challengeId, + "otp" to otp, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - return client.call( + return client.call( "PUT", apiPath, apiHeaders, @@ -562,19 +562,19 @@ class Account(client: Client) : Service(client) { * @return [io.appwrite.models.MfaFactors] */ suspend fun listMfaFactors( - ): io.appwrite.models.MfaFactors { + ): io.appwrite.models.MfaFactors { val apiPath = "/account/mfa/factors" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.MfaFactors = { @Suppress("UNCHECKED_CAST") io.appwrite.models.MfaFactors.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -593,19 +593,19 @@ class Account(client: Client) : Service(client) { * @return [io.appwrite.models.MfaRecoveryCodes] */ suspend fun getMfaRecoveryCodes( - ): io.appwrite.models.MfaRecoveryCodes { + ): io.appwrite.models.MfaRecoveryCodes { val apiPath = "/account/mfa/recovery-codes" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.MfaRecoveryCodes = { @Suppress("UNCHECKED_CAST") io.appwrite.models.MfaRecoveryCodes.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -624,19 +624,19 @@ class Account(client: Client) : Service(client) { * @return [io.appwrite.models.MfaRecoveryCodes] */ suspend fun createMfaRecoveryCodes( - ): io.appwrite.models.MfaRecoveryCodes { + ): io.appwrite.models.MfaRecoveryCodes { val apiPath = "/account/mfa/recovery-codes" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.MfaRecoveryCodes = { @Suppress("UNCHECKED_CAST") io.appwrite.models.MfaRecoveryCodes.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -655,19 +655,19 @@ class Account(client: Client) : Service(client) { * @return [io.appwrite.models.MfaRecoveryCodes] */ suspend fun updateMfaRecoveryCodes( - ): io.appwrite.models.MfaRecoveryCodes { + ): io.appwrite.models.MfaRecoveryCodes { val apiPath = "/account/mfa/recovery-codes" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.MfaRecoveryCodes = { @Suppress("UNCHECKED_CAST") io.appwrite.models.MfaRecoveryCodes.from(map = it as Map) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -689,20 +689,20 @@ class Account(client: Client) : Service(client) { suspend fun updateName( name: String, nestedType: Class, - ): io.appwrite.models.User { + ): io.appwrite.models.User { val apiPath = "/account/name" val apiParams = mutableMapOf( - "name" to name, + "name" to name, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.User = { @Suppress("UNCHECKED_CAST") io.appwrite.models.User.from(map = it as Map, nestedType) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -723,10 +723,10 @@ class Account(client: Client) : Service(client) { @Throws(AppwriteException::class) suspend fun updateName( name: String, - ): io.appwrite.models.User> = updateName( + ): io.appwrite.models.User> = updateName( name, nestedType = classOf(), - ) + ) /** * Update password @@ -742,21 +742,21 @@ class Account(client: Client) : Service(client) { password: String, oldPassword: String? = null, nestedType: Class, - ): io.appwrite.models.User { + ): io.appwrite.models.User { val apiPath = "/account/password" val apiParams = mutableMapOf( - "password" to password, - "oldPassword" to oldPassword, + "password" to password, + "oldPassword" to oldPassword, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.User = { @Suppress("UNCHECKED_CAST") io.appwrite.models.User.from(map = it as Map, nestedType) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -780,11 +780,11 @@ class Account(client: Client) : Service(client) { suspend fun updatePassword( password: String, oldPassword: String? = null, - ): io.appwrite.models.User> = updatePassword( + ): io.appwrite.models.User> = updatePassword( password, oldPassword, nestedType = classOf(), - ) + ) /** * Update phone @@ -799,21 +799,21 @@ class Account(client: Client) : Service(client) { phone: String, password: String, nestedType: Class, - ): io.appwrite.models.User { + ): io.appwrite.models.User { val apiPath = "/account/phone" val apiParams = mutableMapOf( - "phone" to phone, - "password" to password, + "phone" to phone, + "password" to password, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.User = { @Suppress("UNCHECKED_CAST") io.appwrite.models.User.from(map = it as Map, nestedType) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -836,11 +836,11 @@ class Account(client: Client) : Service(client) { suspend fun updatePhone( phone: String, password: String, - ): io.appwrite.models.User> = updatePhone( + ): io.appwrite.models.User> = updatePhone( phone, password, nestedType = classOf(), - ) + ) /** * Get account preferences @@ -851,19 +851,19 @@ class Account(client: Client) : Service(client) { */ suspend fun getPrefs( nestedType: Class, - ): io.appwrite.models.Preferences { + ): io.appwrite.models.Preferences { val apiPath = "/account/prefs" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Preferences = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Preferences.from(map = it as Map, nestedType) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -882,9 +882,9 @@ class Account(client: Client) : Service(client) { */ @Throws(AppwriteException::class) suspend fun getPrefs( - ): io.appwrite.models.Preferences> = getPrefs( + ): io.appwrite.models.Preferences> = getPrefs( nestedType = classOf(), - ) + ) /** * Update preferences @@ -897,20 +897,20 @@ class Account(client: Client) : Service(client) { suspend fun updatePrefs( prefs: Any, nestedType: Class, - ): io.appwrite.models.User { + ): io.appwrite.models.User { val apiPath = "/account/prefs" val apiParams = mutableMapOf( - "prefs" to prefs, + "prefs" to prefs, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.User = { @Suppress("UNCHECKED_CAST") io.appwrite.models.User.from(map = it as Map, nestedType) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -931,10 +931,10 @@ class Account(client: Client) : Service(client) { @Throws(AppwriteException::class) suspend fun updatePrefs( prefs: Any, - ): io.appwrite.models.User> = updatePrefs( + ): io.appwrite.models.User> = updatePrefs( prefs, nestedType = classOf(), - ) + ) /** * Create password recovery @@ -948,21 +948,21 @@ class Account(client: Client) : Service(client) { suspend fun createRecovery( email: String, url: String, - ): io.appwrite.models.Token { + ): io.appwrite.models.Token { val apiPath = "/account/recovery" val apiParams = mutableMapOf( - "email" to email, - "url" to url, + "email" to email, + "url" to url, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Token = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Token.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -987,22 +987,22 @@ class Account(client: Client) : Service(client) { userId: String, secret: String, password: String, - ): io.appwrite.models.Token { + ): io.appwrite.models.Token { val apiPath = "/account/recovery" val apiParams = mutableMapOf( - "userId" to userId, - "secret" to secret, - "password" to password, + "userId" to userId, + "secret" to secret, + "password" to password, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Token = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Token.from(map = it as Map) } - return client.call( + return client.call( "PUT", apiPath, apiHeaders, @@ -1021,19 +1021,19 @@ class Account(client: Client) : Service(client) { * @return [io.appwrite.models.SessionList] */ suspend fun listSessions( - ): io.appwrite.models.SessionList { + ): io.appwrite.models.SessionList { val apiPath = "/account/sessions" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.SessionList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.SessionList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -1052,15 +1052,15 @@ class Account(client: Client) : Service(client) { * @return [Any] */ suspend fun deleteSessions( - ): Any { + ): Any { val apiPath = "/account/sessions" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - return client.call( + return client.call( "DELETE", apiPath, apiHeaders, @@ -1078,19 +1078,19 @@ class Account(client: Client) : Service(client) { * @return [io.appwrite.models.Session] */ suspend fun createAnonymousSession( - ): io.appwrite.models.Session { + ): io.appwrite.models.Session { val apiPath = "/account/sessions/anonymous" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Session = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Session.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -1113,21 +1113,21 @@ class Account(client: Client) : Service(client) { suspend fun createEmailPasswordSession( email: String, password: String, - ): io.appwrite.models.Session { + ): io.appwrite.models.Session { val apiPath = "/account/sessions/email" val apiParams = mutableMapOf( - "email" to email, - "password" to password, + "email" to email, + "password" to password, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Session = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Session.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -1150,21 +1150,21 @@ class Account(client: Client) : Service(client) { suspend fun updateMagicURLSession( userId: String, secret: String, - ): io.appwrite.models.Session { + ): io.appwrite.models.Session { val apiPath = "/account/sessions/magic-url" val apiParams = mutableMapOf( - "userId" to userId, - "secret" to secret, + "userId" to userId, + "secret" to secret, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Session = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Session.from(map = it as Map) } - return client.call( + return client.call( "PUT", apiPath, apiHeaders, @@ -1192,14 +1192,14 @@ class Account(client: Client) : Service(client) { success: String? = null, failure: String? = null, scopes: List? = null, - ) { + ) { val apiPath = "/account/sessions/oauth2/{provider}" .replace("{provider}", provider.value) val apiParams = mutableMapOf( - "success" to success, - "failure" to failure, - "scopes" to scopes, + "success" to success, + "failure" to failure, + "scopes" to scopes, "project" to client.config["project"], ) val apiQuery = mutableListOf() @@ -1240,7 +1240,7 @@ class Account(client: Client) : Service(client) { .domain(Uri.parse(client.endpoint).host!!) .httpOnly() .build() - + client.http.cookieJar.saveFromResponse( client.endpoint.toHttpUrl(), listOf(cookie) @@ -1261,21 +1261,21 @@ class Account(client: Client) : Service(client) { suspend fun updatePhoneSession( userId: String, secret: String, - ): io.appwrite.models.Session { + ): io.appwrite.models.Session { val apiPath = "/account/sessions/phone" val apiParams = mutableMapOf( - "userId" to userId, - "secret" to secret, + "userId" to userId, + "secret" to secret, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Session = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Session.from(map = it as Map) } - return client.call( + return client.call( "PUT", apiPath, apiHeaders, @@ -1298,21 +1298,21 @@ class Account(client: Client) : Service(client) { suspend fun createSession( userId: String, secret: String, - ): io.appwrite.models.Session { + ): io.appwrite.models.Session { val apiPath = "/account/sessions/token" val apiParams = mutableMapOf( - "userId" to userId, - "secret" to secret, + "userId" to userId, + "secret" to secret, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Session = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Session.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -1333,20 +1333,20 @@ class Account(client: Client) : Service(client) { */ suspend fun getSession( sessionId: String, - ): io.appwrite.models.Session { + ): io.appwrite.models.Session { val apiPath = "/account/sessions/{sessionId}" .replace("{sessionId}", sessionId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Session = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Session.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -1367,20 +1367,20 @@ class Account(client: Client) : Service(client) { */ suspend fun updateSession( sessionId: String, - ): io.appwrite.models.Session { + ): io.appwrite.models.Session { val apiPath = "/account/sessions/{sessionId}" .replace("{sessionId}", sessionId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Session = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Session.from(map = it as Map) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -1401,16 +1401,16 @@ class Account(client: Client) : Service(client) { */ suspend fun deleteSession( sessionId: String, - ): Any { + ): Any { val apiPath = "/account/sessions/{sessionId}" .replace("{sessionId}", sessionId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - return client.call( + return client.call( "DELETE", apiPath, apiHeaders, @@ -1429,19 +1429,19 @@ class Account(client: Client) : Service(client) { */ suspend fun updateStatus( nestedType: Class, - ): io.appwrite.models.User { + ): io.appwrite.models.User { val apiPath = "/account/status" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.User = { @Suppress("UNCHECKED_CAST") io.appwrite.models.User.from(map = it as Map, nestedType) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -1460,9 +1460,9 @@ class Account(client: Client) : Service(client) { */ @Throws(AppwriteException::class) suspend fun updateStatus( - ): io.appwrite.models.User> = updateStatus( + ): io.appwrite.models.User> = updateStatus( nestedType = classOf(), - ) + ) /** * Create push target @@ -1479,22 +1479,22 @@ class Account(client: Client) : Service(client) { targetId: String, identifier: String, providerId: String? = null, - ): io.appwrite.models.Target { + ): io.appwrite.models.Target { val apiPath = "/account/targets/push" val apiParams = mutableMapOf( - "targetId" to targetId, - "identifier" to identifier, - "providerId" to providerId, + "targetId" to targetId, + "identifier" to identifier, + "providerId" to providerId, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Target = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Target.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -1517,21 +1517,21 @@ class Account(client: Client) : Service(client) { suspend fun updatePushTarget( targetId: String, identifier: String, - ): io.appwrite.models.Target { + ): io.appwrite.models.Target { val apiPath = "/account/targets/{targetId}/push" .replace("{targetId}", targetId) val apiParams = mutableMapOf( - "identifier" to identifier, + "identifier" to identifier, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Target = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Target.from(map = it as Map) } - return client.call( + return client.call( "PUT", apiPath, apiHeaders, @@ -1552,16 +1552,16 @@ class Account(client: Client) : Service(client) { */ suspend fun deletePushTarget( targetId: String, - ): Any { + ): Any { val apiPath = "/account/targets/{targetId}/push" .replace("{targetId}", targetId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - return client.call( + return client.call( "DELETE", apiPath, apiHeaders, @@ -1586,22 +1586,22 @@ class Account(client: Client) : Service(client) { userId: String, email: String, phrase: Boolean? = null, - ): io.appwrite.models.Token { + ): io.appwrite.models.Token { val apiPath = "/account/tokens/email" val apiParams = mutableMapOf( - "userId" to userId, - "email" to email, - "phrase" to phrase, + "userId" to userId, + "email" to email, + "phrase" to phrase, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Token = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Token.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -1629,23 +1629,23 @@ class Account(client: Client) : Service(client) { email: String, url: String? = null, phrase: Boolean? = null, - ): io.appwrite.models.Token { + ): io.appwrite.models.Token { val apiPath = "/account/tokens/magic-url" val apiParams = mutableMapOf( - "userId" to userId, - "email" to email, - "url" to url, - "phrase" to phrase, + "userId" to userId, + "email" to email, + "url" to url, + "phrase" to phrase, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Token = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Token.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -1673,14 +1673,14 @@ class Account(client: Client) : Service(client) { success: String? = null, failure: String? = null, scopes: List? = null, - ) { + ) { val apiPath = "/account/tokens/oauth2/{provider}" .replace("{provider}", provider.value) val apiParams = mutableMapOf( - "success" to success, - "failure" to failure, - "scopes" to scopes, + "success" to success, + "failure" to failure, + "scopes" to scopes, "project" to client.config["project"], ) val apiQuery = mutableListOf() @@ -1721,7 +1721,7 @@ class Account(client: Client) : Service(client) { .domain(Uri.parse(client.endpoint).host!!) .httpOnly() .build() - + client.http.cookieJar.saveFromResponse( client.endpoint.toHttpUrl(), listOf(cookie) @@ -1742,21 +1742,21 @@ class Account(client: Client) : Service(client) { suspend fun createPhoneToken( userId: String, phone: String, - ): io.appwrite.models.Token { + ): io.appwrite.models.Token { val apiPath = "/account/tokens/phone" val apiParams = mutableMapOf( - "userId" to userId, - "phone" to phone, + "userId" to userId, + "phone" to phone, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Token = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Token.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -1777,20 +1777,20 @@ class Account(client: Client) : Service(client) { */ suspend fun createVerification( url: String, - ): io.appwrite.models.Token { + ): io.appwrite.models.Token { val apiPath = "/account/verification" val apiParams = mutableMapOf( - "url" to url, + "url" to url, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Token = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Token.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -1813,21 +1813,21 @@ class Account(client: Client) : Service(client) { suspend fun updateVerification( userId: String, secret: String, - ): io.appwrite.models.Token { + ): io.appwrite.models.Token { val apiPath = "/account/verification" val apiParams = mutableMapOf( - "userId" to userId, - "secret" to secret, + "userId" to userId, + "secret" to secret, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Token = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Token.from(map = it as Map) } - return client.call( + return client.call( "PUT", apiPath, apiHeaders, @@ -1846,19 +1846,19 @@ class Account(client: Client) : Service(client) { * @return [io.appwrite.models.Token] */ suspend fun createPhoneVerification( - ): io.appwrite.models.Token { + ): io.appwrite.models.Token { val apiPath = "/account/verification/phone" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Token = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Token.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -1881,21 +1881,21 @@ class Account(client: Client) : Service(client) { suspend fun updatePhoneVerification( userId: String, secret: String, - ): io.appwrite.models.Token { + ): io.appwrite.models.Token { val apiPath = "/account/verification/phone" val apiParams = mutableMapOf( - "userId" to userId, - "secret" to secret, + "userId" to userId, + "secret" to secret, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Token = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Token.from(map = it as Map) } - return client.call( + return client.call( "PUT", apiPath, apiHeaders, @@ -1906,4 +1906,4 @@ class Account(client: Client) : Service(client) { } -} +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/services/Avatars.kt b/library/src/main/java/io/appwrite/services/Avatars.kt index fb926f0..9913edc 100644 --- a/library/src/main/java/io/appwrite/services/Avatars.kt +++ b/library/src/main/java/io/appwrite/services/Avatars.kt @@ -34,14 +34,14 @@ class Avatars(client: Client) : Service(client) { width: Long? = null, height: Long? = null, quality: Long? = null, - ): ByteArray { + ): ByteArray { val apiPath = "/avatars/browsers/{code}" .replace("{code}", code.value) val apiParams = mutableMapOf( - "width" to width, - "height" to height, - "quality" to quality, + "width" to width, + "height" to height, + "quality" to quality, "project" to client.config["project"], ) return client.call( @@ -70,14 +70,14 @@ class Avatars(client: Client) : Service(client) { width: Long? = null, height: Long? = null, quality: Long? = null, - ): ByteArray { + ): ByteArray { val apiPath = "/avatars/credit-cards/{code}" .replace("{code}", code.value) val apiParams = mutableMapOf( - "width" to width, - "height" to height, - "quality" to quality, + "width" to width, + "height" to height, + "quality" to quality, "project" to client.config["project"], ) return client.call( @@ -99,11 +99,11 @@ class Avatars(client: Client) : Service(client) { */ suspend fun getFavicon( url: String, - ): ByteArray { + ): ByteArray { val apiPath = "/avatars/favicon" val apiParams = mutableMapOf( - "url" to url, + "url" to url, "project" to client.config["project"], ) return client.call( @@ -132,14 +132,14 @@ class Avatars(client: Client) : Service(client) { width: Long? = null, height: Long? = null, quality: Long? = null, - ): ByteArray { + ): ByteArray { val apiPath = "/avatars/flags/{code}" .replace("{code}", code.value) val apiParams = mutableMapOf( - "width" to width, - "height" to height, - "quality" to quality, + "width" to width, + "height" to height, + "quality" to quality, "project" to client.config["project"], ) return client.call( @@ -166,13 +166,13 @@ class Avatars(client: Client) : Service(client) { url: String, width: Long? = null, height: Long? = null, - ): ByteArray { + ): ByteArray { val apiPath = "/avatars/image" val apiParams = mutableMapOf( - "url" to url, - "width" to width, - "height" to height, + "url" to url, + "width" to width, + "height" to height, "project" to client.config["project"], ) return client.call( @@ -201,14 +201,14 @@ class Avatars(client: Client) : Service(client) { width: Long? = null, height: Long? = null, background: String? = null, - ): ByteArray { + ): ByteArray { val apiPath = "/avatars/initials" val apiParams = mutableMapOf( - "name" to name, - "width" to width, - "height" to height, - "background" to background, + "name" to name, + "width" to width, + "height" to height, + "background" to background, "project" to client.config["project"], ) return client.call( @@ -237,14 +237,14 @@ class Avatars(client: Client) : Service(client) { size: Long? = null, margin: Long? = null, download: Boolean? = null, - ): ByteArray { + ): ByteArray { val apiPath = "/avatars/qr" val apiParams = mutableMapOf( - "text" to text, - "size" to size, - "margin" to margin, - "download" to download, + "text" to text, + "size" to size, + "margin" to margin, + "download" to download, "project" to client.config["project"], ) return client.call( @@ -256,4 +256,4 @@ class Avatars(client: Client) : Service(client) { } -} +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/services/Databases.kt b/library/src/main/java/io/appwrite/services/Databases.kt index 22d5375..70ecf23 100644 --- a/library/src/main/java/io/appwrite/services/Databases.kt +++ b/library/src/main/java/io/appwrite/services/Databases.kt @@ -31,22 +31,22 @@ class Databases(client: Client) : Service(client) { collectionId: String, queries: List? = null, nestedType: Class, - ): io.appwrite.models.DocumentList { + ): io.appwrite.models.DocumentList { val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents" .replace("{databaseId}", databaseId) .replace("{collectionId}", collectionId) val apiParams = mutableMapOf( - "queries" to queries, + "queries" to queries, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.DocumentList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.DocumentList.from(map = it as Map, nestedType) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -72,12 +72,12 @@ class Databases(client: Client) : Service(client) { databaseId: String, collectionId: String, queries: List? = null, - ): io.appwrite.models.DocumentList> = listDocuments( + ): io.appwrite.models.DocumentList> = listDocuments( databaseId, collectionId, queries, nestedType = classOf(), - ) + ) /** * Create document @@ -99,24 +99,24 @@ class Databases(client: Client) : Service(client) { data: Any, permissions: List? = null, nestedType: Class, - ): io.appwrite.models.Document { + ): io.appwrite.models.Document { val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents" .replace("{databaseId}", databaseId) .replace("{collectionId}", collectionId) val apiParams = mutableMapOf( - "documentId" to documentId, - "data" to data, - "permissions" to permissions, + "documentId" to documentId, + "data" to data, + "permissions" to permissions, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Document = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Document.from(map = it as Map, nestedType) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -146,14 +146,14 @@ class Databases(client: Client) : Service(client) { documentId: String, data: Any, permissions: List? = null, - ): io.appwrite.models.Document> = createDocument( + ): io.appwrite.models.Document> = createDocument( databaseId, collectionId, documentId, data, permissions, nestedType = classOf(), - ) + ) /** * Get document @@ -173,23 +173,23 @@ class Databases(client: Client) : Service(client) { documentId: String, queries: List? = null, nestedType: Class, - ): io.appwrite.models.Document { + ): io.appwrite.models.Document { val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" .replace("{databaseId}", databaseId) .replace("{collectionId}", collectionId) .replace("{documentId}", documentId) val apiParams = mutableMapOf( - "queries" to queries, + "queries" to queries, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Document = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Document.from(map = it as Map, nestedType) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -217,13 +217,13 @@ class Databases(client: Client) : Service(client) { collectionId: String, documentId: String, queries: List? = null, - ): io.appwrite.models.Document> = getDocument( + ): io.appwrite.models.Document> = getDocument( databaseId, collectionId, documentId, queries, nestedType = classOf(), - ) + ) /** * Update document @@ -245,24 +245,24 @@ class Databases(client: Client) : Service(client) { data: Any? = null, permissions: List? = null, nestedType: Class, - ): io.appwrite.models.Document { + ): io.appwrite.models.Document { val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" .replace("{databaseId}", databaseId) .replace("{collectionId}", collectionId) .replace("{documentId}", documentId) val apiParams = mutableMapOf( - "data" to data, - "permissions" to permissions, + "data" to data, + "permissions" to permissions, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Document = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Document.from(map = it as Map, nestedType) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -292,14 +292,14 @@ class Databases(client: Client) : Service(client) { documentId: String, data: Any? = null, permissions: List? = null, - ): io.appwrite.models.Document> = updateDocument( + ): io.appwrite.models.Document> = updateDocument( databaseId, collectionId, documentId, data, permissions, nestedType = classOf(), - ) + ) /** * Delete document @@ -315,7 +315,7 @@ class Databases(client: Client) : Service(client) { databaseId: String, collectionId: String, documentId: String, - ): Any { + ): Any { val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" .replace("{databaseId}", databaseId) .replace("{collectionId}", collectionId) @@ -323,10 +323,10 @@ class Databases(client: Client) : Service(client) { val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - return client.call( + return client.call( "DELETE", apiPath, apiHeaders, @@ -336,4 +336,4 @@ class Databases(client: Client) : Service(client) { } -} +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/services/Functions.kt b/library/src/main/java/io/appwrite/services/Functions.kt index 59809dc..d31e853 100644 --- a/library/src/main/java/io/appwrite/services/Functions.kt +++ b/library/src/main/java/io/appwrite/services/Functions.kt @@ -30,22 +30,22 @@ class Functions(client: Client) : Service(client) { functionId: String, queries: List? = null, search: String? = null, - ): io.appwrite.models.ExecutionList { + ): io.appwrite.models.ExecutionList { val apiPath = "/functions/{functionId}/executions" .replace("{functionId}", functionId) val apiParams = mutableMapOf( - "queries" to queries, - "search" to search, + "queries" to queries, + "search" to search, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.ExecutionList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.ExecutionList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -73,33 +73,32 @@ class Functions(client: Client) : Service(client) { @JvmOverloads suspend fun createExecution( functionId: String, - body: Payload? = null, + body: String? = null, async: Boolean? = null, path: String? = null, method: io.appwrite.enums.ExecutionMethod? = null, headers: Any? = null, scheduledAt: String? = null, - ): io.appwrite.models.Execution { + ): io.appwrite.models.Execution { val apiPath = "/functions/{functionId}/executions" .replace("{functionId}", functionId) val apiParams = mutableMapOf( - "body" to (body?.toBinary() ?: ""), - "async" to async, - "path" to path, - "method" to method, - "headers" to headers, - "scheduledAt" to scheduledAt, + "body" to body, + "async" to async, + "path" to path, + "method" to method, + "headers" to headers, + "scheduledAt" to scheduledAt, ) - val apiHeaders = mutableMapOf( - "content-type" to "multipart/form-data", - "accept" to "multipart/form-data", + val apiHeaders = mutableMapOf( + "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Execution = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Execution.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -122,21 +121,21 @@ class Functions(client: Client) : Service(client) { suspend fun getExecution( functionId: String, executionId: String, - ): io.appwrite.models.Execution { + ): io.appwrite.models.Execution { val apiPath = "/functions/{functionId}/executions/{executionId}" .replace("{functionId}", functionId) .replace("{executionId}", executionId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Execution = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Execution.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -147,4 +146,4 @@ class Functions(client: Client) : Service(client) { } -} +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/services/Graphql.kt b/library/src/main/java/io/appwrite/services/Graphql.kt index 1052e67..6c977a2 100644 --- a/library/src/main/java/io/appwrite/services/Graphql.kt +++ b/library/src/main/java/io/appwrite/services/Graphql.kt @@ -25,20 +25,20 @@ class Graphql(client: Client) : Service(client) { */ suspend fun query( query: Any, - ): Any { + ): Any { val apiPath = "/graphql" val apiParams = mutableMapOf( - "query" to query, + "query" to query, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "x-sdk-graphql" to "true", "content-type" to "application/json", ) val converter: (Any) -> Any = { it } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -59,20 +59,20 @@ class Graphql(client: Client) : Service(client) { */ suspend fun mutation( query: Any, - ): Any { + ): Any { val apiPath = "/graphql/mutation" val apiParams = mutableMapOf( - "query" to query, + "query" to query, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "x-sdk-graphql" to "true", "content-type" to "application/json", ) val converter: (Any) -> Any = { it } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -83,4 +83,4 @@ class Graphql(client: Client) : Service(client) { } -} +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/services/Locale.kt b/library/src/main/java/io/appwrite/services/Locale.kt index 097e1f7..01b3017 100644 --- a/library/src/main/java/io/appwrite/services/Locale.kt +++ b/library/src/main/java/io/appwrite/services/Locale.kt @@ -23,19 +23,19 @@ class Locale(client: Client) : Service(client) { * @return [io.appwrite.models.Locale] */ suspend fun get( - ): io.appwrite.models.Locale { + ): io.appwrite.models.Locale { val apiPath = "/locale" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Locale = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Locale.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -54,19 +54,19 @@ class Locale(client: Client) : Service(client) { * @return [io.appwrite.models.LocaleCodeList] */ suspend fun listCodes( - ): io.appwrite.models.LocaleCodeList { + ): io.appwrite.models.LocaleCodeList { val apiPath = "/locale/codes" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.LocaleCodeList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.LocaleCodeList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -85,19 +85,19 @@ class Locale(client: Client) : Service(client) { * @return [io.appwrite.models.ContinentList] */ suspend fun listContinents( - ): io.appwrite.models.ContinentList { + ): io.appwrite.models.ContinentList { val apiPath = "/locale/continents" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.ContinentList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.ContinentList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -116,19 +116,19 @@ class Locale(client: Client) : Service(client) { * @return [io.appwrite.models.CountryList] */ suspend fun listCountries( - ): io.appwrite.models.CountryList { + ): io.appwrite.models.CountryList { val apiPath = "/locale/countries" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.CountryList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.CountryList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -147,19 +147,19 @@ class Locale(client: Client) : Service(client) { * @return [io.appwrite.models.CountryList] */ suspend fun listCountriesEU( - ): io.appwrite.models.CountryList { + ): io.appwrite.models.CountryList { val apiPath = "/locale/countries/eu" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.CountryList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.CountryList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -178,19 +178,19 @@ class Locale(client: Client) : Service(client) { * @return [io.appwrite.models.PhoneList] */ suspend fun listCountriesPhones( - ): io.appwrite.models.PhoneList { + ): io.appwrite.models.PhoneList { val apiPath = "/locale/countries/phones" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.PhoneList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.PhoneList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -209,19 +209,19 @@ class Locale(client: Client) : Service(client) { * @return [io.appwrite.models.CurrencyList] */ suspend fun listCurrencies( - ): io.appwrite.models.CurrencyList { + ): io.appwrite.models.CurrencyList { val apiPath = "/locale/currencies" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.CurrencyList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.CurrencyList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -240,19 +240,19 @@ class Locale(client: Client) : Service(client) { * @return [io.appwrite.models.LanguageList] */ suspend fun listLanguages( - ): io.appwrite.models.LanguageList { + ): io.appwrite.models.LanguageList { val apiPath = "/locale/languages" val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.LanguageList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.LanguageList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -263,4 +263,4 @@ class Locale(client: Client) : Service(client) { } -} +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/services/Messaging.kt b/library/src/main/java/io/appwrite/services/Messaging.kt index 5c6504f..baca2c4 100644 --- a/library/src/main/java/io/appwrite/services/Messaging.kt +++ b/library/src/main/java/io/appwrite/services/Messaging.kt @@ -29,22 +29,22 @@ class Messaging(client: Client) : Service(client) { topicId: String, subscriberId: String, targetId: String, - ): io.appwrite.models.Subscriber { + ): io.appwrite.models.Subscriber { val apiPath = "/messaging/topics/{topicId}/subscribers" .replace("{topicId}", topicId) val apiParams = mutableMapOf( - "subscriberId" to subscriberId, - "targetId" to targetId, + "subscriberId" to subscriberId, + "targetId" to targetId, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Subscriber = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Subscriber.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -67,17 +67,17 @@ class Messaging(client: Client) : Service(client) { suspend fun deleteSubscriber( topicId: String, subscriberId: String, - ): Any { + ): Any { val apiPath = "/messaging/topics/{topicId}/subscribers/{subscriberId}" .replace("{topicId}", topicId) .replace("{subscriberId}", subscriberId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - return client.call( + return client.call( "DELETE", apiPath, apiHeaders, @@ -87,4 +87,4 @@ class Messaging(client: Client) : Service(client) { } -} +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/services/Realtime.kt b/library/src/main/java/io/appwrite/services/Realtime.kt index 1bffd3a..605be89 100644 --- a/library/src/main/java/io/appwrite/services/Realtime.kt +++ b/library/src/main/java/io/appwrite/services/Realtime.kt @@ -29,6 +29,8 @@ class Realtime(client: Client) : Service(client), CoroutineScope { private companion object { private const val TYPE_ERROR = "error" private const val TYPE_EVENT = "event" + private const val TYPE_PONG = "pong" + private const val HEARTBEAT_INTERVAL = 20_000L // 20 seconds private const val DEBOUNCE_MILLIS = 1L @@ -40,6 +42,7 @@ class Realtime(client: Client) : Service(client), CoroutineScope { private var reconnectAttempts = 0 private var subscriptionsCounter = 0 private var reconnect = true + private var heartbeatJob: Job? = null } private fun createSocket() { @@ -80,9 +83,25 @@ class Realtime(client: Client) : Service(client), CoroutineScope { } private fun closeSocket() { + stopHeartbeat() socket?.close(RealtimeCode.POLICY_VIOLATION.value, null) } + private fun startHeartbeat() { + stopHeartbeat() + heartbeatJob = launch { + while (isActive) { + delay(HEARTBEAT_INTERVAL) + socket?.send("""{"type":"ping"}""") + } + } + } + + private fun stopHeartbeat() { + heartbeatJob?.cancel() + heartbeatJob = null + } + private fun getTimeout() = when { reconnectAttempts < 5 -> 1000L reconnectAttempts < 15 -> 5000L @@ -145,6 +164,7 @@ class Realtime(client: Client) : Service(client), CoroutineScope { override fun onOpen(webSocket: WebSocket, response: Response) { super.onOpen(webSocket, response) reconnectAttempts = 0 + startHeartbeat() } override fun onMessage(webSocket: WebSocket, text: String) { @@ -181,6 +201,7 @@ class Realtime(client: Client) : Service(client), CoroutineScope { override fun onClosing(webSocket: WebSocket, code: Int, reason: String) { super.onClosing(webSocket, code, reason) + stopHeartbeat() if (!reconnect || code == RealtimeCode.POLICY_VIOLATION.value) { reconnect = true return @@ -203,6 +224,7 @@ class Realtime(client: Client) : Service(client), CoroutineScope { override fun onFailure(webSocket: WebSocket, t: Throwable, response: Response?) { super.onFailure(webSocket, t, response) + stopHeartbeat() t.printStackTrace() } } diff --git a/library/src/main/java/io/appwrite/services/Storage.kt b/library/src/main/java/io/appwrite/services/Storage.kt index c30d37c..1f990c2 100644 --- a/library/src/main/java/io/appwrite/services/Storage.kt +++ b/library/src/main/java/io/appwrite/services/Storage.kt @@ -32,22 +32,22 @@ class Storage(client: Client) : Service(client) { bucketId: String, queries: List? = null, search: String? = null, - ): io.appwrite.models.FileList { + ): io.appwrite.models.FileList { val apiPath = "/storage/buckets/{bucketId}/files" .replace("{bucketId}", bucketId) val apiParams = mutableMapOf( - "queries" to queries, - "search" to search, + "queries" to queries, + "search" to search, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.FileList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.FileList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -73,26 +73,26 @@ class Storage(client: Client) : Service(client) { suspend fun createFile( bucketId: String, fileId: String, - file: Payload, + file: InputFile, permissions: List? = null, - onProgress: ((UploadProgress) -> Unit)? = null + onProgress: ((UploadProgress) -> Unit)? = null ): io.appwrite.models.File { val apiPath = "/storage/buckets/{bucketId}/files" .replace("{bucketId}", bucketId) val apiParams = mutableMapOf( - "fileId" to fileId, - "file" to file, - "permissions" to permissions, + "fileId" to fileId, + "file" to file, + "permissions" to permissions, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "multipart/form-data", ) val converter: (Any) -> io.appwrite.models.File = { @Suppress("UNCHECKED_CAST") io.appwrite.models.File.from(map = it as Map) } - val idParamName: String? = "fileId" + val idParamName: String? = "fileId" val paramName = "file" return client.chunkedUpload( apiPath, @@ -119,21 +119,21 @@ class Storage(client: Client) : Service(client) { suspend fun getFile( bucketId: String, fileId: String, - ): io.appwrite.models.File { + ): io.appwrite.models.File { val apiPath = "/storage/buckets/{bucketId}/files/{fileId}" .replace("{bucketId}", bucketId) .replace("{fileId}", fileId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.File = { @Suppress("UNCHECKED_CAST") io.appwrite.models.File.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -161,23 +161,23 @@ class Storage(client: Client) : Service(client) { fileId: String, name: String? = null, permissions: List? = null, - ): io.appwrite.models.File { + ): io.appwrite.models.File { val apiPath = "/storage/buckets/{bucketId}/files/{fileId}" .replace("{bucketId}", bucketId) .replace("{fileId}", fileId) val apiParams = mutableMapOf( - "name" to name, - "permissions" to permissions, + "name" to name, + "permissions" to permissions, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.File = { @Suppress("UNCHECKED_CAST") io.appwrite.models.File.from(map = it as Map) } - return client.call( + return client.call( "PUT", apiPath, apiHeaders, @@ -200,17 +200,17 @@ class Storage(client: Client) : Service(client) { suspend fun deleteFile( bucketId: String, fileId: String, - ): Any { + ): Any { val apiPath = "/storage/buckets/{bucketId}/files/{fileId}" .replace("{bucketId}", bucketId) .replace("{fileId}", fileId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - return client.call( + return client.call( "DELETE", apiPath, apiHeaders, @@ -232,7 +232,7 @@ class Storage(client: Client) : Service(client) { suspend fun getFileDownload( bucketId: String, fileId: String, - ): ByteArray { + ): ByteArray { val apiPath = "/storage/buckets/{bucketId}/files/{fileId}/download" .replace("{bucketId}", bucketId) .replace("{fileId}", fileId) @@ -284,23 +284,23 @@ class Storage(client: Client) : Service(client) { rotation: Long? = null, background: String? = null, output: io.appwrite.enums.ImageFormat? = null, - ): ByteArray { + ): ByteArray { val apiPath = "/storage/buckets/{bucketId}/files/{fileId}/preview" .replace("{bucketId}", bucketId) .replace("{fileId}", fileId) val apiParams = mutableMapOf( - "width" to width, - "height" to height, - "gravity" to gravity, - "quality" to quality, - "borderWidth" to borderWidth, - "borderColor" to borderColor, - "borderRadius" to borderRadius, - "opacity" to opacity, - "rotation" to rotation, - "background" to background, - "output" to output, + "width" to width, + "height" to height, + "gravity" to gravity, + "quality" to quality, + "borderWidth" to borderWidth, + "borderColor" to borderColor, + "borderRadius" to borderRadius, + "opacity" to opacity, + "rotation" to rotation, + "background" to background, + "output" to output, "project" to client.config["project"], ) return client.call( @@ -324,7 +324,7 @@ class Storage(client: Client) : Service(client) { suspend fun getFileView( bucketId: String, fileId: String, - ): ByteArray { + ): ByteArray { val apiPath = "/storage/buckets/{bucketId}/files/{fileId}/view" .replace("{bucketId}", bucketId) .replace("{fileId}", fileId) @@ -341,4 +341,4 @@ class Storage(client: Client) : Service(client) { } -} +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/services/Teams.kt b/library/src/main/java/io/appwrite/services/Teams.kt index cf611ba..fd0ae92 100644 --- a/library/src/main/java/io/appwrite/services/Teams.kt +++ b/library/src/main/java/io/appwrite/services/Teams.kt @@ -29,21 +29,21 @@ class Teams(client: Client) : Service(client) { queries: List? = null, search: String? = null, nestedType: Class, - ): io.appwrite.models.TeamList { + ): io.appwrite.models.TeamList { val apiPath = "/teams" val apiParams = mutableMapOf( - "queries" to queries, - "search" to search, + "queries" to queries, + "search" to search, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.TeamList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.TeamList.from(map = it as Map, nestedType) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -67,11 +67,11 @@ class Teams(client: Client) : Service(client) { suspend fun list( queries: List? = null, search: String? = null, - ): io.appwrite.models.TeamList> = list( + ): io.appwrite.models.TeamList> = list( queries, search, nestedType = classOf(), - ) + ) /** * Create team @@ -89,22 +89,22 @@ class Teams(client: Client) : Service(client) { name: String, roles: List? = null, nestedType: Class, - ): io.appwrite.models.Team { + ): io.appwrite.models.Team { val apiPath = "/teams" val apiParams = mutableMapOf( - "teamId" to teamId, - "name" to name, - "roles" to roles, + "teamId" to teamId, + "name" to name, + "roles" to roles, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Team = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Team.from(map = it as Map, nestedType) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -130,12 +130,12 @@ class Teams(client: Client) : Service(client) { teamId: String, name: String, roles: List? = null, - ): io.appwrite.models.Team> = create( + ): io.appwrite.models.Team> = create( teamId, name, roles, nestedType = classOf(), - ) + ) /** * Get team @@ -148,20 +148,20 @@ class Teams(client: Client) : Service(client) { suspend fun get( teamId: String, nestedType: Class, - ): io.appwrite.models.Team { + ): io.appwrite.models.Team { val apiPath = "/teams/{teamId}" .replace("{teamId}", teamId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Team = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Team.from(map = it as Map, nestedType) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -182,10 +182,10 @@ class Teams(client: Client) : Service(client) { @Throws(AppwriteException::class) suspend fun get( teamId: String, - ): io.appwrite.models.Team> = get( + ): io.appwrite.models.Team> = get( teamId, nestedType = classOf(), - ) + ) /** * Update name @@ -200,21 +200,21 @@ class Teams(client: Client) : Service(client) { teamId: String, name: String, nestedType: Class, - ): io.appwrite.models.Team { + ): io.appwrite.models.Team { val apiPath = "/teams/{teamId}" .replace("{teamId}", teamId) val apiParams = mutableMapOf( - "name" to name, + "name" to name, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Team = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Team.from(map = it as Map, nestedType) } - return client.call( + return client.call( "PUT", apiPath, apiHeaders, @@ -237,11 +237,11 @@ class Teams(client: Client) : Service(client) { suspend fun updateName( teamId: String, name: String, - ): io.appwrite.models.Team> = updateName( + ): io.appwrite.models.Team> = updateName( teamId, name, nestedType = classOf(), - ) + ) /** * Delete team @@ -253,16 +253,16 @@ class Teams(client: Client) : Service(client) { */ suspend fun delete( teamId: String, - ): Any { + ): Any { val apiPath = "/teams/{teamId}" .replace("{teamId}", teamId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - return client.call( + return client.call( "DELETE", apiPath, apiHeaders, @@ -287,22 +287,22 @@ class Teams(client: Client) : Service(client) { teamId: String, queries: List? = null, search: String? = null, - ): io.appwrite.models.MembershipList { + ): io.appwrite.models.MembershipList { val apiPath = "/teams/{teamId}/memberships" .replace("{teamId}", teamId) val apiParams = mutableMapOf( - "queries" to queries, - "search" to search, + "queries" to queries, + "search" to search, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.MembershipList = { @Suppress("UNCHECKED_CAST") io.appwrite.models.MembershipList.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -336,26 +336,26 @@ class Teams(client: Client) : Service(client) { phone: String? = null, url: String? = null, name: String? = null, - ): io.appwrite.models.Membership { + ): io.appwrite.models.Membership { val apiPath = "/teams/{teamId}/memberships" .replace("{teamId}", teamId) val apiParams = mutableMapOf( - "email" to email, - "userId" to userId, - "phone" to phone, - "roles" to roles, - "url" to url, - "name" to name, - ) - val apiHeaders = mutableMapOf( + "email" to email, + "userId" to userId, + "phone" to phone, + "roles" to roles, + "url" to url, + "name" to name, + ) + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Membership = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Membership.from(map = it as Map) } - return client.call( + return client.call( "POST", apiPath, apiHeaders, @@ -378,21 +378,21 @@ class Teams(client: Client) : Service(client) { suspend fun getMembership( teamId: String, membershipId: String, - ): io.appwrite.models.Membership { + ): io.appwrite.models.Membership { val apiPath = "/teams/{teamId}/memberships/{membershipId}" .replace("{teamId}", teamId) .replace("{membershipId}", membershipId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Membership = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Membership.from(map = it as Map) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -417,22 +417,22 @@ class Teams(client: Client) : Service(client) { teamId: String, membershipId: String, roles: List, - ): io.appwrite.models.Membership { + ): io.appwrite.models.Membership { val apiPath = "/teams/{teamId}/memberships/{membershipId}" .replace("{teamId}", teamId) .replace("{membershipId}", membershipId) val apiParams = mutableMapOf( - "roles" to roles, + "roles" to roles, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Membership = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Membership.from(map = it as Map) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -455,17 +455,17 @@ class Teams(client: Client) : Service(client) { suspend fun deleteMembership( teamId: String, membershipId: String, - ): Any { + ): Any { val apiPath = "/teams/{teamId}/memberships/{membershipId}" .replace("{teamId}", teamId) .replace("{membershipId}", membershipId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) - return client.call( + return client.call( "DELETE", apiPath, apiHeaders, @@ -491,23 +491,23 @@ class Teams(client: Client) : Service(client) { membershipId: String, userId: String, secret: String, - ): io.appwrite.models.Membership { + ): io.appwrite.models.Membership { val apiPath = "/teams/{teamId}/memberships/{membershipId}/status" .replace("{teamId}", teamId) .replace("{membershipId}", membershipId) val apiParams = mutableMapOf( - "userId" to userId, - "secret" to secret, + "userId" to userId, + "secret" to secret, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Membership = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Membership.from(map = it as Map) } - return client.call( + return client.call( "PATCH", apiPath, apiHeaders, @@ -529,20 +529,20 @@ class Teams(client: Client) : Service(client) { suspend fun getPrefs( teamId: String, nestedType: Class, - ): io.appwrite.models.Preferences { + ): io.appwrite.models.Preferences { val apiPath = "/teams/{teamId}/prefs" .replace("{teamId}", teamId) val apiParams = mutableMapOf( ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Preferences = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Preferences.from(map = it as Map, nestedType) } - return client.call( + return client.call( "GET", apiPath, apiHeaders, @@ -563,10 +563,10 @@ class Teams(client: Client) : Service(client) { @Throws(AppwriteException::class) suspend fun getPrefs( teamId: String, - ): io.appwrite.models.Preferences> = getPrefs( + ): io.appwrite.models.Preferences> = getPrefs( teamId, nestedType = classOf(), - ) + ) /** * Update preferences @@ -581,21 +581,21 @@ class Teams(client: Client) : Service(client) { teamId: String, prefs: Any, nestedType: Class, - ): io.appwrite.models.Preferences { + ): io.appwrite.models.Preferences { val apiPath = "/teams/{teamId}/prefs" .replace("{teamId}", teamId) val apiParams = mutableMapOf( - "prefs" to prefs, + "prefs" to prefs, ) - val apiHeaders = mutableMapOf( + val apiHeaders = mutableMapOf( "content-type" to "application/json", ) val converter: (Any) -> io.appwrite.models.Preferences = { @Suppress("UNCHECKED_CAST") io.appwrite.models.Preferences.from(map = it as Map, nestedType) } - return client.call( + return client.call( "PUT", apiPath, apiHeaders, @@ -618,10 +618,10 @@ class Teams(client: Client) : Service(client) { suspend fun updatePrefs( teamId: String, prefs: Any, - ): io.appwrite.models.Preferences> = updatePrefs( + ): io.appwrite.models.Preferences> = updatePrefs( teamId, prefs, nestedType = classOf(), - ) + ) -} +} \ No newline at end of file From 0a2e764cae754b8fb6087dd886b24fc81b00ee21 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 13 Dec 2024 13:23:34 +0000 Subject: [PATCH 7/8] feat: 1.6.x --- library/src/main/java/io/appwrite/models/Membership.kt | 6 +++--- library/src/main/java/io/appwrite/models/Target.kt | 8 ++++++++ library/src/main/java/io/appwrite/services/Teams.kt | 4 ++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/library/src/main/java/io/appwrite/models/Membership.kt b/library/src/main/java/io/appwrite/models/Membership.kt index 1f20394..4a899ee 100644 --- a/library/src/main/java/io/appwrite/models/Membership.kt +++ b/library/src/main/java/io/appwrite/models/Membership.kt @@ -32,13 +32,13 @@ data class Membership( val userId: String, /** - * User name. + * User name. Hide this attribute by toggling membership privacy in the Console. */ @SerializedName("userName") val userName: String, /** - * User email address. + * User email address. Hide this attribute by toggling membership privacy in the Console. */ @SerializedName("userEmail") val userEmail: String, @@ -74,7 +74,7 @@ data class Membership( val confirm: Boolean, /** - * Multi factor authentication status, true if the user has MFA enabled or false otherwise. + * Multi factor authentication status, true if the user has MFA enabled or false otherwise. Hide this attribute by toggling membership privacy in the Console. */ @SerializedName("mfa") val mfa: Boolean, diff --git a/library/src/main/java/io/appwrite/models/Target.kt b/library/src/main/java/io/appwrite/models/Target.kt index bd4d207..54b4694 100644 --- a/library/src/main/java/io/appwrite/models/Target.kt +++ b/library/src/main/java/io/appwrite/models/Target.kt @@ -55,6 +55,12 @@ data class Target( @SerializedName("identifier") val identifier: String, + /** + * Is the target expired. + */ + @SerializedName("expired") + val expired: Boolean, + ) { fun toMap(): Map = mapOf( "\$id" to id as Any, @@ -65,6 +71,7 @@ data class Target( "providerId" to providerId as Any, "providerType" to providerType as Any, "identifier" to identifier as Any, + "expired" to expired as Any, ) companion object { @@ -81,6 +88,7 @@ data class Target( providerId = map["providerId"] as? String?, providerType = map["providerType"] as String, identifier = map["identifier"] as String, + expired = map["expired"] as Boolean, ) } } \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/services/Teams.kt b/library/src/main/java/io/appwrite/services/Teams.kt index fd0ae92..b586f11 100644 --- a/library/src/main/java/io/appwrite/services/Teams.kt +++ b/library/src/main/java/io/appwrite/services/Teams.kt @@ -275,7 +275,7 @@ class Teams(client: Client) : Service(client) { /** * List team memberships * - * Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. + * Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console. * * @param teamId Team ID. * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm @@ -369,7 +369,7 @@ class Teams(client: Client) : Service(client) { /** * Get team membership * - * Get a team member by the membership unique id. All team members have read access for this resource. + * Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console. * * @param teamId Team ID. * @param membershipId Membership ID. From 90441670b3534ba78fc96f23ada5d13a6eb2170d Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Tue, 17 Dec 2024 11:54:48 +0000 Subject: [PATCH 8/8] chore: regen --- README.md | 4 ++-- library/src/main/java/io/appwrite/Client.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f8dab1a..338b53e 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ repositories { Next, add the dependency to your project's `build.gradle(.kts)` file: ```groovy -implementation("io.appwrite:sdk-for-android:6.0.0") +implementation("io.appwrite:sdk-for-android:6.1.0") ``` ### Maven @@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file: io.appwrite sdk-for-android - 6.0.0 + 6.1.0 ``` diff --git a/library/src/main/java/io/appwrite/Client.kt b/library/src/main/java/io/appwrite/Client.kt index 93a3e06..e2a48bb 100644 --- a/library/src/main/java/io/appwrite/Client.kt +++ b/library/src/main/java/io/appwrite/Client.kt @@ -86,7 +86,7 @@ class Client @JvmOverloads constructor( "x-sdk-name" to "Android", "x-sdk-platform" to "client", "x-sdk-language" to "android", - "x-sdk-version" to "6.0.0", + "x-sdk-version" to "6.1.0", "x-appwrite-response-format" to "1.6.0" ) config = mutableMapOf()