diff --git a/README.md b/README.md index 304c80c..76ed518 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.3.0-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.4.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.3.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-android/releases).** +**This SDK is compatible with Appwrite server version latest. 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:2.0.0") +implementation("io.appwrite:sdk-for-android:3.0.0") ``` ### Maven @@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file: io.appwrite sdk-for-android - 2.0.0 + 3.0.0 ``` diff --git a/docs/examples/java/account/create-anonymous-session.md b/docs/examples/java/account/create-anonymous-session.md index 7d2123b..59c7630 100644 --- a/docs/examples/java/account/create-anonymous-session.md +++ b/docs/examples/java/account/create-anonymous-session.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/create-email-session.md b/docs/examples/java/account/create-email-session.md index 384dbaf..e3e6fdd 100644 --- a/docs/examples/java/account/create-email-session.md +++ b/docs/examples/java/account/create-email-session.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/create-j-w-t.md b/docs/examples/java/account/create-j-w-t.md index 86ad905..c312386 100644 --- a/docs/examples/java/account/create-j-w-t.md +++ b/docs/examples/java/account/create-j-w-t.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/create-magic-u-r-l-session.md b/docs/examples/java/account/create-magic-u-r-l-session.md index 1789eec..0ed43dc 100644 --- a/docs/examples/java/account/create-magic-u-r-l-session.md +++ b/docs/examples/java/account/create-magic-u-r-l-session.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // 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 a2f5d02..cb9386a 100644 --- a/docs/examples/java/account/create-o-auth2session.md +++ b/docs/examples/java/account/create-o-auth2session.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/create-phone-session.md b/docs/examples/java/account/create-phone-session.md index 7c54dbd..df5bc86 100644 --- a/docs/examples/java/account/create-phone-session.md +++ b/docs/examples/java/account/create-phone-session.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/create-phone-verification.md b/docs/examples/java/account/create-phone-verification.md index f3e9526..1545d0f 100644 --- a/docs/examples/java/account/create-phone-verification.md +++ b/docs/examples/java/account/create-phone-verification.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/create-recovery.md b/docs/examples/java/account/create-recovery.md index 44773dd..5e8584f 100644 --- a/docs/examples/java/account/create-recovery.md +++ b/docs/examples/java/account/create-recovery.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/create-verification.md b/docs/examples/java/account/create-verification.md index 02d2934..fcea98f 100644 --- a/docs/examples/java/account/create-verification.md +++ b/docs/examples/java/account/create-verification.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/create.md b/docs/examples/java/account/create.md index 68bb47e..e08731f 100644 --- a/docs/examples/java/account/create.md +++ b/docs/examples/java/account/create.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/delete-identity.md b/docs/examples/java/account/delete-identity.md new file mode 100644 index 0000000..0d92d04 --- /dev/null +++ b/docs/examples/java/account/delete-identity.md @@ -0,0 +1,21 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2"); // Your project ID + +Account account = new Account(client); + +account.deleteIdentity( + "[IDENTITY_ID]" + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); diff --git a/docs/examples/java/account/delete-session.md b/docs/examples/java/account/delete-session.md index b42b841..28009d0 100644 --- a/docs/examples/java/account/delete-session.md +++ b/docs/examples/java/account/delete-session.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/delete-sessions.md b/docs/examples/java/account/delete-sessions.md index 847c5c1..6bdc840 100644 --- a/docs/examples/java/account/delete-sessions.md +++ b/docs/examples/java/account/delete-sessions.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // 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 d7777d8..9911ad3 100644 --- a/docs/examples/java/account/get-prefs.md +++ b/docs/examples/java/account/get-prefs.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // 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 b7861b2..fecb543 100644 --- a/docs/examples/java/account/get-session.md +++ b/docs/examples/java/account/get-session.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/get.md b/docs/examples/java/account/get.md index 1351652..2e5f40a 100644 --- a/docs/examples/java/account/get.md +++ b/docs/examples/java/account/get.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // 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 new file mode 100644 index 0000000..d1f6a48 --- /dev/null +++ b/docs/examples/java/account/list-identities.md @@ -0,0 +1,20 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2"); // Your project ID + +Account account = new Account(client); + +account.listIdentities( + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); diff --git a/docs/examples/java/account/list-logs.md b/docs/examples/java/account/list-logs.md index d073d4e..d2ce790 100644 --- a/docs/examples/java/account/list-logs.md +++ b/docs/examples/java/account/list-logs.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // 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 91888bc..7fd587e 100644 --- a/docs/examples/java/account/list-sessions.md +++ b/docs/examples/java/account/list-sessions.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // 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 53dd0bd..8034ada 100644 --- a/docs/examples/java/account/update-email.md +++ b/docs/examples/java/account/update-email.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // 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 e56da73..0f8f2b3 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 @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // 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 c722c85..5940f93 100644 --- a/docs/examples/java/account/update-name.md +++ b/docs/examples/java/account/update-name.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/update-password.md b/docs/examples/java/account/update-password.md index aaaee66..d942632 100644 --- a/docs/examples/java/account/update-password.md +++ b/docs/examples/java/account/update-password.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/update-phone-session.md b/docs/examples/java/account/update-phone-session.md index 952c7e0..589e4ff 100644 --- a/docs/examples/java/account/update-phone-session.md +++ b/docs/examples/java/account/update-phone-session.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/update-phone-verification.md b/docs/examples/java/account/update-phone-verification.md index ec5ddf1..81785f9 100644 --- a/docs/examples/java/account/update-phone-verification.md +++ b/docs/examples/java/account/update-phone-verification.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/update-phone.md b/docs/examples/java/account/update-phone.md index 61cff45..a8572f9 100644 --- a/docs/examples/java/account/update-phone.md +++ b/docs/examples/java/account/update-phone.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/update-prefs.md b/docs/examples/java/account/update-prefs.md index a004b45..ffd5ef0 100644 --- a/docs/examples/java/account/update-prefs.md +++ b/docs/examples/java/account/update-prefs.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/update-recovery.md b/docs/examples/java/account/update-recovery.md index e565a6b..7b0f392 100644 --- a/docs/examples/java/account/update-recovery.md +++ b/docs/examples/java/account/update-recovery.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/update-session.md b/docs/examples/java/account/update-session.md index 4c5d975..27b8f00 100644 --- a/docs/examples/java/account/update-session.md +++ b/docs/examples/java/account/update-session.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/account/update-status.md b/docs/examples/java/account/update-status.md index 739469a..1e18ded 100644 --- a/docs/examples/java/account/update-status.md +++ b/docs/examples/java/account/update-status.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // 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 b05dbc2..d852dbf 100644 --- a/docs/examples/java/account/update-verification.md +++ b/docs/examples/java/account/update-verification.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Account; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Account account = new Account(client); diff --git a/docs/examples/java/assistant/chat.md b/docs/examples/java/assistant/chat.md new file mode 100644 index 0000000..62cf301 --- /dev/null +++ b/docs/examples/java/assistant/chat.md @@ -0,0 +1,21 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Assistant; + +Client client = new Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2"); // Your project ID + +Assistant assistant = new Assistant(client); + +assistant.chat( + "[PROMPT]" + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); diff --git a/docs/examples/java/avatars/get-browser.md b/docs/examples/java/avatars/get-browser.md index 8ad3f18..f072110 100644 --- a/docs/examples/java/avatars/get-browser.md +++ b/docs/examples/java/avatars/get-browser.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Avatars; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // 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 453718b..0a73312 100644 --- a/docs/examples/java/avatars/get-credit-card.md +++ b/docs/examples/java/avatars/get-credit-card.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Avatars; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // 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 a5b9fa6..e0c1cb6 100644 --- a/docs/examples/java/avatars/get-favicon.md +++ b/docs/examples/java/avatars/get-favicon.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Avatars; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Avatars avatars = new Avatars(client); diff --git a/docs/examples/java/avatars/get-flag.md b/docs/examples/java/avatars/get-flag.md index 0bc4896..a5f4790 100644 --- a/docs/examples/java/avatars/get-flag.md +++ b/docs/examples/java/avatars/get-flag.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Avatars; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // 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 d77d79c..cdc8ac7 100644 --- a/docs/examples/java/avatars/get-image.md +++ b/docs/examples/java/avatars/get-image.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Avatars; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Avatars avatars = new Avatars(client); diff --git a/docs/examples/java/avatars/get-initials.md b/docs/examples/java/avatars/get-initials.md index 491724f..c02490c 100644 --- a/docs/examples/java/avatars/get-initials.md +++ b/docs/examples/java/avatars/get-initials.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Avatars; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Avatars avatars = new Avatars(client); diff --git a/docs/examples/java/avatars/get-q-r.md b/docs/examples/java/avatars/get-q-r.md index ae1a11d..2532f20 100644 --- a/docs/examples/java/avatars/get-q-r.md +++ b/docs/examples/java/avatars/get-q-r.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Avatars; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Avatars avatars = new Avatars(client); diff --git a/docs/examples/java/databases/create-document.md b/docs/examples/java/databases/create-document.md index d4412ce..715e4cd 100644 --- a/docs/examples/java/databases/create-document.md +++ b/docs/examples/java/databases/create-document.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Databases; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Databases databases = new Databases(client); diff --git a/docs/examples/java/databases/delete-document.md b/docs/examples/java/databases/delete-document.md index 90ad1ce..1387f48 100644 --- a/docs/examples/java/databases/delete-document.md +++ b/docs/examples/java/databases/delete-document.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Databases; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Databases databases = new Databases(client); diff --git a/docs/examples/java/databases/get-document.md b/docs/examples/java/databases/get-document.md index 7e3b33b..b1a7161 100644 --- a/docs/examples/java/databases/get-document.md +++ b/docs/examples/java/databases/get-document.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Databases; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Databases databases = new Databases(client); diff --git a/docs/examples/java/databases/list-documents.md b/docs/examples/java/databases/list-documents.md index 6b897df..62dc2c7 100644 --- a/docs/examples/java/databases/list-documents.md +++ b/docs/examples/java/databases/list-documents.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Databases; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Databases databases = new Databases(client); diff --git a/docs/examples/java/databases/update-document.md b/docs/examples/java/databases/update-document.md index 7f04c8e..d1ed59d 100644 --- a/docs/examples/java/databases/update-document.md +++ b/docs/examples/java/databases/update-document.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Databases; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Databases databases = new Databases(client); diff --git a/docs/examples/java/functions/create-execution.md b/docs/examples/java/functions/create-execution.md index ee4eaf5..3cce1c3 100644 --- a/docs/examples/java/functions/create-execution.md +++ b/docs/examples/java/functions/create-execution.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Functions; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Functions functions = new Functions(client); diff --git a/docs/examples/java/functions/get-execution.md b/docs/examples/java/functions/get-execution.md index 90153f5..459d743 100644 --- a/docs/examples/java/functions/get-execution.md +++ b/docs/examples/java/functions/get-execution.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Functions; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Functions functions = new Functions(client); diff --git a/docs/examples/java/functions/list-executions.md b/docs/examples/java/functions/list-executions.md index fca903b..c1f982b 100644 --- a/docs/examples/java/functions/list-executions.md +++ b/docs/examples/java/functions/list-executions.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Functions; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Functions functions = new Functions(client); diff --git a/docs/examples/java/graphql/mutation.md b/docs/examples/java/graphql/mutation.md index e6ced40..262e513 100644 --- a/docs/examples/java/graphql/mutation.md +++ b/docs/examples/java/graphql/mutation.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Graphql; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // 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 f0b8a86..4291b47 100644 --- a/docs/examples/java/graphql/query.md +++ b/docs/examples/java/graphql/query.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Graphql; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // 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 89de369..4d14be6 100644 --- a/docs/examples/java/locale/get.md +++ b/docs/examples/java/locale/get.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Locale; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // 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 new file mode 100644 index 0000000..599070e --- /dev/null +++ b/docs/examples/java/locale/list-codes.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Locale; + +Client client = new Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2"); // Your project ID + +Locale locale = new Locale(client); + +locale.listCodes(new CoroutineCallback<>((result, error) -> { + if (error != null) + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/java/locale/list-continents.md b/docs/examples/java/locale/list-continents.md index 7205ad6..6abe97a 100644 --- a/docs/examples/java/locale/list-continents.md +++ b/docs/examples/java/locale/list-continents.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Locale; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // 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 d6f37be..3c5ca3a 100644 --- a/docs/examples/java/locale/list-countries-e-u.md +++ b/docs/examples/java/locale/list-countries-e-u.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Locale; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // 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 1f947fe..81ef94d 100644 --- a/docs/examples/java/locale/list-countries-phones.md +++ b/docs/examples/java/locale/list-countries-phones.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Locale; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // 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 5b8c0ba..dc0d5f5 100644 --- a/docs/examples/java/locale/list-countries.md +++ b/docs/examples/java/locale/list-countries.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Locale; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // 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 880e1b2..7a327b3 100644 --- a/docs/examples/java/locale/list-currencies.md +++ b/docs/examples/java/locale/list-currencies.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Locale; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // 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 318c6dc..0688614 100644 --- a/docs/examples/java/locale/list-languages.md +++ b/docs/examples/java/locale/list-languages.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Locale; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Locale locale = new Locale(client); diff --git a/docs/examples/java/migrations/delete-firebase-auth.md b/docs/examples/java/migrations/delete-firebase-auth.md new file mode 100644 index 0000000..ab56fe9 --- /dev/null +++ b/docs/examples/java/migrations/delete-firebase-auth.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Migrations; + +Client client = new Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2"); // Your project ID + +Migrations migrations = new Migrations(client); + +migrations.deleteFirebaseAuth(new CoroutineCallback<>((result, error) -> { + if (error != null) + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/java/migrations/list-firebase-projects.md b/docs/examples/java/migrations/list-firebase-projects.md new file mode 100644 index 0000000..7dba57e --- /dev/null +++ b/docs/examples/java/migrations/list-firebase-projects.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Migrations; + +Client client = new Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2"); // Your project ID + +Migrations migrations = new Migrations(client); + +migrations.listFirebaseProjects(new CoroutineCallback<>((result, error) -> { + if (error != null) + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/java/storage/create-file.md b/docs/examples/java/storage/create-file.md index 161f882..732b302 100644 --- a/docs/examples/java/storage/create-file.md +++ b/docs/examples/java/storage/create-file.md @@ -4,7 +4,7 @@ import io.appwrite.models.InputFile; import io.appwrite.services.Storage; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Storage storage = new Storage(client); diff --git a/docs/examples/java/storage/delete-file.md b/docs/examples/java/storage/delete-file.md index 654c127..69a0f0f 100644 --- a/docs/examples/java/storage/delete-file.md +++ b/docs/examples/java/storage/delete-file.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Storage; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Storage storage = new Storage(client); diff --git a/docs/examples/java/storage/get-file-download.md b/docs/examples/java/storage/get-file-download.md index f12302a..2ab30dc 100644 --- a/docs/examples/java/storage/get-file-download.md +++ b/docs/examples/java/storage/get-file-download.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Storage; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Storage storage = new Storage(client); diff --git a/docs/examples/java/storage/get-file-preview.md b/docs/examples/java/storage/get-file-preview.md index 8487922..483f2fc 100644 --- a/docs/examples/java/storage/get-file-preview.md +++ b/docs/examples/java/storage/get-file-preview.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Storage; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Storage storage = new Storage(client); diff --git a/docs/examples/java/storage/get-file-view.md b/docs/examples/java/storage/get-file-view.md index 825b538..5614b69 100644 --- a/docs/examples/java/storage/get-file-view.md +++ b/docs/examples/java/storage/get-file-view.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Storage; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Storage storage = new Storage(client); diff --git a/docs/examples/java/storage/get-file.md b/docs/examples/java/storage/get-file.md index bf97922..4ae0de0 100644 --- a/docs/examples/java/storage/get-file.md +++ b/docs/examples/java/storage/get-file.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Storage; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Storage storage = new Storage(client); diff --git a/docs/examples/java/storage/list-files.md b/docs/examples/java/storage/list-files.md index fdf3e4f..dedfb6c 100644 --- a/docs/examples/java/storage/list-files.md +++ b/docs/examples/java/storage/list-files.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Storage; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Storage storage = new Storage(client); diff --git a/docs/examples/java/storage/update-file.md b/docs/examples/java/storage/update-file.md index 9d9f192..9b4dd92 100644 --- a/docs/examples/java/storage/update-file.md +++ b/docs/examples/java/storage/update-file.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Storage; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Storage storage = new Storage(client); diff --git a/docs/examples/java/teams/create-membership.md b/docs/examples/java/teams/create-membership.md index 0e5590d..6c8b383 100644 --- a/docs/examples/java/teams/create-membership.md +++ b/docs/examples/java/teams/create-membership.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); diff --git a/docs/examples/java/teams/create.md b/docs/examples/java/teams/create.md index 52207c6..263fa57 100644 --- a/docs/examples/java/teams/create.md +++ b/docs/examples/java/teams/create.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); diff --git a/docs/examples/java/teams/delete-membership.md b/docs/examples/java/teams/delete-membership.md index 92d6d37..40f28f0 100644 --- a/docs/examples/java/teams/delete-membership.md +++ b/docs/examples/java/teams/delete-membership.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); diff --git a/docs/examples/java/teams/delete.md b/docs/examples/java/teams/delete.md index ed81195..5b4c378 100644 --- a/docs/examples/java/teams/delete.md +++ b/docs/examples/java/teams/delete.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); diff --git a/docs/examples/java/teams/get-membership.md b/docs/examples/java/teams/get-membership.md index 7e29171..f2f1d99 100644 --- a/docs/examples/java/teams/get-membership.md +++ b/docs/examples/java/teams/get-membership.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); diff --git a/docs/examples/java/teams/get-prefs.md b/docs/examples/java/teams/get-prefs.md index bbf1256..6963cb4 100644 --- a/docs/examples/java/teams/get-prefs.md +++ b/docs/examples/java/teams/get-prefs.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); diff --git a/docs/examples/java/teams/get.md b/docs/examples/java/teams/get.md index 36063c5..549af20 100644 --- a/docs/examples/java/teams/get.md +++ b/docs/examples/java/teams/get.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); diff --git a/docs/examples/java/teams/list-memberships.md b/docs/examples/java/teams/list-memberships.md index d195978..3da4e33 100644 --- a/docs/examples/java/teams/list-memberships.md +++ b/docs/examples/java/teams/list-memberships.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); diff --git a/docs/examples/java/teams/list.md b/docs/examples/java/teams/list.md index b4998ff..b20ad4a 100644 --- a/docs/examples/java/teams/list.md +++ b/docs/examples/java/teams/list.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); diff --git a/docs/examples/java/teams/update-membership-status.md b/docs/examples/java/teams/update-membership-status.md index 1015b2e..499251f 100644 --- a/docs/examples/java/teams/update-membership-status.md +++ b/docs/examples/java/teams/update-membership-status.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); diff --git a/docs/examples/java/teams/update-membership-roles.md b/docs/examples/java/teams/update-membership.md similarity index 83% rename from docs/examples/java/teams/update-membership-roles.md rename to docs/examples/java/teams/update-membership.md index 680c9a3..6cb3346 100644 --- a/docs/examples/java/teams/update-membership-roles.md +++ b/docs/examples/java/teams/update-membership.md @@ -3,12 +3,12 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); -teams.updateMembershipRoles( +teams.updateMembership( "[TEAM_ID]", "[MEMBERSHIP_ID]", listOf() diff --git a/docs/examples/java/teams/update-name.md b/docs/examples/java/teams/update-name.md index 22a2ee0..170ee59 100644 --- a/docs/examples/java/teams/update-name.md +++ b/docs/examples/java/teams/update-name.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); diff --git a/docs/examples/java/teams/update-prefs.md b/docs/examples/java/teams/update-prefs.md index a4cf82d..a19ad82 100644 --- a/docs/examples/java/teams/update-prefs.md +++ b/docs/examples/java/teams/update-prefs.md @@ -3,7 +3,7 @@ import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); diff --git a/docs/examples/java/vcs/create-repository-detection.md b/docs/examples/java/vcs/create-repository-detection.md new file mode 100644 index 0000000..640414c --- /dev/null +++ b/docs/examples/java/vcs/create-repository-detection.md @@ -0,0 +1,22 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Vcs; + +Client client = new Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2"); // Your project ID + +Vcs vcs = new Vcs(client); + +vcs.createRepositoryDetection( + "[INSTALLATION_ID]", + "[PROVIDER_REPOSITORY_ID]", + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); diff --git a/docs/examples/java/vcs/create-repository.md b/docs/examples/java/vcs/create-repository.md new file mode 100644 index 0000000..ebc22b3 --- /dev/null +++ b/docs/examples/java/vcs/create-repository.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Vcs; + +Client client = new Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2"); // Your project ID + +Vcs vcs = new Vcs(client); + +vcs.createRepository( + "[INSTALLATION_ID]", + "[NAME]", + false + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); diff --git a/docs/examples/java/vcs/get-repository.md b/docs/examples/java/vcs/get-repository.md new file mode 100644 index 0000000..2e03db2 --- /dev/null +++ b/docs/examples/java/vcs/get-repository.md @@ -0,0 +1,22 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Vcs; + +Client client = new Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2"); // Your project ID + +Vcs vcs = new Vcs(client); + +vcs.getRepository( + "[INSTALLATION_ID]", + "[PROVIDER_REPOSITORY_ID]" + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); diff --git a/docs/examples/java/vcs/list-repositories.md b/docs/examples/java/vcs/list-repositories.md new file mode 100644 index 0000000..3ebd41d --- /dev/null +++ b/docs/examples/java/vcs/list-repositories.md @@ -0,0 +1,21 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Vcs; + +Client client = new Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2"); // Your project ID + +Vcs vcs = new Vcs(client); + +vcs.listRepositories( + "[INSTALLATION_ID]", + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); diff --git a/docs/examples/java/vcs/list-repository-branches.md b/docs/examples/java/vcs/list-repository-branches.md new file mode 100644 index 0000000..3cb3663 --- /dev/null +++ b/docs/examples/java/vcs/list-repository-branches.md @@ -0,0 +1,22 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Vcs; + +Client client = new Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2"); // Your project ID + +Vcs vcs = new Vcs(client); + +vcs.listRepositoryBranches( + "[INSTALLATION_ID]", + "[PROVIDER_REPOSITORY_ID]" + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); diff --git a/docs/examples/java/vcs/update-external-deployments.md b/docs/examples/java/vcs/update-external-deployments.md new file mode 100644 index 0000000..0f27f4a --- /dev/null +++ b/docs/examples/java/vcs/update-external-deployments.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Vcs; + +Client client = new Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2"); // Your project ID + +Vcs vcs = new Vcs(client); + +vcs.updateExternalDeployments( + "[INSTALLATION_ID]", + "[REPOSITORY_ID]", + "[PROVIDER_PULL_REQUEST_ID]" + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); diff --git a/docs/examples/kotlin/account/create-anonymous-session.md b/docs/examples/kotlin/account/create-anonymous-session.md index ccefc0a..cdcf401 100644 --- a/docs/examples/kotlin/account/create-anonymous-session.md +++ b/docs/examples/kotlin/account/create-anonymous-session.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/create-email-session.md b/docs/examples/kotlin/account/create-email-session.md index c58799c..ab8d581 100644 --- a/docs/examples/kotlin/account/create-email-session.md +++ b/docs/examples/kotlin/account/create-email-session.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/create-j-w-t.md b/docs/examples/kotlin/account/create-j-w-t.md index 59b7398..35e7a6f 100644 --- a/docs/examples/kotlin/account/create-j-w-t.md +++ b/docs/examples/kotlin/account/create-j-w-t.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/create-magic-u-r-l-session.md b/docs/examples/kotlin/account/create-magic-u-r-l-session.md index 5f36940..51368b5 100644 --- a/docs/examples/kotlin/account/create-magic-u-r-l-session.md +++ b/docs/examples/kotlin/account/create-magic-u-r-l-session.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // 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 f909b59..395bfad 100644 --- a/docs/examples/kotlin/account/create-o-auth2session.md +++ b/docs/examples/kotlin/account/create-o-auth2session.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/create-phone-session.md b/docs/examples/kotlin/account/create-phone-session.md index 8f63c64..eed6f7a 100644 --- a/docs/examples/kotlin/account/create-phone-session.md +++ b/docs/examples/kotlin/account/create-phone-session.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/create-phone-verification.md b/docs/examples/kotlin/account/create-phone-verification.md index af36502..12fb9f7 100644 --- a/docs/examples/kotlin/account/create-phone-verification.md +++ b/docs/examples/kotlin/account/create-phone-verification.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/create-recovery.md b/docs/examples/kotlin/account/create-recovery.md index 23a3424..7d73a67 100644 --- a/docs/examples/kotlin/account/create-recovery.md +++ b/docs/examples/kotlin/account/create-recovery.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/create-verification.md b/docs/examples/kotlin/account/create-verification.md index 3fed01b..b3dc43a 100644 --- a/docs/examples/kotlin/account/create-verification.md +++ b/docs/examples/kotlin/account/create-verification.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/create.md b/docs/examples/kotlin/account/create.md index eda87d3..c72ae90 100644 --- a/docs/examples/kotlin/account/create.md +++ b/docs/examples/kotlin/account/create.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/delete-identity.md b/docs/examples/kotlin/account/delete-identity.md new file mode 100644 index 0000000..440333e --- /dev/null +++ b/docs/examples/kotlin/account/delete-identity.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + +val account = Account(client) + +val response = account.deleteIdentity( + identityId = "[IDENTITY_ID]" +) diff --git a/docs/examples/kotlin/account/delete-session.md b/docs/examples/kotlin/account/delete-session.md index 5c8988f..a98a286 100644 --- a/docs/examples/kotlin/account/delete-session.md +++ b/docs/examples/kotlin/account/delete-session.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/delete-sessions.md b/docs/examples/kotlin/account/delete-sessions.md index 86c9bc9..c9afbf1 100644 --- a/docs/examples/kotlin/account/delete-sessions.md +++ b/docs/examples/kotlin/account/delete-sessions.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // 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 70fa291..bd3f81a 100644 --- a/docs/examples/kotlin/account/get-prefs.md +++ b/docs/examples/kotlin/account/get-prefs.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // 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 58248ae..d6d6c72 100644 --- a/docs/examples/kotlin/account/get-session.md +++ b/docs/examples/kotlin/account/get-session.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/get.md b/docs/examples/kotlin/account/get.md index 09b0a17..4c8f0be 100644 --- a/docs/examples/kotlin/account/get.md +++ b/docs/examples/kotlin/account/get.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // 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 new file mode 100644 index 0000000..3292b35 --- /dev/null +++ b/docs/examples/kotlin/account/list-identities.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + +val account = Account(client) + +val response = account.listIdentities( +) diff --git a/docs/examples/kotlin/account/list-logs.md b/docs/examples/kotlin/account/list-logs.md index dda9c72..eb337ca 100644 --- a/docs/examples/kotlin/account/list-logs.md +++ b/docs/examples/kotlin/account/list-logs.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // 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 b7bb447..cd9f63b 100644 --- a/docs/examples/kotlin/account/list-sessions.md +++ b/docs/examples/kotlin/account/list-sessions.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // 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 2d1b66b..85a0242 100644 --- a/docs/examples/kotlin/account/update-email.md +++ b/docs/examples/kotlin/account/update-email.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // 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 49af217..c7286ba 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 @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // 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 5799344..574f493 100644 --- a/docs/examples/kotlin/account/update-name.md +++ b/docs/examples/kotlin/account/update-name.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/update-password.md b/docs/examples/kotlin/account/update-password.md index 14e746f..c5338b8 100644 --- a/docs/examples/kotlin/account/update-password.md +++ b/docs/examples/kotlin/account/update-password.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/update-phone-session.md b/docs/examples/kotlin/account/update-phone-session.md index 6efa2a4..d3b02e0 100644 --- a/docs/examples/kotlin/account/update-phone-session.md +++ b/docs/examples/kotlin/account/update-phone-session.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/update-phone-verification.md b/docs/examples/kotlin/account/update-phone-verification.md index 1b90372..0314f74 100644 --- a/docs/examples/kotlin/account/update-phone-verification.md +++ b/docs/examples/kotlin/account/update-phone-verification.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/update-phone.md b/docs/examples/kotlin/account/update-phone.md index 0534220..76eb8aa 100644 --- a/docs/examples/kotlin/account/update-phone.md +++ b/docs/examples/kotlin/account/update-phone.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/update-prefs.md b/docs/examples/kotlin/account/update-prefs.md index 408988b..f16e40b 100644 --- a/docs/examples/kotlin/account/update-prefs.md +++ b/docs/examples/kotlin/account/update-prefs.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/update-recovery.md b/docs/examples/kotlin/account/update-recovery.md index fd28f6e..9682899 100644 --- a/docs/examples/kotlin/account/update-recovery.md +++ b/docs/examples/kotlin/account/update-recovery.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/update-session.md b/docs/examples/kotlin/account/update-session.md index 67d900e..e9e83d0 100644 --- a/docs/examples/kotlin/account/update-session.md +++ b/docs/examples/kotlin/account/update-session.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/account/update-status.md b/docs/examples/kotlin/account/update-status.md index 35a4027..f7789ea 100644 --- a/docs/examples/kotlin/account/update-status.md +++ b/docs/examples/kotlin/account/update-status.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // 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 f87192e..af800c1 100644 --- a/docs/examples/kotlin/account/update-verification.md +++ b/docs/examples/kotlin/account/update-verification.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Account val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val account = Account(client) diff --git a/docs/examples/kotlin/assistant/chat.md b/docs/examples/kotlin/assistant/chat.md new file mode 100644 index 0000000..ef4381b --- /dev/null +++ b/docs/examples/kotlin/assistant/chat.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.services.Assistant + +val client = Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + +val assistant = Assistant(client) + +val response = assistant.chat( + prompt = "[PROMPT]" +) diff --git a/docs/examples/kotlin/avatars/get-browser.md b/docs/examples/kotlin/avatars/get-browser.md index 9ea6739..b1b2d08 100644 --- a/docs/examples/kotlin/avatars/get-browser.md +++ b/docs/examples/kotlin/avatars/get-browser.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Avatars val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // 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 cf82474..411e05a 100644 --- a/docs/examples/kotlin/avatars/get-credit-card.md +++ b/docs/examples/kotlin/avatars/get-credit-card.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Avatars val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // 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 102d773..1a4b217 100644 --- a/docs/examples/kotlin/avatars/get-favicon.md +++ b/docs/examples/kotlin/avatars/get-favicon.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Avatars val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val avatars = Avatars(client) diff --git a/docs/examples/kotlin/avatars/get-flag.md b/docs/examples/kotlin/avatars/get-flag.md index 7a618a7..5c882d6 100644 --- a/docs/examples/kotlin/avatars/get-flag.md +++ b/docs/examples/kotlin/avatars/get-flag.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Avatars val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // 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 fc1fe1d..20d8dff 100644 --- a/docs/examples/kotlin/avatars/get-image.md +++ b/docs/examples/kotlin/avatars/get-image.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Avatars val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val avatars = Avatars(client) diff --git a/docs/examples/kotlin/avatars/get-initials.md b/docs/examples/kotlin/avatars/get-initials.md index 448467e..70ef9b2 100644 --- a/docs/examples/kotlin/avatars/get-initials.md +++ b/docs/examples/kotlin/avatars/get-initials.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Avatars val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val avatars = Avatars(client) diff --git a/docs/examples/kotlin/avatars/get-q-r.md b/docs/examples/kotlin/avatars/get-q-r.md index 8d24934..92b17e1 100644 --- a/docs/examples/kotlin/avatars/get-q-r.md +++ b/docs/examples/kotlin/avatars/get-q-r.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Avatars val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val avatars = Avatars(client) diff --git a/docs/examples/kotlin/databases/create-document.md b/docs/examples/kotlin/databases/create-document.md index da4d1eb..d7f1991 100644 --- a/docs/examples/kotlin/databases/create-document.md +++ b/docs/examples/kotlin/databases/create-document.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Databases val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val databases = Databases(client) diff --git a/docs/examples/kotlin/databases/delete-document.md b/docs/examples/kotlin/databases/delete-document.md index bb2193e..c5bf2a2 100644 --- a/docs/examples/kotlin/databases/delete-document.md +++ b/docs/examples/kotlin/databases/delete-document.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Databases val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val databases = Databases(client) diff --git a/docs/examples/kotlin/databases/get-document.md b/docs/examples/kotlin/databases/get-document.md index 17c6047..abdee36 100644 --- a/docs/examples/kotlin/databases/get-document.md +++ b/docs/examples/kotlin/databases/get-document.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Databases val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val databases = Databases(client) diff --git a/docs/examples/kotlin/databases/list-documents.md b/docs/examples/kotlin/databases/list-documents.md index 0c2be1a..f97d878 100644 --- a/docs/examples/kotlin/databases/list-documents.md +++ b/docs/examples/kotlin/databases/list-documents.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Databases val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val databases = Databases(client) diff --git a/docs/examples/kotlin/databases/update-document.md b/docs/examples/kotlin/databases/update-document.md index 68cc42e..3820b89 100644 --- a/docs/examples/kotlin/databases/update-document.md +++ b/docs/examples/kotlin/databases/update-document.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Databases val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val databases = Databases(client) diff --git a/docs/examples/kotlin/functions/create-execution.md b/docs/examples/kotlin/functions/create-execution.md index b064201..77d4587 100644 --- a/docs/examples/kotlin/functions/create-execution.md +++ b/docs/examples/kotlin/functions/create-execution.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Functions val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val functions = Functions(client) diff --git a/docs/examples/kotlin/functions/get-execution.md b/docs/examples/kotlin/functions/get-execution.md index 2f9d5ef..b576686 100644 --- a/docs/examples/kotlin/functions/get-execution.md +++ b/docs/examples/kotlin/functions/get-execution.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Functions val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val functions = Functions(client) diff --git a/docs/examples/kotlin/functions/list-executions.md b/docs/examples/kotlin/functions/list-executions.md index d8a1aa1..14b613f 100644 --- a/docs/examples/kotlin/functions/list-executions.md +++ b/docs/examples/kotlin/functions/list-executions.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Functions val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val functions = Functions(client) diff --git a/docs/examples/kotlin/graphql/mutation.md b/docs/examples/kotlin/graphql/mutation.md index 7222301..dc37a3e 100644 --- a/docs/examples/kotlin/graphql/mutation.md +++ b/docs/examples/kotlin/graphql/mutation.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Graphql val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val graphql = Graphql(client) diff --git a/docs/examples/kotlin/graphql/query.md b/docs/examples/kotlin/graphql/query.md index db0f571..d821070 100644 --- a/docs/examples/kotlin/graphql/query.md +++ b/docs/examples/kotlin/graphql/query.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Graphql val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val graphql = Graphql(client) diff --git a/docs/examples/kotlin/locale/get.md b/docs/examples/kotlin/locale/get.md index da6b040..a2044c7 100644 --- a/docs/examples/kotlin/locale/get.md +++ b/docs/examples/kotlin/locale/get.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Locale val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // 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 new file mode 100644 index 0000000..b4e949b --- /dev/null +++ b/docs/examples/kotlin/locale/list-codes.md @@ -0,0 +1,10 @@ +import io.appwrite.Client +import io.appwrite.services.Locale + +val client = Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + +val locale = Locale(client) + +val response = locale.listCodes() diff --git a/docs/examples/kotlin/locale/list-continents.md b/docs/examples/kotlin/locale/list-continents.md index 8836a6c..610747e 100644 --- a/docs/examples/kotlin/locale/list-continents.md +++ b/docs/examples/kotlin/locale/list-continents.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Locale val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // 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 051c191..fa5483f 100644 --- a/docs/examples/kotlin/locale/list-countries-e-u.md +++ b/docs/examples/kotlin/locale/list-countries-e-u.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Locale val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // 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 c6efaae..6aba463 100644 --- a/docs/examples/kotlin/locale/list-countries-phones.md +++ b/docs/examples/kotlin/locale/list-countries-phones.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Locale val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // 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 4e2eeef..c58456b 100644 --- a/docs/examples/kotlin/locale/list-countries.md +++ b/docs/examples/kotlin/locale/list-countries.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Locale val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // 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 f565be6..2cf0644 100644 --- a/docs/examples/kotlin/locale/list-currencies.md +++ b/docs/examples/kotlin/locale/list-currencies.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Locale val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // 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 284f5ba..afc00b1 100644 --- a/docs/examples/kotlin/locale/list-languages.md +++ b/docs/examples/kotlin/locale/list-languages.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Locale val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val locale = Locale(client) diff --git a/docs/examples/kotlin/migrations/delete-firebase-auth.md b/docs/examples/kotlin/migrations/delete-firebase-auth.md new file mode 100644 index 0000000..0aae427 --- /dev/null +++ b/docs/examples/kotlin/migrations/delete-firebase-auth.md @@ -0,0 +1,10 @@ +import io.appwrite.Client +import io.appwrite.services.Migrations + +val client = Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + +val migrations = Migrations(client) + +val response = migrations.deleteFirebaseAuth() diff --git a/docs/examples/kotlin/migrations/list-firebase-projects.md b/docs/examples/kotlin/migrations/list-firebase-projects.md new file mode 100644 index 0000000..fe33e4a --- /dev/null +++ b/docs/examples/kotlin/migrations/list-firebase-projects.md @@ -0,0 +1,10 @@ +import io.appwrite.Client +import io.appwrite.services.Migrations + +val client = Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + +val migrations = Migrations(client) + +val response = migrations.listFirebaseProjects() diff --git a/docs/examples/kotlin/storage/create-file.md b/docs/examples/kotlin/storage/create-file.md index fd52716..7bb79ac 100644 --- a/docs/examples/kotlin/storage/create-file.md +++ b/docs/examples/kotlin/storage/create-file.md @@ -3,7 +3,7 @@ import io.appwrite.models.InputFile import io.appwrite.services.Storage val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val storage = Storage(client) diff --git a/docs/examples/kotlin/storage/delete-file.md b/docs/examples/kotlin/storage/delete-file.md index 945e1b9..9430d7e 100644 --- a/docs/examples/kotlin/storage/delete-file.md +++ b/docs/examples/kotlin/storage/delete-file.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Storage val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val storage = Storage(client) diff --git a/docs/examples/kotlin/storage/get-file-download.md b/docs/examples/kotlin/storage/get-file-download.md index b5fde87..85bd22c 100644 --- a/docs/examples/kotlin/storage/get-file-download.md +++ b/docs/examples/kotlin/storage/get-file-download.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Storage val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val storage = Storage(client) diff --git a/docs/examples/kotlin/storage/get-file-preview.md b/docs/examples/kotlin/storage/get-file-preview.md index ea7d8d4..c5bbdef 100644 --- a/docs/examples/kotlin/storage/get-file-preview.md +++ b/docs/examples/kotlin/storage/get-file-preview.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Storage val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val storage = Storage(client) diff --git a/docs/examples/kotlin/storage/get-file-view.md b/docs/examples/kotlin/storage/get-file-view.md index c266fca..7e7589c 100644 --- a/docs/examples/kotlin/storage/get-file-view.md +++ b/docs/examples/kotlin/storage/get-file-view.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Storage val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val storage = Storage(client) diff --git a/docs/examples/kotlin/storage/get-file.md b/docs/examples/kotlin/storage/get-file.md index 73fd9a8..8fb6e24 100644 --- a/docs/examples/kotlin/storage/get-file.md +++ b/docs/examples/kotlin/storage/get-file.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Storage val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val storage = Storage(client) diff --git a/docs/examples/kotlin/storage/list-files.md b/docs/examples/kotlin/storage/list-files.md index f915e5a..191a3cc 100644 --- a/docs/examples/kotlin/storage/list-files.md +++ b/docs/examples/kotlin/storage/list-files.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Storage val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val storage = Storage(client) diff --git a/docs/examples/kotlin/storage/update-file.md b/docs/examples/kotlin/storage/update-file.md index 23ce52a..005270f 100644 --- a/docs/examples/kotlin/storage/update-file.md +++ b/docs/examples/kotlin/storage/update-file.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Storage val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val storage = Storage(client) diff --git a/docs/examples/kotlin/teams/create-membership.md b/docs/examples/kotlin/teams/create-membership.md index 33bbe56..afc9336 100644 --- a/docs/examples/kotlin/teams/create-membership.md +++ b/docs/examples/kotlin/teams/create-membership.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) diff --git a/docs/examples/kotlin/teams/create.md b/docs/examples/kotlin/teams/create.md index 26bef65..5e70bd8 100644 --- a/docs/examples/kotlin/teams/create.md +++ b/docs/examples/kotlin/teams/create.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) diff --git a/docs/examples/kotlin/teams/delete-membership.md b/docs/examples/kotlin/teams/delete-membership.md index ac1b37a..04ef5d3 100644 --- a/docs/examples/kotlin/teams/delete-membership.md +++ b/docs/examples/kotlin/teams/delete-membership.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) diff --git a/docs/examples/kotlin/teams/delete.md b/docs/examples/kotlin/teams/delete.md index c5bcd37..7d58960 100644 --- a/docs/examples/kotlin/teams/delete.md +++ b/docs/examples/kotlin/teams/delete.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) diff --git a/docs/examples/kotlin/teams/get-membership.md b/docs/examples/kotlin/teams/get-membership.md index 1ee6ec0..653bd52 100644 --- a/docs/examples/kotlin/teams/get-membership.md +++ b/docs/examples/kotlin/teams/get-membership.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) diff --git a/docs/examples/kotlin/teams/get-prefs.md b/docs/examples/kotlin/teams/get-prefs.md index b8c2382..bfd8f75 100644 --- a/docs/examples/kotlin/teams/get-prefs.md +++ b/docs/examples/kotlin/teams/get-prefs.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) diff --git a/docs/examples/kotlin/teams/get.md b/docs/examples/kotlin/teams/get.md index 557e998..72aea07 100644 --- a/docs/examples/kotlin/teams/get.md +++ b/docs/examples/kotlin/teams/get.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) diff --git a/docs/examples/kotlin/teams/list-memberships.md b/docs/examples/kotlin/teams/list-memberships.md index d7f2920..53bd6f3 100644 --- a/docs/examples/kotlin/teams/list-memberships.md +++ b/docs/examples/kotlin/teams/list-memberships.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) diff --git a/docs/examples/kotlin/teams/list.md b/docs/examples/kotlin/teams/list.md index f056d33..57c5fe8 100644 --- a/docs/examples/kotlin/teams/list.md +++ b/docs/examples/kotlin/teams/list.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) diff --git a/docs/examples/kotlin/teams/update-membership-status.md b/docs/examples/kotlin/teams/update-membership-status.md index a36b710..33de006 100644 --- a/docs/examples/kotlin/teams/update-membership-status.md +++ b/docs/examples/kotlin/teams/update-membership-status.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) diff --git a/docs/examples/kotlin/teams/update-membership-roles.md b/docs/examples/kotlin/teams/update-membership.md similarity index 69% rename from docs/examples/kotlin/teams/update-membership-roles.md rename to docs/examples/kotlin/teams/update-membership.md index 5727e11..40005ed 100644 --- a/docs/examples/kotlin/teams/update-membership-roles.md +++ b/docs/examples/kotlin/teams/update-membership.md @@ -2,12 +2,12 @@ import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) -val response = teams.updateMembershipRoles( +val response = teams.updateMembership( teamId = "[TEAM_ID]", membershipId = "[MEMBERSHIP_ID]", roles = listOf() diff --git a/docs/examples/kotlin/teams/update-name.md b/docs/examples/kotlin/teams/update-name.md index 9a2dc4a..59c6812 100644 --- a/docs/examples/kotlin/teams/update-name.md +++ b/docs/examples/kotlin/teams/update-name.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) diff --git a/docs/examples/kotlin/teams/update-prefs.md b/docs/examples/kotlin/teams/update-prefs.md index f7f8f50..6a89ac7 100644 --- a/docs/examples/kotlin/teams/update-prefs.md +++ b/docs/examples/kotlin/teams/update-prefs.md @@ -2,7 +2,7 @@ import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) diff --git a/docs/examples/kotlin/vcs/create-repository-detection.md b/docs/examples/kotlin/vcs/create-repository-detection.md new file mode 100644 index 0000000..02dece0 --- /dev/null +++ b/docs/examples/kotlin/vcs/create-repository-detection.md @@ -0,0 +1,13 @@ +import io.appwrite.Client +import io.appwrite.services.Vcs + +val client = Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + +val vcs = Vcs(client) + +val response = vcs.createRepositoryDetection( + installationId = "[INSTALLATION_ID]", + providerRepositoryId = "[PROVIDER_REPOSITORY_ID]", +) diff --git a/docs/examples/kotlin/vcs/create-repository.md b/docs/examples/kotlin/vcs/create-repository.md new file mode 100644 index 0000000..1c9d9f0 --- /dev/null +++ b/docs/examples/kotlin/vcs/create-repository.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.services.Vcs + +val client = Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + +val vcs = Vcs(client) + +val response = vcs.createRepository( + installationId = "[INSTALLATION_ID]", + name = "[NAME]", + private = false +) diff --git a/docs/examples/kotlin/vcs/get-repository.md b/docs/examples/kotlin/vcs/get-repository.md new file mode 100644 index 0000000..0f2964a --- /dev/null +++ b/docs/examples/kotlin/vcs/get-repository.md @@ -0,0 +1,13 @@ +import io.appwrite.Client +import io.appwrite.services.Vcs + +val client = Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + +val vcs = Vcs(client) + +val response = vcs.getRepository( + installationId = "[INSTALLATION_ID]", + providerRepositoryId = "[PROVIDER_REPOSITORY_ID]" +) diff --git a/docs/examples/kotlin/vcs/list-repositories.md b/docs/examples/kotlin/vcs/list-repositories.md new file mode 100644 index 0000000..471f00d --- /dev/null +++ b/docs/examples/kotlin/vcs/list-repositories.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.services.Vcs + +val client = Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + +val vcs = Vcs(client) + +val response = vcs.listRepositories( + installationId = "[INSTALLATION_ID]", +) diff --git a/docs/examples/kotlin/vcs/list-repository-branches.md b/docs/examples/kotlin/vcs/list-repository-branches.md new file mode 100644 index 0000000..dd891fe --- /dev/null +++ b/docs/examples/kotlin/vcs/list-repository-branches.md @@ -0,0 +1,13 @@ +import io.appwrite.Client +import io.appwrite.services.Vcs + +val client = Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + +val vcs = Vcs(client) + +val response = vcs.listRepositoryBranches( + installationId = "[INSTALLATION_ID]", + providerRepositoryId = "[PROVIDER_REPOSITORY_ID]" +) diff --git a/docs/examples/kotlin/vcs/update-external-deployments.md b/docs/examples/kotlin/vcs/update-external-deployments.md new file mode 100644 index 0000000..32164cc --- /dev/null +++ b/docs/examples/kotlin/vcs/update-external-deployments.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.services.Vcs + +val client = Client(context) + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + +val vcs = Vcs(client) + +val response = vcs.updateExternalDeployments( + installationId = "[INSTALLATION_ID]", + repositoryId = "[REPOSITORY_ID]", + providerPullRequestId = "[PROVIDER_PULL_REQUEST_ID]" +) diff --git a/library/src/main/java/io/appwrite/Client.kt b/library/src/main/java/io/appwrite/Client.kt index fe1234d..852ef98 100644 --- a/library/src/main/java/io/appwrite/Client.kt +++ b/library/src/main/java/io/appwrite/Client.kt @@ -88,8 +88,8 @@ class Client @JvmOverloads constructor( "x-sdk-name" to "Android", "x-sdk-platform" to "client", "x-sdk-language" to "android", - "x-sdk-version" to "2.0.0", - "x-appwrite-response-format" to "1.0.0" + "x-sdk-version" to "3.0.0", + "x-appwrite-response-format" to "1.4.0" ) config = mutableMapOf() diff --git a/library/src/main/java/io/appwrite/models/Branch.kt b/library/src/main/java/io/appwrite/models/Branch.kt new file mode 100644 index 0000000..674deef --- /dev/null +++ b/library/src/main/java/io/appwrite/models/Branch.kt @@ -0,0 +1,30 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Branch + */ +data class Branch( + /** + * Branch Name. + */ + @SerializedName("name") + val name: String, + +) { + fun toMap(): Map = mapOf( + "name" to name as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = Branch( + name = map["name"] as String, + ) + } +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/BranchList.kt b/library/src/main/java/io/appwrite/models/BranchList.kt new file mode 100644 index 0000000..d87248b --- /dev/null +++ b/library/src/main/java/io/appwrite/models/BranchList.kt @@ -0,0 +1,38 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Branches List + */ +data class BranchList( + /** + * Total number of branches documents that matched your query. + */ + @SerializedName("total") + val total: Long, + + /** + * List of branches. + */ + @SerializedName("branches") + val branches: List, + +) { + fun toMap(): Map = mapOf( + "total" to total as Any, + "branches" to branches.map { it.toMap() } as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = BranchList( + total = (map["total"] as Number).toLong(), + branches = (map["branches"] as List>).map { Branch.from(map = it) }, + ) + } +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/Detection.kt b/library/src/main/java/io/appwrite/models/Detection.kt new file mode 100644 index 0000000..3ed4631 --- /dev/null +++ b/library/src/main/java/io/appwrite/models/Detection.kt @@ -0,0 +1,30 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Detection + */ +data class Detection( + /** + * Runtime + */ + @SerializedName("runtime") + val runtime: String, + +) { + fun toMap(): Map = mapOf( + "runtime" to runtime as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = Detection( + runtime = map["runtime"] as String, + ) + } +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/Execution.kt b/library/src/main/java/io/appwrite/models/Execution.kt index a573562..8252aa1 100644 --- a/library/src/main/java/io/appwrite/models/Execution.kt +++ b/library/src/main/java/io/appwrite/models/Execution.kt @@ -50,31 +50,55 @@ data class Execution( val status: String, /** - * The script status code. + * HTTP request method type. */ - @SerializedName("statusCode") - val statusCode: Long, + @SerializedName("requestMethod") + val requestMethod: String, /** - * The script response output string. Logs the last 4,000 characters of the execution response output. + * HTTP request path and query. */ - @SerializedName("response") - val response: String, + @SerializedName("requestPath") + val requestPath: String, /** - * The script stdout output string. Logs the last 4,000 characters of the execution stdout output. This will return an empty string unless the response is returned using an API key or as part of a webhook 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. */ - @SerializedName("stdout") - val stdout: String, + @SerializedName("requestHeaders") + val requestHeaders: List, /** - * The script stderr output string. Logs the last 4,000 characters of the execution stderr output. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. + * HTTP response status code. */ - @SerializedName("stderr") - val stderr: String, + @SerializedName("responseStatusCode") + val responseStatusCode: Long, /** - * The script execution duration in seconds. + * HTTP response body. This will return empty unless execution is created as synchronous. + */ + @SerializedName("responseBody") + 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. + */ + @SerializedName("responseHeaders") + val responseHeaders: List, + + /** + * Function logs. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. + */ + @SerializedName("logs") + val logs: String, + + /** + * Function errors. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. + */ + @SerializedName("errors") + val errors: String, + + /** + * Function execution duration in seconds. */ @SerializedName("duration") val duration: Double, @@ -88,10 +112,14 @@ data class Execution( "functionId" to functionId as Any, "trigger" to trigger as Any, "status" to status as Any, - "statusCode" to statusCode as Any, - "response" to response as Any, - "stdout" to stdout as Any, - "stderr" to stderr as Any, + "requestMethod" to requestMethod as Any, + "requestPath" to requestPath as Any, + "requestHeaders" to requestHeaders.map { it.toMap() } as Any, + "responseStatusCode" to responseStatusCode as Any, + "responseBody" to responseBody as Any, + "responseHeaders" to responseHeaders.map { it.toMap() } as Any, + "logs" to logs as Any, + "errors" to errors as Any, "duration" to duration as Any, ) @@ -108,10 +136,14 @@ data class Execution( functionId = map["functionId"] as String, trigger = map["trigger"] as String, status = map["status"] as String, - statusCode = (map["statusCode"] as Number).toLong(), - response = map["response"] as String, - stdout = map["stdout"] as String, - stderr = map["stderr"] as String, + requestMethod = map["requestMethod"] as String, + 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, + responseHeaders = (map["responseHeaders"] as List>).map { Headers.from(map = it) }, + logs = map["logs"] as String, + errors = map["errors"] as String, duration = (map["duration"] as Number).toDouble(), ) } diff --git a/library/src/main/java/io/appwrite/models/FirebaseProject.kt b/library/src/main/java/io/appwrite/models/FirebaseProject.kt new file mode 100644 index 0000000..7f27597 --- /dev/null +++ b/library/src/main/java/io/appwrite/models/FirebaseProject.kt @@ -0,0 +1,38 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * MigrationFirebaseProject + */ +data class FirebaseProject( + /** + * Project ID. + */ + @SerializedName("projectId") + val projectId: String, + + /** + * Project display name. + */ + @SerializedName("displayName") + val displayName: String, + +) { + fun toMap(): Map = mapOf( + "projectId" to projectId as Any, + "displayName" to displayName as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = FirebaseProject( + projectId = map["projectId"] as String, + displayName = map["displayName"] as String, + ) + } +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/FirebaseProjectList.kt b/library/src/main/java/io/appwrite/models/FirebaseProjectList.kt new file mode 100644 index 0000000..510ad8a --- /dev/null +++ b/library/src/main/java/io/appwrite/models/FirebaseProjectList.kt @@ -0,0 +1,38 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Migrations Firebase Projects List + */ +data class FirebaseProjectList( + /** + * Total number of projects documents that matched your query. + */ + @SerializedName("total") + val total: Long, + + /** + * List of projects. + */ + @SerializedName("projects") + val projects: List, + +) { + fun toMap(): Map = mapOf( + "total" to total as Any, + "projects" to projects.map { it.toMap() } as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = FirebaseProjectList( + total = (map["total"] as Number).toLong(), + projects = (map["projects"] as List>).map { FirebaseProject.from(map = it) }, + ) + } +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/Headers.kt b/library/src/main/java/io/appwrite/models/Headers.kt new file mode 100644 index 0000000..230d6a6 --- /dev/null +++ b/library/src/main/java/io/appwrite/models/Headers.kt @@ -0,0 +1,38 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Headers + */ +data class Headers( + /** + * Header name. + */ + @SerializedName("name") + val name: String, + + /** + * Header value. + */ + @SerializedName("value") + val value: String, + +) { + fun toMap(): Map = mapOf( + "name" to name as Any, + "value" to value as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = Headers( + name = map["name"] as String, + value = map["value"] as String, + ) + } +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/Identity.kt b/library/src/main/java/io/appwrite/models/Identity.kt new file mode 100644 index 0000000..70ff5ea --- /dev/null +++ b/library/src/main/java/io/appwrite/models/Identity.kt @@ -0,0 +1,102 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Identity + */ +data class Identity( + /** + * Identity ID. + */ + @SerializedName("\$id") + val id: String, + + /** + * Identity creation date in ISO 8601 format. + */ + @SerializedName("\$createdAt") + val createdAt: String, + + /** + * Identity update date in ISO 8601 format. + */ + @SerializedName("\$updatedAt") + val updatedAt: String, + + /** + * User ID. + */ + @SerializedName("userId") + val userId: String, + + /** + * Identity Provider. + */ + @SerializedName("provider") + val provider: String, + + /** + * ID of the User in the Identity Provider. + */ + @SerializedName("providerUid") + val providerUid: String, + + /** + * Email of the User in the Identity Provider. + */ + @SerializedName("providerEmail") + val providerEmail: String, + + /** + * Identity Provider Access Token. + */ + @SerializedName("providerAccessToken") + val providerAccessToken: String, + + /** + * The date of when the access token expires in ISO 8601 format. + */ + @SerializedName("providerAccessTokenExpiry") + val providerAccessTokenExpiry: String, + + /** + * Identity Provider Refresh Token. + */ + @SerializedName("providerRefreshToken") + val providerRefreshToken: String, + +) { + fun toMap(): Map = mapOf( + "\$id" to id as Any, + "\$createdAt" to createdAt as Any, + "\$updatedAt" to updatedAt as Any, + "userId" to userId as Any, + "provider" to provider as Any, + "providerUid" to providerUid as Any, + "providerEmail" to providerEmail as Any, + "providerAccessToken" to providerAccessToken as Any, + "providerAccessTokenExpiry" to providerAccessTokenExpiry as Any, + "providerRefreshToken" to providerRefreshToken as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = Identity( + id = map["\$id"] as String, + createdAt = map["\$createdAt"] as String, + updatedAt = map["\$updatedAt"] as String, + userId = map["userId"] as String, + provider = map["provider"] as String, + providerUid = map["providerUid"] as String, + providerEmail = map["providerEmail"] as String, + providerAccessToken = map["providerAccessToken"] as String, + providerAccessTokenExpiry = map["providerAccessTokenExpiry"] as String, + providerRefreshToken = map["providerRefreshToken"] as String, + ) + } +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/IdentityList.kt b/library/src/main/java/io/appwrite/models/IdentityList.kt new file mode 100644 index 0000000..1cbb07d --- /dev/null +++ b/library/src/main/java/io/appwrite/models/IdentityList.kt @@ -0,0 +1,38 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Identities List + */ +data class IdentityList( + /** + * Total number of identities documents that matched your query. + */ + @SerializedName("total") + val total: Long, + + /** + * List of identities. + */ + @SerializedName("identities") + val identities: List, + +) { + fun toMap(): Map = mapOf( + "total" to total as Any, + "identities" to identities.map { it.toMap() } as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = IdentityList( + total = (map["total"] as Number).toLong(), + identities = (map["identities"] as List>).map { Identity.from(map = it) }, + ) + } +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/LocaleCode.kt b/library/src/main/java/io/appwrite/models/LocaleCode.kt new file mode 100644 index 0000000..ed886b7 --- /dev/null +++ b/library/src/main/java/io/appwrite/models/LocaleCode.kt @@ -0,0 +1,38 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * LocaleCode + */ +data class LocaleCode( + /** + * Locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) + */ + @SerializedName("code") + val code: String, + + /** + * Locale name + */ + @SerializedName("name") + val name: String, + +) { + fun toMap(): Map = mapOf( + "code" to code as Any, + "name" to name as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = LocaleCode( + code = map["code"] as String, + name = map["name"] as String, + ) + } +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/LocaleCodeList.kt b/library/src/main/java/io/appwrite/models/LocaleCodeList.kt new file mode 100644 index 0000000..3973a03 --- /dev/null +++ b/library/src/main/java/io/appwrite/models/LocaleCodeList.kt @@ -0,0 +1,38 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Locale codes list + */ +data class LocaleCodeList( + /** + * Total number of localeCodes documents that matched your query. + */ + @SerializedName("total") + val total: Long, + + /** + * List of localeCodes. + */ + @SerializedName("localeCodes") + val localeCodes: List, + +) { + fun toMap(): Map = mapOf( + "total" to total as Any, + "localeCodes" to localeCodes.map { it.toMap() } as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = LocaleCodeList( + total = (map["total"] as Number).toLong(), + localeCodes = (map["localeCodes"] as List>).map { LocaleCode.from(map = it) }, + ) + } +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/ProviderRepository.kt b/library/src/main/java/io/appwrite/models/ProviderRepository.kt new file mode 100644 index 0000000..bf4f7ad --- /dev/null +++ b/library/src/main/java/io/appwrite/models/ProviderRepository.kt @@ -0,0 +1,78 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * ProviderRepository + */ +data class ProviderRepository( + /** + * VCS (Version Control System) repository ID. + */ + @SerializedName("id") + val id: String, + + /** + * VCS (Version Control System) repository name. + */ + @SerializedName("name") + val name: String, + + /** + * VCS (Version Control System) organization name + */ + @SerializedName("organization") + val organization: String, + + /** + * VCS (Version Control System) provider name. + */ + @SerializedName("provider") + val provider: String, + + /** + * Is VCS (Version Control System) repository private? + */ + @SerializedName("xprivate") + val xprivate: Boolean, + + /** + * Auto-detected runtime suggestion. Empty if getting response of getRuntime(). + */ + @SerializedName("runtime") + val runtime: String, + + /** + * Last commit date in ISO 8601 format. + */ + @SerializedName("pushedAt") + val pushedAt: String, + +) { + fun toMap(): Map = mapOf( + "id" to id as Any, + "name" to name as Any, + "organization" to organization as Any, + "provider" to provider as Any, + "private" to xprivate as Any, + "runtime" to runtime as Any, + "pushedAt" to pushedAt as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = ProviderRepository( + id = map["id"] as String, + name = map["name"] as String, + organization = map["organization"] as String, + provider = map["provider"] as String, + xprivate = map["private"] as Boolean, + runtime = map["runtime"] as String, + pushedAt = map["pushedAt"] as String, + ) + } +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/ProviderRepositoryList.kt b/library/src/main/java/io/appwrite/models/ProviderRepositoryList.kt new file mode 100644 index 0000000..129527d --- /dev/null +++ b/library/src/main/java/io/appwrite/models/ProviderRepositoryList.kt @@ -0,0 +1,38 @@ +package io.appwrite.models + +import com.google.gson.annotations.SerializedName +import io.appwrite.extensions.jsonCast + +/** + * Provider Repositories List + */ +data class ProviderRepositoryList( + /** + * Total number of providerRepositories documents that matched your query. + */ + @SerializedName("total") + val total: Long, + + /** + * List of providerRepositories. + */ + @SerializedName("providerRepositories") + val providerRepositories: List, + +) { + fun toMap(): Map = mapOf( + "total" to total as Any, + "providerRepositories" to providerRepositories.map { it.toMap() } as Any, + ) + + companion object { + + @Suppress("UNCHECKED_CAST") + fun from( + map: Map, + ) = ProviderRepositoryList( + total = (map["total"] as Number).toLong(), + providerRepositories = (map["providerRepositories"] as List>).map { ProviderRepository.from(map = it) }, + ) + } +} \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/models/User.kt b/library/src/main/java/io/appwrite/models/User.kt index 81551e6..9bf7eb4 100644 --- a/library/src/main/java/io/appwrite/models/User.kt +++ b/library/src/main/java/io/appwrite/models/User.kt @@ -61,6 +61,12 @@ data class User( @SerializedName("status") val status: Boolean, + /** + * Labels for the user. + */ + @SerializedName("labels") + val labels: List, + /** * Password update time in ISO 8601 format. */ @@ -97,6 +103,12 @@ data class User( @SerializedName("prefs") val prefs: Preferences, + /** + * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + */ + @SerializedName("accessedAt") + val accessedAt: String, + ) { fun toMap(): Map = mapOf( "\$id" to id as Any, @@ -108,12 +120,14 @@ data class User( "hashOptions" to hashOptions as Any, "registration" to registration as Any, "status" to status as Any, + "labels" to labels as Any, "passwordUpdate" to passwordUpdate as Any, "email" to email as Any, "phone" to phone as Any, "emailVerification" to emailVerification as Any, "phoneVerification" to phoneVerification as Any, "prefs" to prefs.toMap() as Any, + "accessedAt" to accessedAt as Any, ) companion object { @@ -127,12 +141,14 @@ data class User( hashOptions: Any?, registration: String, status: Boolean, + labels: List, passwordUpdate: String, email: String, phone: String, emailVerification: Boolean, phoneVerification: Boolean, prefs: Preferences>, + accessedAt: String, ) = User>( id, createdAt, @@ -143,12 +159,14 @@ data class User( hashOptions, registration, status, + labels, passwordUpdate, email, phone, emailVerification, phoneVerification, prefs, + accessedAt, ) @Suppress("UNCHECKED_CAST") @@ -165,12 +183,14 @@ data class User( hashOptions = map["hashOptions"] as? Any?, registration = map["registration"] as String, status = map["status"] as Boolean, + labels = map["labels"] as List, passwordUpdate = map["passwordUpdate"] as String, email = map["email"] as String, phone = map["phone"] as String, emailVerification = map["emailVerification"] as Boolean, phoneVerification = map["phoneVerification"] as Boolean, prefs = Preferences.from(map = map["prefs"] as Map, nestedType), + accessedAt = map["accessedAt"] as String, ) } } \ No newline at end of file diff --git a/library/src/main/java/io/appwrite/services/Account.kt b/library/src/main/java/io/appwrite/services/Account.kt index 2a88a5b..f64e4b0 100644 --- a/library/src/main/java/io/appwrite/services/Account.kt +++ b/library/src/main/java/io/appwrite/services/Account.kt @@ -22,14 +22,14 @@ class Account : Service { /** * Get Account * - * Get currently logged in user data as JSON object. + * Get the currently logged in user. * * @return [io.appwrite.models.User] */ suspend fun get( nestedType: Class, ): io.appwrite.models.User { - val path = "/account" + val apiPath = "/account" val params = mutableMapOf( ) @@ -41,7 +41,7 @@ class Account : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = classOf(), @@ -52,7 +52,7 @@ class Account : Service { /** * Get Account * - * Get currently logged in user data as JSON object. + * Get the currently logged in user. * * @return [io.appwrite.models.User] */ @@ -81,7 +81,7 @@ class Account : Service { name: String? = null, nestedType: Class, ): io.appwrite.models.User { - val path = "/account" + val apiPath = "/account" val params = mutableMapOf( "userId" to userId, @@ -97,7 +97,7 @@ class Account : Service { } return client.call( "POST", - path, + apiPath, headers, params, responseType = classOf(), @@ -145,7 +145,7 @@ class Account : Service { password: String, nestedType: Class, ): io.appwrite.models.User { - val path = "/account/email" + val apiPath = "/account/email" val params = mutableMapOf( "email" to email, @@ -159,7 +159,7 @@ class Account : Service { } return client.call( "PATCH", - path, + apiPath, headers, params, responseType = classOf(), @@ -186,6 +186,69 @@ class Account : Service { nestedType = classOf(), ) + /** + * List Identities + * + * Get the list of identities for the currently logged in user. + * + * @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, provider, providerUid, providerEmail, providerAccessTokenExpiry + * @return [io.appwrite.models.IdentityList] + */ + @JvmOverloads + suspend fun listIdentities( + queries: String? = null, + ): io.appwrite.models.IdentityList { + val apiPath = "/account/identities" + + val params = mutableMapOf( + "queries" to queries, + ) + val headers = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.IdentityList = { + io.appwrite.models.IdentityList.from(map = it as Map) + } + return client.call( + "GET", + apiPath, + headers, + params, + responseType = io.appwrite.models.IdentityList::class.java, + converter, + ) + } + + + /** + * Delete Identity + * + * Delete an identity by its unique ID. + * + * @param identityId Identity ID. + * @return [Any] + */ + suspend fun deleteIdentity( + identityId: String, + ): Any { + val apiPath = "/account/identities/{identityId}" + .replace("{identityId}", identityId) + + val params = mutableMapOf( + ) + val headers = mutableMapOf( + "content-type" to "application/json", + ) + return client.call( + "DELETE", + apiPath, + headers, + params, + responseType = Any::class.java, + ) + } + + /** * Create JWT * @@ -195,7 +258,7 @@ class Account : Service { */ suspend fun createJWT( ): io.appwrite.models.Jwt { - val path = "/account/jwt" + val apiPath = "/account/jwt" val params = mutableMapOf( ) @@ -207,7 +270,7 @@ class Account : Service { } return client.call( "POST", - path, + apiPath, headers, params, responseType = io.appwrite.models.Jwt::class.java, @@ -219,7 +282,7 @@ class Account : Service { /** * List Logs * - * Get currently logged in user list of latest security activity logs. Each log returns user IP address, location and date and time of log. + * Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log. * * @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset * @return [io.appwrite.models.LogList] @@ -228,7 +291,7 @@ class Account : Service { suspend fun listLogs( queries: List? = null, ): io.appwrite.models.LogList { - val path = "/account/logs" + val apiPath = "/account/logs" val params = mutableMapOf( "queries" to queries, @@ -241,7 +304,7 @@ class Account : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = io.appwrite.models.LogList::class.java, @@ -262,7 +325,7 @@ class Account : Service { name: String, nestedType: Class, ): io.appwrite.models.User { - val path = "/account/name" + val apiPath = "/account/name" val params = mutableMapOf( "name" to name, @@ -275,7 +338,7 @@ class Account : Service { } return client.call( "PATCH", - path, + apiPath, headers, params, responseType = classOf(), @@ -314,7 +377,7 @@ class Account : Service { oldPassword: String? = null, nestedType: Class, ): io.appwrite.models.User { - val path = "/account/password" + val apiPath = "/account/password" val params = mutableMapOf( "password" to password, @@ -328,7 +391,7 @@ class Account : Service { } return client.call( "PATCH", - path, + apiPath, headers, params, responseType = classOf(), @@ -370,7 +433,7 @@ class Account : Service { password: String, nestedType: Class, ): io.appwrite.models.User { - val path = "/account/phone" + val apiPath = "/account/phone" val params = mutableMapOf( "phone" to phone, @@ -384,7 +447,7 @@ class Account : Service { } return client.call( "PATCH", - path, + apiPath, headers, params, responseType = classOf(), @@ -414,14 +477,14 @@ class Account : Service { /** * Get Account Preferences * - * Get currently logged in user preferences as a key-value object. + * Get the preferences as a key-value object for the currently logged in user. * * @return [io.appwrite.models.Preferences] */ suspend fun getPrefs( nestedType: Class, ): io.appwrite.models.Preferences { - val path = "/account/prefs" + val apiPath = "/account/prefs" val params = mutableMapOf( ) @@ -433,7 +496,7 @@ class Account : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = classOf(), @@ -444,7 +507,7 @@ class Account : Service { /** * Get Account Preferences * - * Get currently logged in user preferences as a key-value object. + * Get the preferences as a key-value object for the currently logged in user. * * @return [io.appwrite.models.Preferences] */ @@ -466,7 +529,7 @@ class Account : Service { prefs: Any, nestedType: Class, ): io.appwrite.models.User { - val path = "/account/prefs" + val apiPath = "/account/prefs" val params = mutableMapOf( "prefs" to prefs, @@ -479,7 +542,7 @@ class Account : Service { } return client.call( "PATCH", - path, + apiPath, headers, params, responseType = classOf(), @@ -516,7 +579,7 @@ class Account : Service { email: String, url: String, ): io.appwrite.models.Token { - val path = "/account/recovery" + val apiPath = "/account/recovery" val params = mutableMapOf( "email" to email, @@ -530,7 +593,7 @@ class Account : Service { } return client.call( "POST", - path, + apiPath, headers, params, responseType = io.appwrite.models.Token::class.java, @@ -556,7 +619,7 @@ class Account : Service { password: String, passwordAgain: String, ): io.appwrite.models.Token { - val path = "/account/recovery" + val apiPath = "/account/recovery" val params = mutableMapOf( "userId" to userId, @@ -572,7 +635,7 @@ class Account : Service { } return client.call( "PUT", - path, + apiPath, headers, params, responseType = io.appwrite.models.Token::class.java, @@ -584,13 +647,13 @@ class Account : Service { /** * List Sessions * - * Get currently logged in user list of active sessions across different devices. + * Get the list of active sessions across different devices for the currently logged in user. * * @return [io.appwrite.models.SessionList] */ suspend fun listSessions( ): io.appwrite.models.SessionList { - val path = "/account/sessions" + val apiPath = "/account/sessions" val params = mutableMapOf( ) @@ -602,7 +665,7 @@ class Account : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = io.appwrite.models.SessionList::class.java, @@ -620,7 +683,7 @@ class Account : Service { */ suspend fun deleteSessions( ): Any { - val path = "/account/sessions" + val apiPath = "/account/sessions" val params = mutableMapOf( ) @@ -629,7 +692,7 @@ class Account : Service { ) return client.call( "DELETE", - path, + apiPath, headers, params, responseType = Any::class.java, @@ -646,7 +709,7 @@ class Account : Service { */ suspend fun createAnonymousSession( ): io.appwrite.models.Session { - val path = "/account/sessions/anonymous" + val apiPath = "/account/sessions/anonymous" val params = mutableMapOf( ) @@ -658,7 +721,7 @@ class Account : Service { } return client.call( "POST", - path, + apiPath, headers, params, responseType = io.appwrite.models.Session::class.java, @@ -680,7 +743,7 @@ class Account : Service { email: String, password: String, ): io.appwrite.models.Session { - val path = "/account/sessions/email" + val apiPath = "/account/sessions/email" val params = mutableMapOf( "email" to email, @@ -694,7 +757,7 @@ class Account : Service { } return client.call( "POST", - path, + apiPath, headers, params, responseType = io.appwrite.models.Session::class.java, @@ -706,7 +769,7 @@ class Account : Service { /** * Create Magic URL session * - * Sends the user an email with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [PUT /account/sessions/magic-url](/docs/client/account#accountUpdateMagicURLSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appwrite instance by default.A user is limited to 10 active sessions at a time by default. [Learn more about session limits](/docs/authentication-security#limits). + * Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [PUT /account/sessions/magic-url](/docs/client/account#accountUpdateMagicURLSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appwrite instance by default.A user is limited to 10 active sessions at a time by default. [Learn more about session limits](/docs/authentication-security#limits). * * @param userId Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. * @param email User email. @@ -719,7 +782,7 @@ class Account : Service { email: String, url: String? = null, ): io.appwrite.models.Token { - val path = "/account/sessions/magic-url" + val apiPath = "/account/sessions/magic-url" val params = mutableMapOf( "userId" to userId, @@ -734,7 +797,7 @@ class Account : Service { } return client.call( "POST", - path, + apiPath, headers, params, responseType = io.appwrite.models.Token::class.java, @@ -756,7 +819,7 @@ class Account : Service { userId: String, secret: String, ): io.appwrite.models.Session { - val path = "/account/sessions/magic-url" + val apiPath = "/account/sessions/magic-url" val params = mutableMapOf( "userId" to userId, @@ -770,7 +833,7 @@ class Account : Service { } return client.call( "PUT", - path, + apiPath, headers, params, responseType = io.appwrite.models.Session::class.java, @@ -784,9 +847,9 @@ class Account : Service { * * Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user.A user is limited to 10 active sessions at a time by default. [Learn more about session limits](/docs/authentication-security#limits). * - * @param provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoom. - * @param success URL to redirect back to your app after a successful login attempt. 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 failure URL to redirect back to your app after a failed login attempt. 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 provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoom. + * @param success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. + * @param failure URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param scopes A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. */ @JvmOverloads @@ -797,7 +860,7 @@ class Account : Service { failure: String? = null, scopes: List? = null, ) { - val path = "/account/sessions/oauth2/{provider}" + val apiPath = "/account/sessions/oauth2/{provider}" .replace("{provider}", provider) val params = mutableMapOf( @@ -821,7 +884,7 @@ class Account : Service { } } - val url = Uri.parse("${client.endPoint}${path}?${query.joinToString("&")}") + val url = Uri.parse("${client.endPoint}${apiPath}?${query.joinToString("&")}") val callbackUrlScheme = "appwrite-callback-${client.config["project"]}" WebAuthComponent.authenticate(activity, url, callbackUrlScheme) { @@ -864,7 +927,7 @@ class Account : Service { userId: String, phone: String, ): io.appwrite.models.Token { - val path = "/account/sessions/phone" + val apiPath = "/account/sessions/phone" val params = mutableMapOf( "userId" to userId, @@ -878,7 +941,7 @@ class Account : Service { } return client.call( "POST", - path, + apiPath, headers, params, responseType = io.appwrite.models.Token::class.java, @@ -900,7 +963,7 @@ class Account : Service { userId: String, secret: String, ): io.appwrite.models.Session { - val path = "/account/sessions/phone" + val apiPath = "/account/sessions/phone" val params = mutableMapOf( "userId" to userId, @@ -914,7 +977,7 @@ class Account : Service { } return client.call( "PUT", - path, + apiPath, headers, params, responseType = io.appwrite.models.Session::class.java, @@ -934,7 +997,7 @@ class Account : Service { suspend fun getSession( sessionId: String, ): io.appwrite.models.Session { - val path = "/account/sessions/{sessionId}" + val apiPath = "/account/sessions/{sessionId}" .replace("{sessionId}", sessionId) val params = mutableMapOf( @@ -947,7 +1010,7 @@ class Account : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = io.appwrite.models.Session::class.java, @@ -967,7 +1030,7 @@ class Account : Service { suspend fun updateSession( sessionId: String, ): io.appwrite.models.Session { - val path = "/account/sessions/{sessionId}" + val apiPath = "/account/sessions/{sessionId}" .replace("{sessionId}", sessionId) val params = mutableMapOf( @@ -980,7 +1043,7 @@ class Account : Service { } return client.call( "PATCH", - path, + apiPath, headers, params, responseType = io.appwrite.models.Session::class.java, @@ -992,7 +1055,7 @@ class Account : Service { /** * Delete Session * - * Use this endpoint to log out the currently logged in user from all their account sessions across all of their different devices. When using the Session ID argument, only the unique session ID provided is deleted. + * Logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use [Delete Sessions](/docs/client/account#accountDeleteSessions) instead. * * @param sessionId Session ID. Use the string 'current' to delete the current device session. * @return [Any] @@ -1000,7 +1063,7 @@ class Account : Service { suspend fun deleteSession( sessionId: String, ): Any { - val path = "/account/sessions/{sessionId}" + val apiPath = "/account/sessions/{sessionId}" .replace("{sessionId}", sessionId) val params = mutableMapOf( @@ -1010,7 +1073,7 @@ class Account : Service { ) return client.call( "DELETE", - path, + apiPath, headers, params, responseType = Any::class.java, @@ -1028,7 +1091,7 @@ class Account : Service { suspend fun updateStatus( nestedType: Class, ): io.appwrite.models.User { - val path = "/account/status" + val apiPath = "/account/status" val params = mutableMapOf( ) @@ -1040,7 +1103,7 @@ class Account : Service { } return client.call( "PATCH", - path, + apiPath, headers, params, responseType = classOf(), @@ -1072,7 +1135,7 @@ class Account : Service { suspend fun createVerification( url: String, ): io.appwrite.models.Token { - val path = "/account/verification" + val apiPath = "/account/verification" val params = mutableMapOf( "url" to url, @@ -1085,7 +1148,7 @@ class Account : Service { } return client.call( "POST", - path, + apiPath, headers, params, responseType = io.appwrite.models.Token::class.java, @@ -1107,7 +1170,7 @@ class Account : Service { userId: String, secret: String, ): io.appwrite.models.Token { - val path = "/account/verification" + val apiPath = "/account/verification" val params = mutableMapOf( "userId" to userId, @@ -1121,7 +1184,7 @@ class Account : Service { } return client.call( "PUT", - path, + apiPath, headers, params, responseType = io.appwrite.models.Token::class.java, @@ -1139,7 +1202,7 @@ class Account : Service { */ suspend fun createPhoneVerification( ): io.appwrite.models.Token { - val path = "/account/verification/phone" + val apiPath = "/account/verification/phone" val params = mutableMapOf( ) @@ -1151,7 +1214,7 @@ class Account : Service { } return client.call( "POST", - path, + apiPath, headers, params, responseType = io.appwrite.models.Token::class.java, @@ -1173,7 +1236,7 @@ class Account : Service { userId: String, secret: String, ): io.appwrite.models.Token { - val path = "/account/verification/phone" + val apiPath = "/account/verification/phone" val params = mutableMapOf( "userId" to userId, @@ -1187,7 +1250,7 @@ class Account : Service { } return client.call( "PUT", - path, + apiPath, headers, params, responseType = io.appwrite.models.Token::class.java, diff --git a/library/src/main/java/io/appwrite/services/Assistant.kt b/library/src/main/java/io/appwrite/services/Assistant.kt new file mode 100644 index 0000000..c38a2eb --- /dev/null +++ b/library/src/main/java/io/appwrite/services/Assistant.kt @@ -0,0 +1,47 @@ +package io.appwrite.services + +import android.net.Uri +import io.appwrite.Client +import io.appwrite.models.* +import io.appwrite.exceptions.AppwriteException +import io.appwrite.extensions.classOf +import okhttp3.Cookie +import java.io.File + +/** + * +**/ +class Assistant : Service { + + public constructor (client: Client) : super(client) { } + + /** + * Ask Query + * + * + * + * @param prompt Prompt. A string containing questions asked to the AI assistant. + * @return [Any] + */ + suspend fun chat( + prompt: String, + ): Any { + val apiPath = "/console/assistant" + + val params = mutableMapOf( + "prompt" to prompt, + ) + val headers = mutableMapOf( + "content-type" to "application/json", + ) + return client.call( + "POST", + apiPath, + headers, + params, + responseType = Any::class.java, + ) + } + + +} \ 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 69f158b..53277d8 100644 --- a/library/src/main/java/io/appwrite/services/Avatars.kt +++ b/library/src/main/java/io/appwrite/services/Avatars.kt @@ -35,7 +35,7 @@ class Avatars : Service { height: Long? = null, quality: Long? = null, ): ByteArray { - val path = "/avatars/browsers/{code}" + val apiPath = "/avatars/browsers/{code}" .replace("{code}", code) val params = mutableMapOf( @@ -46,7 +46,7 @@ class Avatars : Service { ) return client.call( "GET", - path, + apiPath, params = params, responseType = ByteArray::class.java ) @@ -71,7 +71,7 @@ class Avatars : Service { height: Long? = null, quality: Long? = null, ): ByteArray { - val path = "/avatars/credit-cards/{code}" + val apiPath = "/avatars/credit-cards/{code}" .replace("{code}", code) val params = mutableMapOf( @@ -82,7 +82,7 @@ class Avatars : Service { ) return client.call( "GET", - path, + apiPath, params = params, responseType = ByteArray::class.java ) @@ -100,7 +100,7 @@ class Avatars : Service { suspend fun getFavicon( url: String, ): ByteArray { - val path = "/avatars/favicon" + val apiPath = "/avatars/favicon" val params = mutableMapOf( "url" to url, @@ -108,7 +108,7 @@ class Avatars : Service { ) return client.call( "GET", - path, + apiPath, params = params, responseType = ByteArray::class.java ) @@ -133,7 +133,7 @@ class Avatars : Service { height: Long? = null, quality: Long? = null, ): ByteArray { - val path = "/avatars/flags/{code}" + val apiPath = "/avatars/flags/{code}" .replace("{code}", code) val params = mutableMapOf( @@ -144,7 +144,7 @@ class Avatars : Service { ) return client.call( "GET", - path, + apiPath, params = params, responseType = ByteArray::class.java ) @@ -167,7 +167,7 @@ class Avatars : Service { width: Long? = null, height: Long? = null, ): ByteArray { - val path = "/avatars/image" + val apiPath = "/avatars/image" val params = mutableMapOf( "url" to url, @@ -177,7 +177,7 @@ class Avatars : Service { ) return client.call( "GET", - path, + apiPath, params = params, responseType = ByteArray::class.java ) @@ -202,7 +202,7 @@ class Avatars : Service { height: Long? = null, background: String? = null, ): ByteArray { - val path = "/avatars/initials" + val apiPath = "/avatars/initials" val params = mutableMapOf( "name" to name, @@ -213,7 +213,7 @@ class Avatars : Service { ) return client.call( "GET", - path, + apiPath, params = params, responseType = ByteArray::class.java ) @@ -238,7 +238,7 @@ class Avatars : Service { margin: Long? = null, download: Boolean? = null, ): ByteArray { - val path = "/avatars/qr" + val apiPath = "/avatars/qr" val params = mutableMapOf( "text" to text, @@ -249,7 +249,7 @@ class Avatars : Service { ) return client.call( "GET", - path, + apiPath, params = params, responseType = ByteArray::class.java ) diff --git a/library/src/main/java/io/appwrite/services/Databases.kt b/library/src/main/java/io/appwrite/services/Databases.kt index 0744693..9822e1c 100644 --- a/library/src/main/java/io/appwrite/services/Databases.kt +++ b/library/src/main/java/io/appwrite/services/Databases.kt @@ -32,7 +32,7 @@ class Databases : Service { queries: List? = null, nestedType: Class, ): io.appwrite.models.DocumentList { - val path = "/databases/{databaseId}/collections/{collectionId}/documents" + val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents" .replace("{databaseId}", databaseId) .replace("{collectionId}", collectionId) @@ -47,7 +47,7 @@ class Databases : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = classOf(), @@ -99,7 +99,7 @@ class Databases : Service { permissions: List? = null, nestedType: Class, ): io.appwrite.models.Document { - val path = "/databases/{databaseId}/collections/{collectionId}/documents" + val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents" .replace("{databaseId}", databaseId) .replace("{collectionId}", collectionId) @@ -116,7 +116,7 @@ class Databases : Service { } return client.call( "POST", - path, + apiPath, headers, params, responseType = classOf(), @@ -172,7 +172,7 @@ class Databases : Service { queries: List? = null, nestedType: Class, ): io.appwrite.models.Document { - val path = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" + val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" .replace("{databaseId}", databaseId) .replace("{collectionId}", collectionId) .replace("{documentId}", documentId) @@ -188,7 +188,7 @@ class Databases : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = classOf(), @@ -243,7 +243,7 @@ class Databases : Service { permissions: List? = null, nestedType: Class, ): io.appwrite.models.Document { - val path = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" + val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" .replace("{databaseId}", databaseId) .replace("{collectionId}", collectionId) .replace("{documentId}", documentId) @@ -260,7 +260,7 @@ class Databases : Service { } return client.call( "PATCH", - path, + apiPath, headers, params, responseType = classOf(), @@ -312,7 +312,7 @@ class Databases : Service { collectionId: String, documentId: String, ): Any { - val path = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" + val apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" .replace("{databaseId}", databaseId) .replace("{collectionId}", collectionId) .replace("{documentId}", documentId) @@ -324,7 +324,7 @@ class Databases : Service { ) return client.call( "DELETE", - path, + apiPath, headers, params, responseType = Any::class.java, diff --git a/library/src/main/java/io/appwrite/services/Functions.kt b/library/src/main/java/io/appwrite/services/Functions.kt index ffa350a..eadcf0d 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 : Service { * 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, statusCode, 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 * @param search Search term to filter your list results. Max length: 256 chars. * @return [io.appwrite.models.ExecutionList] */ @@ -31,7 +31,7 @@ class Functions : Service { queries: List? = null, search: String? = null, ): io.appwrite.models.ExecutionList { - val path = "/functions/{functionId}/executions" + val apiPath = "/functions/{functionId}/executions" .replace("{functionId}", functionId) val params = mutableMapOf( @@ -46,7 +46,7 @@ class Functions : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = io.appwrite.models.ExecutionList::class.java, @@ -61,22 +61,31 @@ class Functions : Service { * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. * * @param functionId Function ID. - * @param data String of custom data to send to function. + * @param body HTTP body of execution. Default value is empty string. * @param async Execute code in the background. Default value is false. + * @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. * @return [io.appwrite.models.Execution] */ @JvmOverloads suspend fun createExecution( functionId: String, - data: String? = null, + body: String? = null, async: Boolean? = null, + path: String? = null, + method: String? = null, + headers: Any? = null, ): io.appwrite.models.Execution { - val path = "/functions/{functionId}/executions" + val apiPath = "/functions/{functionId}/executions" .replace("{functionId}", functionId) val params = mutableMapOf( - "data" to data, + "body" to body, "async" to async, + "path" to path, + "method" to method, + "headers" to headers, ) val headers = mutableMapOf( "content-type" to "application/json", @@ -86,7 +95,7 @@ class Functions : Service { } return client.call( "POST", - path, + apiPath, headers, params, responseType = io.appwrite.models.Execution::class.java, @@ -108,7 +117,7 @@ class Functions : Service { functionId: String, executionId: String, ): io.appwrite.models.Execution { - val path = "/functions/{functionId}/executions/{executionId}" + val apiPath = "/functions/{functionId}/executions/{executionId}" .replace("{functionId}", functionId) .replace("{executionId}", executionId) @@ -122,7 +131,7 @@ class Functions : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = io.appwrite.models.Execution::class.java, diff --git a/library/src/main/java/io/appwrite/services/Graphql.kt b/library/src/main/java/io/appwrite/services/Graphql.kt index d661ccf..2d9bbbd 100644 --- a/library/src/main/java/io/appwrite/services/Graphql.kt +++ b/library/src/main/java/io/appwrite/services/Graphql.kt @@ -26,7 +26,7 @@ class Graphql : Service { suspend fun query( query: Any, ): Any { - val path = "/graphql" + val apiPath = "/graphql" val params = mutableMapOf( "query" to query, @@ -40,7 +40,7 @@ class Graphql : Service { } return client.call( "POST", - path, + apiPath, headers, params, responseType = Any::class.java, @@ -60,7 +60,7 @@ class Graphql : Service { suspend fun mutation( query: Any, ): Any { - val path = "/graphql/mutation" + val apiPath = "/graphql/mutation" val params = mutableMapOf( "query" to query, @@ -74,7 +74,7 @@ class Graphql : Service { } return client.call( "POST", - path, + apiPath, headers, params, responseType = Any::class.java, diff --git a/library/src/main/java/io/appwrite/services/Locale.kt b/library/src/main/java/io/appwrite/services/Locale.kt index 5c9cc95..b0e93a6 100644 --- a/library/src/main/java/io/appwrite/services/Locale.kt +++ b/library/src/main/java/io/appwrite/services/Locale.kt @@ -24,7 +24,7 @@ class Locale : Service { */ suspend fun get( ): io.appwrite.models.Locale { - val path = "/locale" + val apiPath = "/locale" val params = mutableMapOf( ) @@ -36,7 +36,7 @@ class Locale : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = io.appwrite.models.Locale::class.java, @@ -45,6 +45,36 @@ class Locale : Service { } + /** + * List Locale Codes + * + * List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). + * + * @return [io.appwrite.models.LocaleCodeList] + */ + suspend fun listCodes( + ): io.appwrite.models.LocaleCodeList { + val apiPath = "/locale/codes" + + val params = mutableMapOf( + ) + val headers = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.LocaleCodeList = { + io.appwrite.models.LocaleCodeList.from(map = it as Map) + } + return client.call( + "GET", + apiPath, + headers, + params, + responseType = io.appwrite.models.LocaleCodeList::class.java, + converter, + ) + } + + /** * List Continents * @@ -54,7 +84,7 @@ class Locale : Service { */ suspend fun listContinents( ): io.appwrite.models.ContinentList { - val path = "/locale/continents" + val apiPath = "/locale/continents" val params = mutableMapOf( ) @@ -66,7 +96,7 @@ class Locale : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = io.appwrite.models.ContinentList::class.java, @@ -84,7 +114,7 @@ class Locale : Service { */ suspend fun listCountries( ): io.appwrite.models.CountryList { - val path = "/locale/countries" + val apiPath = "/locale/countries" val params = mutableMapOf( ) @@ -96,7 +126,7 @@ class Locale : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = io.appwrite.models.CountryList::class.java, @@ -114,7 +144,7 @@ class Locale : Service { */ suspend fun listCountriesEU( ): io.appwrite.models.CountryList { - val path = "/locale/countries/eu" + val apiPath = "/locale/countries/eu" val params = mutableMapOf( ) @@ -126,7 +156,7 @@ class Locale : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = io.appwrite.models.CountryList::class.java, @@ -144,7 +174,7 @@ class Locale : Service { */ suspend fun listCountriesPhones( ): io.appwrite.models.PhoneList { - val path = "/locale/countries/phones" + val apiPath = "/locale/countries/phones" val params = mutableMapOf( ) @@ -156,7 +186,7 @@ class Locale : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = io.appwrite.models.PhoneList::class.java, @@ -174,7 +204,7 @@ class Locale : Service { */ suspend fun listCurrencies( ): io.appwrite.models.CurrencyList { - val path = "/locale/currencies" + val apiPath = "/locale/currencies" val params = mutableMapOf( ) @@ -186,7 +216,7 @@ class Locale : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = io.appwrite.models.CurrencyList::class.java, @@ -204,7 +234,7 @@ class Locale : Service { */ suspend fun listLanguages( ): io.appwrite.models.LanguageList { - val path = "/locale/languages" + val apiPath = "/locale/languages" val params = mutableMapOf( ) @@ -216,7 +246,7 @@ class Locale : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = io.appwrite.models.LanguageList::class.java, diff --git a/library/src/main/java/io/appwrite/services/Migrations.kt b/library/src/main/java/io/appwrite/services/Migrations.kt new file mode 100644 index 0000000..4fd3163 --- /dev/null +++ b/library/src/main/java/io/appwrite/services/Migrations.kt @@ -0,0 +1,74 @@ +package io.appwrite.services + +import android.net.Uri +import io.appwrite.Client +import io.appwrite.models.* +import io.appwrite.exceptions.AppwriteException +import io.appwrite.extensions.classOf +import okhttp3.Cookie +import java.io.File + +/** + * The Migrations service allows you to migrate third-party data to your Appwrite project. +**/ +class Migrations : Service { + + public constructor (client: Client) : super(client) { } + + /** + * Revoke Appwrite's authorization to access Firebase Projects + * + * + * + * @return [Any] + */ + suspend fun deleteFirebaseAuth( + ): Any { + val apiPath = "/migrations/firebase/deauthorize" + + val params = mutableMapOf( + ) + val headers = mutableMapOf( + "content-type" to "application/json", + ) + return client.call( + "GET", + apiPath, + headers, + params, + responseType = Any::class.java, + ) + } + + + /** + * List Firebase Projects + * + * + * + * @return [io.appwrite.models.FirebaseProjectList] + */ + suspend fun listFirebaseProjects( + ): io.appwrite.models.FirebaseProjectList { + val apiPath = "/migrations/firebase/projects" + + val params = mutableMapOf( + ) + val headers = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.FirebaseProjectList = { + io.appwrite.models.FirebaseProjectList.from(map = it as Map) + } + return client.call( + "GET", + apiPath, + headers, + params, + responseType = io.appwrite.models.FirebaseProjectList::class.java, + converter, + ) + } + + +} \ 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 1dc5617..bb5a59e 100644 --- a/library/src/main/java/io/appwrite/services/Storage.kt +++ b/library/src/main/java/io/appwrite/services/Storage.kt @@ -33,7 +33,7 @@ class Storage : Service { queries: List? = null, search: String? = null, ): io.appwrite.models.FileList { - val path = "/storage/buckets/{bucketId}/files" + val apiPath = "/storage/buckets/{bucketId}/files" .replace("{bucketId}", bucketId) val params = mutableMapOf( @@ -48,7 +48,7 @@ class Storage : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = io.appwrite.models.FileList::class.java, @@ -76,7 +76,7 @@ class Storage : Service { permissions: List? = null, onProgress: ((UploadProgress) -> Unit)? = null ): io.appwrite.models.File { - val path = "/storage/buckets/{bucketId}/files" + val apiPath = "/storage/buckets/{bucketId}/files" .replace("{bucketId}", bucketId) val params = mutableMapOf( @@ -93,7 +93,7 @@ class Storage : Service { val idParamName: String? = "fileId" val paramName = "file" return client.chunkedUpload( - path, + apiPath, headers, params, responseType = io.appwrite.models.File::class.java, @@ -118,7 +118,7 @@ class Storage : Service { bucketId: String, fileId: String, ): io.appwrite.models.File { - val path = "/storage/buckets/{bucketId}/files/{fileId}" + val apiPath = "/storage/buckets/{bucketId}/files/{fileId}" .replace("{bucketId}", bucketId) .replace("{fileId}", fileId) @@ -132,7 +132,7 @@ class Storage : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = io.appwrite.models.File::class.java, @@ -148,6 +148,7 @@ class Storage : Service { * * @param bucketId Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket). * @param fileId File unique ID. + * @param name Name of the file * @param permissions An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](/docs/permissions). * @return [io.appwrite.models.File] */ @@ -155,13 +156,15 @@ class Storage : Service { suspend fun updateFile( bucketId: String, fileId: String, + name: String? = null, permissions: List? = null, ): io.appwrite.models.File { - val path = "/storage/buckets/{bucketId}/files/{fileId}" + val apiPath = "/storage/buckets/{bucketId}/files/{fileId}" .replace("{bucketId}", bucketId) .replace("{fileId}", fileId) val params = mutableMapOf( + "name" to name, "permissions" to permissions, ) val headers = mutableMapOf( @@ -172,7 +175,7 @@ class Storage : Service { } return client.call( "PUT", - path, + apiPath, headers, params, responseType = io.appwrite.models.File::class.java, @@ -194,7 +197,7 @@ class Storage : Service { bucketId: String, fileId: String, ): Any { - val path = "/storage/buckets/{bucketId}/files/{fileId}" + val apiPath = "/storage/buckets/{bucketId}/files/{fileId}" .replace("{bucketId}", bucketId) .replace("{fileId}", fileId) @@ -205,7 +208,7 @@ class Storage : Service { ) return client.call( "DELETE", - path, + apiPath, headers, params, responseType = Any::class.java, @@ -226,7 +229,7 @@ class Storage : Service { bucketId: String, fileId: String, ): ByteArray { - val path = "/storage/buckets/{bucketId}/files/{fileId}/download" + val apiPath = "/storage/buckets/{bucketId}/files/{fileId}/download" .replace("{bucketId}", bucketId) .replace("{fileId}", fileId) @@ -235,7 +238,7 @@ class Storage : Service { ) return client.call( "GET", - path, + apiPath, params = params, responseType = ByteArray::class.java ) @@ -278,7 +281,7 @@ class Storage : Service { background: String? = null, output: String? = null, ): ByteArray { - val path = "/storage/buckets/{bucketId}/files/{fileId}/preview" + val apiPath = "/storage/buckets/{bucketId}/files/{fileId}/preview" .replace("{bucketId}", bucketId) .replace("{fileId}", fileId) @@ -298,7 +301,7 @@ class Storage : Service { ) return client.call( "GET", - path, + apiPath, params = params, responseType = ByteArray::class.java ) @@ -318,7 +321,7 @@ class Storage : Service { bucketId: String, fileId: String, ): ByteArray { - val path = "/storage/buckets/{bucketId}/files/{fileId}/view" + val apiPath = "/storage/buckets/{bucketId}/files/{fileId}/view" .replace("{bucketId}", bucketId) .replace("{fileId}", fileId) @@ -327,7 +330,7 @@ class Storage : Service { ) return client.call( "GET", - path, + apiPath, params = params, responseType = ByteArray::class.java ) diff --git a/library/src/main/java/io/appwrite/services/Teams.kt b/library/src/main/java/io/appwrite/services/Teams.kt index 333f438..a64a152 100644 --- a/library/src/main/java/io/appwrite/services/Teams.kt +++ b/library/src/main/java/io/appwrite/services/Teams.kt @@ -30,7 +30,7 @@ class Teams : Service { search: String? = null, nestedType: Class, ): io.appwrite.models.TeamList { - val path = "/teams" + val apiPath = "/teams" val params = mutableMapOf( "queries" to queries, @@ -44,7 +44,7 @@ class Teams : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = classOf(), @@ -89,7 +89,7 @@ class Teams : Service { roles: List? = null, nestedType: Class, ): io.appwrite.models.Team { - val path = "/teams" + val apiPath = "/teams" val params = mutableMapOf( "teamId" to teamId, @@ -104,7 +104,7 @@ class Teams : Service { } return client.call( "POST", - path, + apiPath, headers, params, responseType = classOf(), @@ -147,7 +147,7 @@ class Teams : Service { teamId: String, nestedType: Class, ): io.appwrite.models.Team { - val path = "/teams/{teamId}" + val apiPath = "/teams/{teamId}" .replace("{teamId}", teamId) val params = mutableMapOf( @@ -160,7 +160,7 @@ class Teams : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = classOf(), @@ -198,7 +198,7 @@ class Teams : Service { name: String, nestedType: Class, ): io.appwrite.models.Team { - val path = "/teams/{teamId}" + val apiPath = "/teams/{teamId}" .replace("{teamId}", teamId) val params = mutableMapOf( @@ -212,7 +212,7 @@ class Teams : Service { } return client.call( "PUT", - path, + apiPath, headers, params, responseType = classOf(), @@ -250,7 +250,7 @@ class Teams : Service { suspend fun delete( teamId: String, ): Any { - val path = "/teams/{teamId}" + val apiPath = "/teams/{teamId}" .replace("{teamId}", teamId) val params = mutableMapOf( @@ -260,7 +260,7 @@ class Teams : Service { ) return client.call( "DELETE", - path, + apiPath, headers, params, responseType = Any::class.java, @@ -284,7 +284,7 @@ class Teams : Service { queries: List? = null, search: String? = null, ): io.appwrite.models.MembershipList { - val path = "/teams/{teamId}/memberships" + val apiPath = "/teams/{teamId}/memberships" .replace("{teamId}", teamId) val params = mutableMapOf( @@ -299,7 +299,7 @@ class Teams : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = io.appwrite.models.MembershipList::class.java, @@ -332,7 +332,7 @@ class Teams : Service { phone: String? = null, name: String? = null, ): io.appwrite.models.Membership { - val path = "/teams/{teamId}/memberships" + val apiPath = "/teams/{teamId}/memberships" .replace("{teamId}", teamId) val params = mutableMapOf( @@ -351,7 +351,7 @@ class Teams : Service { } return client.call( "POST", - path, + apiPath, headers, params, responseType = io.appwrite.models.Membership::class.java, @@ -373,7 +373,7 @@ class Teams : Service { teamId: String, membershipId: String, ): io.appwrite.models.Membership { - val path = "/teams/{teamId}/memberships/{membershipId}" + val apiPath = "/teams/{teamId}/memberships/{membershipId}" .replace("{teamId}", teamId) .replace("{membershipId}", membershipId) @@ -387,7 +387,7 @@ class Teams : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = io.appwrite.models.Membership::class.java, @@ -397,7 +397,7 @@ class Teams : Service { /** - * Update Membership Roles + * Update Membership * * Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](/docs/permissions). * @@ -406,12 +406,12 @@ class Teams : Service { * @param roles An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. * @return [io.appwrite.models.Membership] */ - suspend fun updateMembershipRoles( + suspend fun updateMembership( teamId: String, membershipId: String, roles: List, ): io.appwrite.models.Membership { - val path = "/teams/{teamId}/memberships/{membershipId}" + val apiPath = "/teams/{teamId}/memberships/{membershipId}" .replace("{teamId}", teamId) .replace("{membershipId}", membershipId) @@ -426,7 +426,7 @@ class Teams : Service { } return client.call( "PATCH", - path, + apiPath, headers, params, responseType = io.appwrite.models.Membership::class.java, @@ -448,7 +448,7 @@ class Teams : Service { teamId: String, membershipId: String, ): Any { - val path = "/teams/{teamId}/memberships/{membershipId}" + val apiPath = "/teams/{teamId}/memberships/{membershipId}" .replace("{teamId}", teamId) .replace("{membershipId}", membershipId) @@ -459,7 +459,7 @@ class Teams : Service { ) return client.call( "DELETE", - path, + apiPath, headers, params, responseType = Any::class.java, @@ -484,7 +484,7 @@ class Teams : Service { userId: String, secret: String, ): io.appwrite.models.Membership { - val path = "/teams/{teamId}/memberships/{membershipId}/status" + val apiPath = "/teams/{teamId}/memberships/{membershipId}/status" .replace("{teamId}", teamId) .replace("{membershipId}", membershipId) @@ -500,7 +500,7 @@ class Teams : Service { } return client.call( "PATCH", - path, + apiPath, headers, params, responseType = io.appwrite.models.Membership::class.java, @@ -521,7 +521,7 @@ class Teams : Service { teamId: String, nestedType: Class, ): io.appwrite.models.Preferences { - val path = "/teams/{teamId}/prefs" + val apiPath = "/teams/{teamId}/prefs" .replace("{teamId}", teamId) val params = mutableMapOf( @@ -534,7 +534,7 @@ class Teams : Service { } return client.call( "GET", - path, + apiPath, headers, params, responseType = classOf(), @@ -572,7 +572,7 @@ class Teams : Service { prefs: Any, nestedType: Class, ): io.appwrite.models.Preferences { - val path = "/teams/{teamId}/prefs" + val apiPath = "/teams/{teamId}/prefs" .replace("{teamId}", teamId) val params = mutableMapOf( @@ -586,7 +586,7 @@ class Teams : Service { } return client.call( "PUT", - path, + apiPath, headers, params, responseType = classOf(), diff --git a/library/src/main/java/io/appwrite/services/Vcs.kt b/library/src/main/java/io/appwrite/services/Vcs.kt new file mode 100644 index 0000000..21c2b02 --- /dev/null +++ b/library/src/main/java/io/appwrite/services/Vcs.kt @@ -0,0 +1,241 @@ +package io.appwrite.services + +import android.net.Uri +import io.appwrite.Client +import io.appwrite.models.* +import io.appwrite.exceptions.AppwriteException +import io.appwrite.extensions.classOf +import okhttp3.Cookie +import java.io.File + +/** + * +**/ +class Vcs : Service { + + public constructor (client: Client) : super(client) { } + + /** + * List Repositories + * + * + * + * @param installationId Installation Id + * @param search Search term to filter your list results. Max length: 256 chars. + * @return [io.appwrite.models.ProviderRepositoryList] + */ + @JvmOverloads + suspend fun listRepositories( + installationId: String, + search: String? = null, + ): io.appwrite.models.ProviderRepositoryList { + val apiPath = "/vcs/github/installations/{installationId}/providerRepositories" + .replace("{installationId}", installationId) + + val params = mutableMapOf( + "search" to search, + ) + val headers = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ProviderRepositoryList = { + io.appwrite.models.ProviderRepositoryList.from(map = it as Map) + } + return client.call( + "GET", + apiPath, + headers, + params, + responseType = io.appwrite.models.ProviderRepositoryList::class.java, + converter, + ) + } + + + /** + * Create repository + * + * + * + * @param installationId Installation Id + * @param name Repository name (slug) + * @param private Mark repository public or private + * @return [io.appwrite.models.ProviderRepository] + */ + suspend fun createRepository( + installationId: String, + name: String, + private: Boolean, + ): io.appwrite.models.ProviderRepository { + val apiPath = "/vcs/github/installations/{installationId}/providerRepositories" + .replace("{installationId}", installationId) + + val params = mutableMapOf( + "name" to name, + "private" to private, + ) + val headers = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ProviderRepository = { + io.appwrite.models.ProviderRepository.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + headers, + params, + responseType = io.appwrite.models.ProviderRepository::class.java, + converter, + ) + } + + + /** + * Get repository + * + * + * + * @param installationId Installation Id + * @param providerRepositoryId Repository Id + * @return [io.appwrite.models.ProviderRepository] + */ + suspend fun getRepository( + installationId: String, + providerRepositoryId: String, + ): io.appwrite.models.ProviderRepository { + val apiPath = "/vcs/github/installations/{installationId}/providerRepositories/{providerRepositoryId}" + .replace("{installationId}", installationId) + .replace("{providerRepositoryId}", providerRepositoryId) + + val params = mutableMapOf( + ) + val headers = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.ProviderRepository = { + io.appwrite.models.ProviderRepository.from(map = it as Map) + } + return client.call( + "GET", + apiPath, + headers, + params, + responseType = io.appwrite.models.ProviderRepository::class.java, + converter, + ) + } + + + /** + * List Repository Branches + * + * + * + * @param installationId Installation Id + * @param providerRepositoryId Repository Id + * @return [io.appwrite.models.BranchList] + */ + suspend fun listRepositoryBranches( + installationId: String, + providerRepositoryId: String, + ): io.appwrite.models.BranchList { + val apiPath = "/vcs/github/installations/{installationId}/providerRepositories/{providerRepositoryId}/branches" + .replace("{installationId}", installationId) + .replace("{providerRepositoryId}", providerRepositoryId) + + val params = mutableMapOf( + ) + val headers = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.BranchList = { + io.appwrite.models.BranchList.from(map = it as Map) + } + return client.call( + "GET", + apiPath, + headers, + params, + responseType = io.appwrite.models.BranchList::class.java, + converter, + ) + } + + + /** + * Detect runtime settings from source code + * + * + * + * @param installationId Installation Id + * @param providerRepositoryId Repository Id + * @param providerRootDirectory Path to Root Directory + * @return [io.appwrite.models.Detection] + */ + @JvmOverloads + suspend fun createRepositoryDetection( + installationId: String, + providerRepositoryId: String, + providerRootDirectory: String? = null, + ): io.appwrite.models.Detection { + val apiPath = "/vcs/github/installations/{installationId}/providerRepositories/{providerRepositoryId}/detection" + .replace("{installationId}", installationId) + .replace("{providerRepositoryId}", providerRepositoryId) + + val params = mutableMapOf( + "providerRootDirectory" to providerRootDirectory, + ) + val headers = mutableMapOf( + "content-type" to "application/json", + ) + val converter: (Any) -> io.appwrite.models.Detection = { + io.appwrite.models.Detection.from(map = it as Map) + } + return client.call( + "POST", + apiPath, + headers, + params, + responseType = io.appwrite.models.Detection::class.java, + converter, + ) + } + + + /** + * Authorize external deployment + * + * + * + * @param installationId Installation Id + * @param repositoryId VCS Repository Id + * @param providerPullRequestId GitHub Pull Request Id + * @return [Any] + */ + suspend fun updateExternalDeployments( + installationId: String, + repositoryId: String, + providerPullRequestId: String, + ): Any { + val apiPath = "/vcs/github/installations/{installationId}/repositories/{repositoryId}" + .replace("{installationId}", installationId) + .replace("{repositoryId}", repositoryId) + + val params = mutableMapOf( + "providerPullRequestId" to providerPullRequestId, + ) + val headers = mutableMapOf( + "content-type" to "application/json", + ) + return client.call( + "PATCH", + apiPath, + headers, + params, + responseType = Any::class.java, + ) + } + + +} \ No newline at end of file