diff --git a/LICENSE.md b/LICENSE.md
index b0761cc..90528c4 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -7,6 +7,6 @@ Redistribution and use in source and binary forms, with or without modification,
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/README.md b/README.md
index 83edb8a..35f4e57 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.0.0-blue.svg?style=flat-square)
+![Version](https://img.shields.io/badge/api%20version-1.2.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.0.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-android/releases).**
+**This SDK is compatible with Appwrite server version 1.2.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-android/releases).**
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Android SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
@@ -38,7 +38,7 @@ repositories {
Next, add the dependency to your project's `build.gradle(.kts)` file:
```groovy
-implementation("io.appwrite:sdk-for-android:1.1.0")
+implementation("io.appwrite:sdk-for-android:1.2.0")
```
### Maven
@@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file:
io.appwrite
sdk-for-android
- 1.1.0
+ 1.2.0
```
diff --git a/build.gradle b/build.gradle
index 79f6b0b..d475d54 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'io.github.gradle-nexus.publish-plugin'
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
- ext.kotlin_version = "1.5.31"
+ ext.kotlin_version = "1.7.10"
version System.getenv("SDK_VERSION")
repositories {
maven { url "https://plugins.gradle.org/m2/" }
@@ -10,7 +10,7 @@ buildscript {
mavenCentral()
}
dependencies {
- classpath "com.android.tools.build:gradle:4.2.0"
+ classpath "com.android.tools.build:gradle:4.2.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'
diff --git a/docs/examples/java/account/create-anonymous-session.md b/docs/examples/java/account/create-anonymous-session.md
index b1a2a25..7d2123b 100644
--- a/docs/examples/java/account/create-anonymous-session.md
+++ b/docs/examples/java/account/create-anonymous-session.md
@@ -1,46 +1,18 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Account account = new Account(client);
-
- account.createAnonymousSession(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
+account.createAnonymousSession(new CoroutineCallback<>((result, error) -> {
+ if (error != null)
+ error.printStackTrace();
+ return;
}
-}
\ No newline at end of file
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/account/create-email-session.md b/docs/examples/java/account/create-email-session.md
index 055b828..384dbaf 100644
--- a/docs/examples/java/account/create-email-session.md
+++ b/docs/examples/java/account/create-email-session.md
@@ -1,49 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.createEmailSession(
+ "email@example.com",
+ "password"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
-
- account.createEmailSession(
- "email@example.com",
- "password"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/account/create-j-w-t.md b/docs/examples/java/account/create-j-w-t.md
index 3a97c33..86ad905 100644
--- a/docs/examples/java/account/create-j-w-t.md
+++ b/docs/examples/java/account/create-j-w-t.md
@@ -1,46 +1,18 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Account account = new Account(client);
-
- account.createJWT(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
+account.createJWT(new CoroutineCallback<>((result, error) -> {
+ if (error != null)
+ error.printStackTrace();
+ return;
}
-}
\ No newline at end of file
+
+ Log.d("Appwrite", result.toString());
+}));
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 6c9fa7c..1789eec 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
@@ -1,49 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.createMagicURLSession(
+ "[USER_ID]",
+ "email@example.com",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
-
- account.createMagicURLSession(
- "[USER_ID]",
- "email@example.com",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/account/create-o-auth2session.md b/docs/examples/java/account/create-o-auth2session.md
index e4cfb8d..a2f5d02 100644
--- a/docs/examples/java/account/create-o-auth2session.md
+++ b/docs/examples/java/account/create-o-auth2session.md
@@ -1,46 +1,21 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.createOAuth2Session(
+ "amazon",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
-
- account.createOAuth2Session(
- this,
- "amazon",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/account/create-phone-session.md b/docs/examples/java/account/create-phone-session.md
index 78be922..7c54dbd 100644
--- a/docs/examples/java/account/create-phone-session.md
+++ b/docs/examples/java/account/create-phone-session.md
@@ -1,49 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.createPhoneSession(
+ "[USER_ID]",
+ "+12065550100"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
-
- account.createPhoneSession(
- "[USER_ID]",
- ""
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/account/create-phone-verification.md b/docs/examples/java/account/create-phone-verification.md
index 401b942..f3e9526 100644
--- a/docs/examples/java/account/create-phone-verification.md
+++ b/docs/examples/java/account/create-phone-verification.md
@@ -1,46 +1,18 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Account account = new Account(client);
-
- account.createPhoneVerification(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
+account.createPhoneVerification(new CoroutineCallback<>((result, error) -> {
+ if (error != null)
+ error.printStackTrace();
+ return;
}
-}
\ No newline at end of file
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/account/create-recovery.md b/docs/examples/java/account/create-recovery.md
index 459213b..44773dd 100644
--- a/docs/examples/java/account/create-recovery.md
+++ b/docs/examples/java/account/create-recovery.md
@@ -1,49 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.createRecovery(
+ "email@example.com",
+ "https://example.com"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
-
- account.createRecovery(
- "email@example.com",
- "https://example.com"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/account/create-verification.md b/docs/examples/java/account/create-verification.md
index b8b1c20..02d2934 100644
--- a/docs/examples/java/account/create-verification.md
+++ b/docs/examples/java/account/create-verification.md
@@ -1,48 +1,21 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.createVerification(
+ "https://example.com"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
-
- account.createVerification(
- "https://example.com"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/account/create.md b/docs/examples/java/account/create.md
index 11a5168..af0965e 100644
--- a/docs/examples/java/account/create.md
+++ b/docs/examples/java/account/create.md
@@ -1,50 +1,23 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.create(
+ "[USER_ID]",
+ "email@example.com",
+ "password",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
-
- account.create(
- "[USER_ID]",
- "email@example.com",
- "password",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/account/delete-session.md b/docs/examples/java/account/delete-session.md
index b3549c7..b42b841 100644
--- a/docs/examples/java/account/delete-session.md
+++ b/docs/examples/java/account/delete-session.md
@@ -1,48 +1,21 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.deleteSession(
+ "[SESSION_ID]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
-
- account.deleteSession(
- "[SESSION_ID]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/account/delete-sessions.md b/docs/examples/java/account/delete-sessions.md
index 153c323..847c5c1 100644
--- a/docs/examples/java/account/delete-sessions.md
+++ b/docs/examples/java/account/delete-sessions.md
@@ -1,46 +1,18 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Account account = new Account(client);
-
- account.deleteSessions(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
+account.deleteSessions(new CoroutineCallback<>((result, error) -> {
+ if (error != null)
+ error.printStackTrace();
+ return;
}
-}
\ No newline at end of file
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/account/get-logs.md b/docs/examples/java/account/get-logs.md
deleted file mode 100644
index fb83c5d..0000000
--- a/docs/examples/java/account/get-logs.md
+++ /dev/null
@@ -1,47 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Account account = new Account(client);
-
- account.getLogs(
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/account/get-prefs.md b/docs/examples/java/account/get-prefs.md
index 25ab6c3..d7777d8 100644
--- a/docs/examples/java/account/get-prefs.md
+++ b/docs/examples/java/account/get-prefs.md
@@ -1,46 +1,18 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Account account = new Account(client);
-
- account.getPrefs(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
+account.getPrefs(new CoroutineCallback<>((result, error) -> {
+ if (error != null)
+ error.printStackTrace();
+ return;
}
-}
\ No newline at end of file
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/account/get-session.md b/docs/examples/java/account/get-session.md
index 8d4c95a..b7861b2 100644
--- a/docs/examples/java/account/get-session.md
+++ b/docs/examples/java/account/get-session.md
@@ -1,48 +1,21 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.getSession(
+ "[SESSION_ID]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
-
- account.getSession(
- "[SESSION_ID]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/account/get-sessions.md b/docs/examples/java/account/get-sessions.md
deleted file mode 100644
index 7afe852..0000000
--- a/docs/examples/java/account/get-sessions.md
+++ /dev/null
@@ -1,46 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Account account = new Account(client);
-
- account.getSessions(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/account/get.md b/docs/examples/java/account/get.md
index 146a5e5..1351652 100644
--- a/docs/examples/java/account/get.md
+++ b/docs/examples/java/account/get.md
@@ -1,46 +1,18 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Account account = new Account(client);
-
- account.get(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
+account.get(new CoroutineCallback<>((result, error) -> {
+ if (error != null)
+ error.printStackTrace();
+ return;
}
-}
\ No newline at end of file
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/account/list-logs.md b/docs/examples/java/account/list-logs.md
index f33c413..d073d4e 100644
--- a/docs/examples/java/account/list-logs.md
+++ b/docs/examples/java/account/list-logs.md
@@ -1,47 +1,20 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.listLogs(
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
-
- account.listLogs(
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/account/list-sessions.md b/docs/examples/java/account/list-sessions.md
index 5933f03..91888bc 100644
--- a/docs/examples/java/account/list-sessions.md
+++ b/docs/examples/java/account/list-sessions.md
@@ -1,46 +1,18 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Account account = new Account(client);
-
- account.listSessions(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
+account.listSessions(new CoroutineCallback<>((result, error) -> {
+ if (error != null)
+ error.printStackTrace();
+ return;
}
-}
\ No newline at end of file
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/account/update-email.md b/docs/examples/java/account/update-email.md
index 56a1bc0..53dd0bd 100644
--- a/docs/examples/java/account/update-email.md
+++ b/docs/examples/java/account/update-email.md
@@ -1,49 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.updateEmail(
+ "email@example.com",
+ "password"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
-
- account.updateEmail(
- "email@example.com",
- "password"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
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 d0734e1..e56da73 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
@@ -1,49 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.updateMagicURLSession(
+ "[USER_ID]",
+ "[SECRET]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
-
- account.updateMagicURLSession(
- "[USER_ID]",
- "[SECRET]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/account/update-name.md b/docs/examples/java/account/update-name.md
index 9842a22..c722c85 100644
--- a/docs/examples/java/account/update-name.md
+++ b/docs/examples/java/account/update-name.md
@@ -1,48 +1,21 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.updateName(
+ "[NAME]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
-
- account.updateName(
- "[NAME]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/account/update-password.md b/docs/examples/java/account/update-password.md
index 468bdc2..e16aac5 100644
--- a/docs/examples/java/account/update-password.md
+++ b/docs/examples/java/account/update-password.md
@@ -1,48 +1,21 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.updatePassword(
+ "password",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
-
- account.updatePassword(
- "password",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/account/update-phone-session.md b/docs/examples/java/account/update-phone-session.md
index f8d35c7..952c7e0 100644
--- a/docs/examples/java/account/update-phone-session.md
+++ b/docs/examples/java/account/update-phone-session.md
@@ -1,49 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.updatePhoneSession(
+ "[USER_ID]",
+ "[SECRET]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
-
- account.updatePhoneSession(
- "[USER_ID]",
- "[SECRET]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/account/update-phone-verification.md b/docs/examples/java/account/update-phone-verification.md
index 7aec064..ec5ddf1 100644
--- a/docs/examples/java/account/update-phone-verification.md
+++ b/docs/examples/java/account/update-phone-verification.md
@@ -1,49 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.updatePhoneVerification(
+ "[USER_ID]",
+ "[SECRET]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
-
- account.updatePhoneVerification(
- "[USER_ID]",
- "[SECRET]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/account/update-phone.md b/docs/examples/java/account/update-phone.md
index 37c54c8..61cff45 100644
--- a/docs/examples/java/account/update-phone.md
+++ b/docs/examples/java/account/update-phone.md
@@ -1,49 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.updatePhone(
+ "+12065550100",
+ "password"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
-
- account.updatePhone(
- "",
- "password"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/account/update-prefs.md b/docs/examples/java/account/update-prefs.md
index 9f94b8f..a004b45 100644
--- a/docs/examples/java/account/update-prefs.md
+++ b/docs/examples/java/account/update-prefs.md
@@ -1,48 +1,21 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.updatePrefs(
+ mapOf( "a" to "b" )
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
-
- account.updatePrefs(
- mapOf( "a" to "b" )
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/account/update-recovery.md b/docs/examples/java/account/update-recovery.md
index bfcc89e..e565a6b 100644
--- a/docs/examples/java/account/update-recovery.md
+++ b/docs/examples/java/account/update-recovery.md
@@ -1,51 +1,24 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.updateRecovery(
+ "[USER_ID]",
+ "[SECRET]",
+ "password",
+ "password"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
-
- account.updateRecovery(
- "[USER_ID]",
- "[SECRET]",
- "password",
- "password"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/account/update-session.md b/docs/examples/java/account/update-session.md
index 80aff11..4c5d975 100644
--- a/docs/examples/java/account/update-session.md
+++ b/docs/examples/java/account/update-session.md
@@ -1,48 +1,21 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.updateSession(
+ "[SESSION_ID]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
-
- account.updateSession(
- "[SESSION_ID]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/account/update-status.md b/docs/examples/java/account/update-status.md
index 0ef6a6e..739469a 100644
--- a/docs/examples/java/account/update-status.md
+++ b/docs/examples/java/account/update-status.md
@@ -1,46 +1,18 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Account account = new Account(client);
-
- account.updateStatus(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
+account.updateStatus(new CoroutineCallback<>((result, error) -> {
+ if (error != null)
+ error.printStackTrace();
+ return;
}
-}
\ No newline at end of file
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/account/update-verification.md b/docs/examples/java/account/update-verification.md
index 8cf8d67..b05dbc2 100644
--- a/docs/examples/java/account/update-verification.md
+++ b/docs/examples/java/account/update-verification.md
@@ -1,49 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.updateVerification(
+ "[USER_ID]",
+ "[SECRET]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
-
- account.updateVerification(
- "[USER_ID]",
- "[SECRET]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/avatars/get-browser.md b/docs/examples/java/avatars/get-browser.md
index fa88749..8ad3f18 100644
--- a/docs/examples/java/avatars/get-browser.md
+++ b/docs/examples/java/avatars/get-browser.md
@@ -1,48 +1,21 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Avatars
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Avatars;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Avatars avatars = new Avatars(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+avatars.getBrowser(
+ "aa",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Avatars avatars = new Avatars(client);
-
- avatars.getBrowser(
- "aa",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/avatars/get-credit-card.md b/docs/examples/java/avatars/get-credit-card.md
index 2ddda86..453718b 100644
--- a/docs/examples/java/avatars/get-credit-card.md
+++ b/docs/examples/java/avatars/get-credit-card.md
@@ -1,48 +1,21 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Avatars
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Avatars;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Avatars avatars = new Avatars(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+avatars.getCreditCard(
+ "amex",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Avatars avatars = new Avatars(client);
-
- avatars.getCreditCard(
- "amex",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/avatars/get-favicon.md b/docs/examples/java/avatars/get-favicon.md
index 39c1432..a5b9fa6 100644
--- a/docs/examples/java/avatars/get-favicon.md
+++ b/docs/examples/java/avatars/get-favicon.md
@@ -1,48 +1,21 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Avatars
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Avatars;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Avatars avatars = new Avatars(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+avatars.getFavicon(
+ "https://example.com"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Avatars avatars = new Avatars(client);
-
- avatars.getFavicon(
- "https://example.com"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/avatars/get-flag.md b/docs/examples/java/avatars/get-flag.md
index 77bf3b1..0bc4896 100644
--- a/docs/examples/java/avatars/get-flag.md
+++ b/docs/examples/java/avatars/get-flag.md
@@ -1,48 +1,21 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Avatars
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Avatars;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Avatars avatars = new Avatars(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+avatars.getFlag(
+ "af",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Avatars avatars = new Avatars(client);
-
- avatars.getFlag(
- "af",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/avatars/get-image.md b/docs/examples/java/avatars/get-image.md
index 69371da..d77d79c 100644
--- a/docs/examples/java/avatars/get-image.md
+++ b/docs/examples/java/avatars/get-image.md
@@ -1,48 +1,21 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Avatars
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Avatars;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Avatars avatars = new Avatars(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+avatars.getImage(
+ "https://example.com",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Avatars avatars = new Avatars(client);
-
- avatars.getImage(
- "https://example.com",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/avatars/get-initials.md b/docs/examples/java/avatars/get-initials.md
index eea5669..491724f 100644
--- a/docs/examples/java/avatars/get-initials.md
+++ b/docs/examples/java/avatars/get-initials.md
@@ -1,47 +1,20 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Avatars
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Avatars;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Avatars avatars = new Avatars(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+avatars.getInitials(
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Avatars avatars = new Avatars(client);
-
- avatars.getInitials(
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/avatars/get-q-r.md b/docs/examples/java/avatars/get-q-r.md
index e2c48cd..ae1a11d 100644
--- a/docs/examples/java/avatars/get-q-r.md
+++ b/docs/examples/java/avatars/get-q-r.md
@@ -1,48 +1,21 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Avatars
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Avatars;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Avatars avatars = new Avatars(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+avatars.getQR(
+ "[TEXT]",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Avatars avatars = new Avatars(client);
-
- avatars.getQR(
- "[TEXT]",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/databases/create-document.md b/docs/examples/java/databases/create-document.md
index 7fc322b..d4412ce 100644
--- a/docs/examples/java/databases/create-document.md
+++ b/docs/examples/java/databases/create-document.md
@@ -1,51 +1,24 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Databases
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Databases databases = new Databases(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+databases.createDocument(
+ "[DATABASE_ID]",
+ "[COLLECTION_ID]",
+ "[DOCUMENT_ID]",
+ mapOf( "a" to "b" ),
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Databases databases = new Databases(client);
-
- databases.createDocument(
- "[DATABASE_ID]",
- "[COLLECTION_ID]",
- "[DOCUMENT_ID]",
- mapOf( "a" to "b" ),
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/databases/delete-document.md b/docs/examples/java/databases/delete-document.md
index f42a09b..90ad1ce 100644
--- a/docs/examples/java/databases/delete-document.md
+++ b/docs/examples/java/databases/delete-document.md
@@ -1,50 +1,23 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Databases
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Databases databases = new Databases(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+databases.deleteDocument(
+ "[DATABASE_ID]",
+ "[COLLECTION_ID]",
+ "[DOCUMENT_ID]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Databases databases = new Databases(client);
-
- databases.deleteDocument(
- "[DATABASE_ID]",
- "[COLLECTION_ID]",
- "[DOCUMENT_ID]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/databases/get-document.md b/docs/examples/java/databases/get-document.md
index f1a4d44..f4e7dc6 100644
--- a/docs/examples/java/databases/get-document.md
+++ b/docs/examples/java/databases/get-document.md
@@ -1,50 +1,23 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Databases
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Databases databases = new Databases(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+databases.getDocument(
+ "[DATABASE_ID]",
+ "[COLLECTION_ID]",
+ "[DOCUMENT_ID]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Databases databases = new Databases(client);
-
- databases.getDocument(
- "[DATABASE_ID]",
- "[COLLECTION_ID]",
- "[DOCUMENT_ID]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/databases/list-documents.md b/docs/examples/java/databases/list-documents.md
index 93d7333..6b897df 100644
--- a/docs/examples/java/databases/list-documents.md
+++ b/docs/examples/java/databases/list-documents.md
@@ -1,49 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Databases
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Databases databases = new Databases(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+databases.listDocuments(
+ "[DATABASE_ID]",
+ "[COLLECTION_ID]",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Databases databases = new Databases(client);
-
- databases.listDocuments(
- "[DATABASE_ID]",
- "[COLLECTION_ID]",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/databases/update-document.md b/docs/examples/java/databases/update-document.md
index 81e55d4..7f04c8e 100644
--- a/docs/examples/java/databases/update-document.md
+++ b/docs/examples/java/databases/update-document.md
@@ -1,50 +1,23 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Databases
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Databases databases = new Databases(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+databases.updateDocument(
+ "[DATABASE_ID]",
+ "[COLLECTION_ID]",
+ "[DOCUMENT_ID]",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Databases databases = new Databases(client);
-
- databases.updateDocument(
- "[DATABASE_ID]",
- "[COLLECTION_ID]",
- "[DOCUMENT_ID]",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/functions/create-execution.md b/docs/examples/java/functions/create-execution.md
index ea30fad..ee4eaf5 100644
--- a/docs/examples/java/functions/create-execution.md
+++ b/docs/examples/java/functions/create-execution.md
@@ -1,48 +1,21 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Functions
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Functions;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Functions functions = new Functions(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+functions.createExecution(
+ "[FUNCTION_ID]",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Functions functions = new Functions(client);
-
- functions.createExecution(
- "[FUNCTION_ID]",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/functions/get-execution.md b/docs/examples/java/functions/get-execution.md
index 2f4e57e..90153f5 100644
--- a/docs/examples/java/functions/get-execution.md
+++ b/docs/examples/java/functions/get-execution.md
@@ -1,49 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Functions
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Functions;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Functions functions = new Functions(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+functions.getExecution(
+ "[FUNCTION_ID]",
+ "[EXECUTION_ID]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Functions functions = new Functions(client);
-
- functions.getExecution(
- "[FUNCTION_ID]",
- "[EXECUTION_ID]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/functions/list-executions.md b/docs/examples/java/functions/list-executions.md
index 68f767d..fca903b 100644
--- a/docs/examples/java/functions/list-executions.md
+++ b/docs/examples/java/functions/list-executions.md
@@ -1,48 +1,21 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Functions
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Functions;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Functions functions = new Functions(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+functions.listExecutions(
+ "[FUNCTION_ID]",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Functions functions = new Functions(client);
-
- functions.listExecutions(
- "[FUNCTION_ID]",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/functions/retry-build.md b/docs/examples/java/functions/retry-build.md
deleted file mode 100644
index 96501a0..0000000
--- a/docs/examples/java/functions/retry-build.md
+++ /dev/null
@@ -1,50 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Functions
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Functions functions = new Functions(client);
-
- functions.retryBuild(
- "[FUNCTION_ID]",
- "[DEPLOYMENT_ID]",
- "[BUILD_ID]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/graphql/mutation.md b/docs/examples/java/graphql/mutation.md
new file mode 100644
index 0000000..e6ced40
--- /dev/null
+++ b/docs/examples/java/graphql/mutation.md
@@ -0,0 +1,21 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Graphql;
+
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
+
+Graphql graphql = new Graphql(client);
+
+graphql.mutation(
+ mapOf( "a" to "b" )
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/graphql/query.md b/docs/examples/java/graphql/query.md
new file mode 100644
index 0000000..f0b8a86
--- /dev/null
+++ b/docs/examples/java/graphql/query.md
@@ -0,0 +1,21 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Graphql;
+
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
+
+Graphql graphql = new Graphql(client);
+
+graphql.query(
+ mapOf( "a" to "b" )
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/locale/get-continents.md b/docs/examples/java/locale/get-continents.md
deleted file mode 100644
index e96a9fe..0000000
--- a/docs/examples/java/locale/get-continents.md
+++ /dev/null
@@ -1,46 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Locale locale = new Locale(client);
-
- locale.getContinents(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/locale/get-countries-e-u.md b/docs/examples/java/locale/get-countries-e-u.md
deleted file mode 100644
index ec478bc..0000000
--- a/docs/examples/java/locale/get-countries-e-u.md
+++ /dev/null
@@ -1,46 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Locale locale = new Locale(client);
-
- locale.getCountriesEU(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/locale/get-countries-phones.md b/docs/examples/java/locale/get-countries-phones.md
deleted file mode 100644
index 34368d2..0000000
--- a/docs/examples/java/locale/get-countries-phones.md
+++ /dev/null
@@ -1,46 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Locale locale = new Locale(client);
-
- locale.getCountriesPhones(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/locale/get-countries.md b/docs/examples/java/locale/get-countries.md
deleted file mode 100644
index f1c50fc..0000000
--- a/docs/examples/java/locale/get-countries.md
+++ /dev/null
@@ -1,46 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Locale locale = new Locale(client);
-
- locale.getCountries(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/locale/get-currencies.md b/docs/examples/java/locale/get-currencies.md
deleted file mode 100644
index 63af14b..0000000
--- a/docs/examples/java/locale/get-currencies.md
+++ /dev/null
@@ -1,46 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Locale locale = new Locale(client);
-
- locale.getCurrencies(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/locale/get-languages.md b/docs/examples/java/locale/get-languages.md
deleted file mode 100644
index 5952daa..0000000
--- a/docs/examples/java/locale/get-languages.md
+++ /dev/null
@@ -1,46 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Locale locale = new Locale(client);
-
- locale.getLanguages(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/locale/get.md b/docs/examples/java/locale/get.md
index 417fc16..89de369 100644
--- a/docs/examples/java/locale/get.md
+++ b/docs/examples/java/locale/get.md
@@ -1,46 +1,18 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Locale;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Locale locale = new Locale(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Locale locale = new Locale(client);
-
- locale.get(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
+locale.get(new CoroutineCallback<>((result, error) -> {
+ if (error != null)
+ error.printStackTrace();
+ return;
}
-}
\ No newline at end of file
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/locale/list-continents.md b/docs/examples/java/locale/list-continents.md
index 970f066..7205ad6 100644
--- a/docs/examples/java/locale/list-continents.md
+++ b/docs/examples/java/locale/list-continents.md
@@ -1,46 +1,18 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Locale;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Locale locale = new Locale(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Locale locale = new Locale(client);
-
- locale.listContinents(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
+locale.listContinents(new CoroutineCallback<>((result, error) -> {
+ if (error != null)
+ error.printStackTrace();
+ return;
}
-}
\ No newline at end of file
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/locale/list-countries-e-u.md b/docs/examples/java/locale/list-countries-e-u.md
index b2d0b29..d6f37be 100644
--- a/docs/examples/java/locale/list-countries-e-u.md
+++ b/docs/examples/java/locale/list-countries-e-u.md
@@ -1,46 +1,18 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Locale;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Locale locale = new Locale(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Locale locale = new Locale(client);
-
- locale.listCountriesEU(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
+locale.listCountriesEU(new CoroutineCallback<>((result, error) -> {
+ if (error != null)
+ error.printStackTrace();
+ return;
}
-}
\ No newline at end of file
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/locale/list-countries-phones.md b/docs/examples/java/locale/list-countries-phones.md
index ed4d1f4..1f947fe 100644
--- a/docs/examples/java/locale/list-countries-phones.md
+++ b/docs/examples/java/locale/list-countries-phones.md
@@ -1,46 +1,18 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Locale;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Locale locale = new Locale(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Locale locale = new Locale(client);
-
- locale.listCountriesPhones(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
+locale.listCountriesPhones(new CoroutineCallback<>((result, error) -> {
+ if (error != null)
+ error.printStackTrace();
+ return;
}
-}
\ No newline at end of file
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/locale/list-countries.md b/docs/examples/java/locale/list-countries.md
index cb4000f..5b8c0ba 100644
--- a/docs/examples/java/locale/list-countries.md
+++ b/docs/examples/java/locale/list-countries.md
@@ -1,46 +1,18 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Locale;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Locale locale = new Locale(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Locale locale = new Locale(client);
-
- locale.listCountries(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
+locale.listCountries(new CoroutineCallback<>((result, error) -> {
+ if (error != null)
+ error.printStackTrace();
+ return;
}
-}
\ No newline at end of file
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/locale/list-currencies.md b/docs/examples/java/locale/list-currencies.md
index 5423698..880e1b2 100644
--- a/docs/examples/java/locale/list-currencies.md
+++ b/docs/examples/java/locale/list-currencies.md
@@ -1,46 +1,18 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Locale;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Locale locale = new Locale(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Locale locale = new Locale(client);
-
- locale.listCurrencies(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
+locale.listCurrencies(new CoroutineCallback<>((result, error) -> {
+ if (error != null)
+ error.printStackTrace();
+ return;
}
-}
\ No newline at end of file
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/locale/list-languages.md b/docs/examples/java/locale/list-languages.md
index 158c0e5..318c6dc 100644
--- a/docs/examples/java/locale/list-languages.md
+++ b/docs/examples/java/locale/list-languages.md
@@ -1,46 +1,18 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Locale;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Locale locale = new Locale(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Locale locale = new Locale(client);
-
- locale.listLanguages(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
+locale.listLanguages(new CoroutineCallback<>((result, error) -> {
+ if (error != null)
+ error.printStackTrace();
+ return;
}
-}
\ No newline at end of file
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/storage/create-file.md b/docs/examples/java/storage/create-file.md
index 32e0fd0..161f882 100644
--- a/docs/examples/java/storage/create-file.md
+++ b/docs/examples/java/storage/create-file.md
@@ -1,51 +1,24 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.models.InputFile
-import io.appwrite.services.Storage
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.models.InputFile;
+import io.appwrite.services.Storage;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Storage storage = new Storage(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+storage.createFile(
+ "[BUCKET_ID]",
+ "[FILE_ID]",
+ InputFile.fromPath("file.png"),
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Storage storage = new Storage(client);
-
- storage.createFile(
- "[BUCKET_ID]",
- "[FILE_ID]",
- InputFile.fromPath("file.png"),
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/storage/delete-file.md b/docs/examples/java/storage/delete-file.md
index 585593a..654c127 100644
--- a/docs/examples/java/storage/delete-file.md
+++ b/docs/examples/java/storage/delete-file.md
@@ -1,49 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Storage
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Storage;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Storage storage = new Storage(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+storage.deleteFile(
+ "[BUCKET_ID]",
+ "[FILE_ID]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Storage storage = new Storage(client);
-
- storage.deleteFile(
- "[BUCKET_ID]",
- "[FILE_ID]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/storage/get-file-download.md b/docs/examples/java/storage/get-file-download.md
index b162248..f12302a 100644
--- a/docs/examples/java/storage/get-file-download.md
+++ b/docs/examples/java/storage/get-file-download.md
@@ -1,49 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Storage
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Storage;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Storage storage = new Storage(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+storage.getFileDownload(
+ "[BUCKET_ID]",
+ "[FILE_ID]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Storage storage = new Storage(client);
-
- storage.getFileDownload(
- "[BUCKET_ID]",
- "[FILE_ID]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/storage/get-file-preview.md b/docs/examples/java/storage/get-file-preview.md
index 583c1a0..8487922 100644
--- a/docs/examples/java/storage/get-file-preview.md
+++ b/docs/examples/java/storage/get-file-preview.md
@@ -1,49 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Storage
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Storage;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Storage storage = new Storage(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+storage.getFilePreview(
+ "[BUCKET_ID]",
+ "[FILE_ID]",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Storage storage = new Storage(client);
-
- storage.getFilePreview(
- "[BUCKET_ID]",
- "[FILE_ID]",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/storage/get-file-view.md b/docs/examples/java/storage/get-file-view.md
index 21a5074..825b538 100644
--- a/docs/examples/java/storage/get-file-view.md
+++ b/docs/examples/java/storage/get-file-view.md
@@ -1,49 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Storage
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Storage;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Storage storage = new Storage(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+storage.getFileView(
+ "[BUCKET_ID]",
+ "[FILE_ID]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Storage storage = new Storage(client);
-
- storage.getFileView(
- "[BUCKET_ID]",
- "[FILE_ID]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/storage/get-file.md b/docs/examples/java/storage/get-file.md
index 61740a9..bf97922 100644
--- a/docs/examples/java/storage/get-file.md
+++ b/docs/examples/java/storage/get-file.md
@@ -1,49 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Storage
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Storage;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Storage storage = new Storage(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+storage.getFile(
+ "[BUCKET_ID]",
+ "[FILE_ID]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Storage storage = new Storage(client);
-
- storage.getFile(
- "[BUCKET_ID]",
- "[FILE_ID]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/storage/list-files.md b/docs/examples/java/storage/list-files.md
index a7ea06e..fdf3e4f 100644
--- a/docs/examples/java/storage/list-files.md
+++ b/docs/examples/java/storage/list-files.md
@@ -1,48 +1,21 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Storage
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Storage;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Storage storage = new Storage(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+storage.listFiles(
+ "[BUCKET_ID]",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Storage storage = new Storage(client);
-
- storage.listFiles(
- "[BUCKET_ID]",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/storage/update-file.md b/docs/examples/java/storage/update-file.md
index b3e8e90..9d9f192 100644
--- a/docs/examples/java/storage/update-file.md
+++ b/docs/examples/java/storage/update-file.md
@@ -1,49 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Storage
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Storage;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Storage storage = new Storage(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+storage.updateFile(
+ "[BUCKET_ID]",
+ "[FILE_ID]",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Storage storage = new Storage(client);
-
- storage.updateFile(
- "[BUCKET_ID]",
- "[FILE_ID]",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/teams/create-membership.md b/docs/examples/java/teams/create-membership.md
index f4d96de..9d567d6 100644
--- a/docs/examples/java/teams/create-membership.md
+++ b/docs/examples/java/teams/create-membership.md
@@ -1,51 +1,24 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Teams
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Teams;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Teams teams = new Teams(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+teams.createMembership(
+ "[TEAM_ID]",
+ "email@example.com",
+ listOf(),
+ "https://example.com",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Teams teams = new Teams(client);
-
- teams.createMembership(
- "[TEAM_ID]",
- "email@example.com",
- listOf(),
- "https://example.com",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/teams/create.md b/docs/examples/java/teams/create.md
index 3723b30..52207c6 100644
--- a/docs/examples/java/teams/create.md
+++ b/docs/examples/java/teams/create.md
@@ -1,49 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Teams
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Teams;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Teams teams = new Teams(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+teams.create(
+ "[TEAM_ID]",
+ "[NAME]",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Teams teams = new Teams(client);
-
- teams.create(
- "[TEAM_ID]",
- "[NAME]",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/teams/delete-membership.md b/docs/examples/java/teams/delete-membership.md
index 98cb29a..92d6d37 100644
--- a/docs/examples/java/teams/delete-membership.md
+++ b/docs/examples/java/teams/delete-membership.md
@@ -1,49 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Teams
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Teams;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Teams teams = new Teams(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+teams.deleteMembership(
+ "[TEAM_ID]",
+ "[MEMBERSHIP_ID]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Teams teams = new Teams(client);
-
- teams.deleteMembership(
- "[TEAM_ID]",
- "[MEMBERSHIP_ID]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/teams/delete.md b/docs/examples/java/teams/delete.md
index 828b457..ed81195 100644
--- a/docs/examples/java/teams/delete.md
+++ b/docs/examples/java/teams/delete.md
@@ -1,48 +1,21 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Teams
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Teams;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Teams teams = new Teams(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+teams.delete(
+ "[TEAM_ID]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Teams teams = new Teams(client);
-
- teams.delete(
- "[TEAM_ID]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/teams/get-membership.md b/docs/examples/java/teams/get-membership.md
index 87c0160..7e29171 100644
--- a/docs/examples/java/teams/get-membership.md
+++ b/docs/examples/java/teams/get-membership.md
@@ -1,49 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Teams
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Teams;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Teams teams = new Teams(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+teams.getMembership(
+ "[TEAM_ID]",
+ "[MEMBERSHIP_ID]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Teams teams = new Teams(client);
-
- teams.getMembership(
- "[TEAM_ID]",
- "[MEMBERSHIP_ID]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/teams/get-memberships.md b/docs/examples/java/teams/get-memberships.md
deleted file mode 100644
index d8a4100..0000000
--- a/docs/examples/java/teams/get-memberships.md
+++ /dev/null
@@ -1,48 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Teams
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Teams teams = new Teams(client);
-
- teams.getMemberships(
- "[TEAM_ID]",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/teams/get.md b/docs/examples/java/teams/get.md
index 53ba33c..36063c5 100644
--- a/docs/examples/java/teams/get.md
+++ b/docs/examples/java/teams/get.md
@@ -1,48 +1,21 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Teams
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Teams;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Teams teams = new Teams(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+teams.get(
+ "[TEAM_ID]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Teams teams = new Teams(client);
-
- teams.get(
- "[TEAM_ID]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/teams/list-memberships.md b/docs/examples/java/teams/list-memberships.md
index c53493d..d195978 100644
--- a/docs/examples/java/teams/list-memberships.md
+++ b/docs/examples/java/teams/list-memberships.md
@@ -1,48 +1,21 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Teams
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Teams;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Teams teams = new Teams(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+teams.listMemberships(
+ "[TEAM_ID]",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Teams teams = new Teams(client);
-
- teams.listMemberships(
- "[TEAM_ID]",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/teams/list.md b/docs/examples/java/teams/list.md
index 61c2aa3..b4998ff 100644
--- a/docs/examples/java/teams/list.md
+++ b/docs/examples/java/teams/list.md
@@ -1,47 +1,20 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Teams
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Teams;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Teams teams = new Teams(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+teams.list(
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Teams teams = new Teams(client);
-
- teams.list(
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/teams/update-membership-roles.md b/docs/examples/java/teams/update-membership-roles.md
index ef6c673..680c9a3 100644
--- a/docs/examples/java/teams/update-membership-roles.md
+++ b/docs/examples/java/teams/update-membership-roles.md
@@ -1,50 +1,23 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Teams
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Teams;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Teams teams = new Teams(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+teams.updateMembershipRoles(
+ "[TEAM_ID]",
+ "[MEMBERSHIP_ID]",
+ listOf()
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Teams teams = new Teams(client);
-
- teams.updateMembershipRoles(
- "[TEAM_ID]",
- "[MEMBERSHIP_ID]",
- listOf()
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/teams/update-membership-status.md b/docs/examples/java/teams/update-membership-status.md
index 447d0da..1015b2e 100644
--- a/docs/examples/java/teams/update-membership-status.md
+++ b/docs/examples/java/teams/update-membership-status.md
@@ -1,51 +1,24 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Teams
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Teams;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Teams teams = new Teams(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+teams.updateMembershipStatus(
+ "[TEAM_ID]",
+ "[MEMBERSHIP_ID]",
+ "[USER_ID]",
+ "[SECRET]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Teams teams = new Teams(client);
-
- teams.updateMembershipStatus(
- "[TEAM_ID]",
- "[MEMBERSHIP_ID]",
- "[USER_ID]",
- "[SECRET]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ Log.d("Appwrite", result.toString());
+ })
+);
diff --git a/docs/examples/java/teams/update.md b/docs/examples/java/teams/update.md
index b4df429..86d6a3f 100644
--- a/docs/examples/java/teams/update.md
+++ b/docs/examples/java/teams/update.md
@@ -1,49 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Teams
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Teams;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Teams teams = new Teams(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+teams.update(
+ "[TEAM_ID]",
+ "[NAME]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Teams teams = new Teams(client);
-
- teams.update(
- "[TEAM_ID]",
- "[NAME]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
+ 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 5fa0699..ccefc0a 100644
--- a/docs/examples/kotlin/account/create-anonymous-session.md
+++ b/docs/examples/kotlin/account/create-anonymous-session.md
@@ -1,24 +1,10 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.createAnonymousSession()
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.createAnonymousSession()
diff --git a/docs/examples/kotlin/account/create-email-session.md b/docs/examples/kotlin/account/create-email-session.md
index 5dcec23..c58799c 100644
--- a/docs/examples/kotlin/account/create-email-session.md
+++ b/docs/examples/kotlin/account/create-email-session.md
@@ -1,27 +1,13 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.createEmailSession(
- email = "email@example.com",
- password = "password"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.createEmailSession(
+ email = "email@example.com",
+ password = "password"
+)
diff --git a/docs/examples/kotlin/account/create-j-w-t.md b/docs/examples/kotlin/account/create-j-w-t.md
index 212838b..59b7398 100644
--- a/docs/examples/kotlin/account/create-j-w-t.md
+++ b/docs/examples/kotlin/account/create-j-w-t.md
@@ -1,24 +1,10 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.createJWT()
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.createJWT()
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 15fa1c7..5f36940 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
@@ -1,27 +1,13 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.createMagicURLSession(
- userId = "[USER_ID]",
- email = "email@example.com",
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.createMagicURLSession(
+ userId = "[USER_ID]",
+ email = "email@example.com",
+)
diff --git a/docs/examples/kotlin/account/create-o-auth2session.md b/docs/examples/kotlin/account/create-o-auth2session.md
index baf9930..f909b59 100644
--- a/docs/examples/kotlin/account/create-o-auth2session.md
+++ b/docs/examples/kotlin/account/create-o-auth2session.md
@@ -1,27 +1,12 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- account.createOAuth2Session(
- activity = this@MainActivity,
- provider = "amazon",
- )
-
- }
- }
-}
\ No newline at end of file
+account.createOAuth2Session(
+ provider = "amazon",
+)
diff --git a/docs/examples/kotlin/account/create-phone-session.md b/docs/examples/kotlin/account/create-phone-session.md
index 2df83ad..8f63c64 100644
--- a/docs/examples/kotlin/account/create-phone-session.md
+++ b/docs/examples/kotlin/account/create-phone-session.md
@@ -1,27 +1,13 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.createPhoneSession(
- userId = "[USER_ID]",
- phone = ""
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.createPhoneSession(
+ userId = "[USER_ID]",
+ phone = "+12065550100"
+)
diff --git a/docs/examples/kotlin/account/create-phone-verification.md b/docs/examples/kotlin/account/create-phone-verification.md
index ab0eccf..af36502 100644
--- a/docs/examples/kotlin/account/create-phone-verification.md
+++ b/docs/examples/kotlin/account/create-phone-verification.md
@@ -1,24 +1,10 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.createPhoneVerification()
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.createPhoneVerification()
diff --git a/docs/examples/kotlin/account/create-recovery.md b/docs/examples/kotlin/account/create-recovery.md
index 2c1e759..23a3424 100644
--- a/docs/examples/kotlin/account/create-recovery.md
+++ b/docs/examples/kotlin/account/create-recovery.md
@@ -1,27 +1,13 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.createRecovery(
- email = "email@example.com",
- url = "https://example.com"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.createRecovery(
+ email = "email@example.com",
+ url = "https://example.com"
+)
diff --git a/docs/examples/kotlin/account/create-verification.md b/docs/examples/kotlin/account/create-verification.md
index 1ebddee..3fed01b 100644
--- a/docs/examples/kotlin/account/create-verification.md
+++ b/docs/examples/kotlin/account/create-verification.md
@@ -1,26 +1,12 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.createVerification(
- url = "https://example.com"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.createVerification(
+ url = "https://example.com"
+)
diff --git a/docs/examples/kotlin/account/create.md b/docs/examples/kotlin/account/create.md
index ab2534f..2a55fb1 100644
--- a/docs/examples/kotlin/account/create.md
+++ b/docs/examples/kotlin/account/create.md
@@ -1,28 +1,14 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.create(
- userId = "[USER_ID]",
- email = "email@example.com",
- password = "password",
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.create(
+ userId = "[USER_ID]",
+ email = "email@example.com",
+ password = "password",
+)
diff --git a/docs/examples/kotlin/account/delete-session.md b/docs/examples/kotlin/account/delete-session.md
index e670623..5c8988f 100644
--- a/docs/examples/kotlin/account/delete-session.md
+++ b/docs/examples/kotlin/account/delete-session.md
@@ -1,26 +1,12 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.deleteSession(
- sessionId = "[SESSION_ID]"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.deleteSession(
+ sessionId = "[SESSION_ID]"
+)
diff --git a/docs/examples/kotlin/account/delete-sessions.md b/docs/examples/kotlin/account/delete-sessions.md
index ec30efd..86c9bc9 100644
--- a/docs/examples/kotlin/account/delete-sessions.md
+++ b/docs/examples/kotlin/account/delete-sessions.md
@@ -1,24 +1,10 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.deleteSessions()
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.deleteSessions()
diff --git a/docs/examples/kotlin/account/get-logs.md b/docs/examples/kotlin/account/get-logs.md
deleted file mode 100644
index b8c89f4..0000000
--- a/docs/examples/kotlin/account/get-logs.md
+++ /dev/null
@@ -1,25 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
-
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
-
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
-
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.getLogs(
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/get-prefs.md b/docs/examples/kotlin/account/get-prefs.md
index 9378cd2..70fa291 100644
--- a/docs/examples/kotlin/account/get-prefs.md
+++ b/docs/examples/kotlin/account/get-prefs.md
@@ -1,24 +1,10 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.getPrefs()
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.getPrefs()
diff --git a/docs/examples/kotlin/account/get-session.md b/docs/examples/kotlin/account/get-session.md
index 45f00b6..58248ae 100644
--- a/docs/examples/kotlin/account/get-session.md
+++ b/docs/examples/kotlin/account/get-session.md
@@ -1,26 +1,12 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.getSession(
- sessionId = "[SESSION_ID]"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.getSession(
+ sessionId = "[SESSION_ID]"
+)
diff --git a/docs/examples/kotlin/account/get-sessions.md b/docs/examples/kotlin/account/get-sessions.md
deleted file mode 100644
index 4f939cc..0000000
--- a/docs/examples/kotlin/account/get-sessions.md
+++ /dev/null
@@ -1,24 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
-
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
-
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
-
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.getSessions()
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/get.md b/docs/examples/kotlin/account/get.md
index c4c81a2..09b0a17 100644
--- a/docs/examples/kotlin/account/get.md
+++ b/docs/examples/kotlin/account/get.md
@@ -1,24 +1,10 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.get()
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.get()
diff --git a/docs/examples/kotlin/account/list-logs.md b/docs/examples/kotlin/account/list-logs.md
index 397906b..dda9c72 100644
--- a/docs/examples/kotlin/account/list-logs.md
+++ b/docs/examples/kotlin/account/list-logs.md
@@ -1,25 +1,11 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.listLogs(
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.listLogs(
+)
diff --git a/docs/examples/kotlin/account/list-sessions.md b/docs/examples/kotlin/account/list-sessions.md
index 0a0bc73..b7bb447 100644
--- a/docs/examples/kotlin/account/list-sessions.md
+++ b/docs/examples/kotlin/account/list-sessions.md
@@ -1,24 +1,10 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.listSessions()
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.listSessions()
diff --git a/docs/examples/kotlin/account/update-email.md b/docs/examples/kotlin/account/update-email.md
index a9ec88b..2d1b66b 100644
--- a/docs/examples/kotlin/account/update-email.md
+++ b/docs/examples/kotlin/account/update-email.md
@@ -1,27 +1,13 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.updateEmail(
- email = "email@example.com",
- password = "password"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.updateEmail(
+ email = "email@example.com",
+ password = "password"
+)
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 3fe1b7c..49af217 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
@@ -1,27 +1,13 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.updateMagicURLSession(
- userId = "[USER_ID]",
- secret = "[SECRET]"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.updateMagicURLSession(
+ userId = "[USER_ID]",
+ secret = "[SECRET]"
+)
diff --git a/docs/examples/kotlin/account/update-name.md b/docs/examples/kotlin/account/update-name.md
index ce9d8a3..5799344 100644
--- a/docs/examples/kotlin/account/update-name.md
+++ b/docs/examples/kotlin/account/update-name.md
@@ -1,26 +1,12 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.updateName(
- name = "[NAME]"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.updateName(
+ name = "[NAME]"
+)
diff --git a/docs/examples/kotlin/account/update-password.md b/docs/examples/kotlin/account/update-password.md
index edee78e..cdf8178 100644
--- a/docs/examples/kotlin/account/update-password.md
+++ b/docs/examples/kotlin/account/update-password.md
@@ -1,26 +1,12 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.updatePassword(
- password = "password",
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.updatePassword(
+ password = "password",
+)
diff --git a/docs/examples/kotlin/account/update-phone-session.md b/docs/examples/kotlin/account/update-phone-session.md
index c981991..6efa2a4 100644
--- a/docs/examples/kotlin/account/update-phone-session.md
+++ b/docs/examples/kotlin/account/update-phone-session.md
@@ -1,27 +1,13 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.updatePhoneSession(
- userId = "[USER_ID]",
- secret = "[SECRET]"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.updatePhoneSession(
+ userId = "[USER_ID]",
+ secret = "[SECRET]"
+)
diff --git a/docs/examples/kotlin/account/update-phone-verification.md b/docs/examples/kotlin/account/update-phone-verification.md
index aa5eea3..1b90372 100644
--- a/docs/examples/kotlin/account/update-phone-verification.md
+++ b/docs/examples/kotlin/account/update-phone-verification.md
@@ -1,27 +1,13 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.updatePhoneVerification(
- userId = "[USER_ID]",
- secret = "[SECRET]"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.updatePhoneVerification(
+ userId = "[USER_ID]",
+ secret = "[SECRET]"
+)
diff --git a/docs/examples/kotlin/account/update-phone.md b/docs/examples/kotlin/account/update-phone.md
index 8ffef51..0534220 100644
--- a/docs/examples/kotlin/account/update-phone.md
+++ b/docs/examples/kotlin/account/update-phone.md
@@ -1,27 +1,13 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.updatePhone(
- phone = "",
- password = "password"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.updatePhone(
+ phone = "+12065550100",
+ password = "password"
+)
diff --git a/docs/examples/kotlin/account/update-prefs.md b/docs/examples/kotlin/account/update-prefs.md
index 3059bc8..408988b 100644
--- a/docs/examples/kotlin/account/update-prefs.md
+++ b/docs/examples/kotlin/account/update-prefs.md
@@ -1,26 +1,12 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.updatePrefs(
- prefs = mapOf( "a" to "b" )
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.updatePrefs(
+ prefs = mapOf( "a" to "b" )
+)
diff --git a/docs/examples/kotlin/account/update-recovery.md b/docs/examples/kotlin/account/update-recovery.md
index 81c00b4..fd28f6e 100644
--- a/docs/examples/kotlin/account/update-recovery.md
+++ b/docs/examples/kotlin/account/update-recovery.md
@@ -1,29 +1,15 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.updateRecovery(
- userId = "[USER_ID]",
- secret = "[SECRET]",
- password = "password",
- passwordAgain = "password"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.updateRecovery(
+ userId = "[USER_ID]",
+ secret = "[SECRET]",
+ password = "password",
+ passwordAgain = "password"
+)
diff --git a/docs/examples/kotlin/account/update-session.md b/docs/examples/kotlin/account/update-session.md
index 465320d..67d900e 100644
--- a/docs/examples/kotlin/account/update-session.md
+++ b/docs/examples/kotlin/account/update-session.md
@@ -1,26 +1,12 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.updateSession(
- sessionId = "[SESSION_ID]"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.updateSession(
+ sessionId = "[SESSION_ID]"
+)
diff --git a/docs/examples/kotlin/account/update-status.md b/docs/examples/kotlin/account/update-status.md
index e138751..35a4027 100644
--- a/docs/examples/kotlin/account/update-status.md
+++ b/docs/examples/kotlin/account/update-status.md
@@ -1,24 +1,10 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.updateStatus()
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.updateStatus()
diff --git a/docs/examples/kotlin/account/update-verification.md b/docs/examples/kotlin/account/update-verification.md
index cea2592..f87192e 100644
--- a/docs/examples/kotlin/account/update-verification.md
+++ b/docs/examples/kotlin/account/update-verification.md
@@ -1,27 +1,13 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val account = Account(client)
- val account = Account(client)
-
- GlobalScope.launch {
- val response = account.updateVerification(
- userId = "[USER_ID]",
- secret = "[SECRET]"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = account.updateVerification(
+ userId = "[USER_ID]",
+ secret = "[SECRET]"
+)
diff --git a/docs/examples/kotlin/avatars/get-browser.md b/docs/examples/kotlin/avatars/get-browser.md
index 95a2201..9ea6739 100644
--- a/docs/examples/kotlin/avatars/get-browser.md
+++ b/docs/examples/kotlin/avatars/get-browser.md
@@ -1,26 +1,12 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Avatars
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val avatars = Avatars(client)
- val avatars = Avatars(client)
-
- GlobalScope.launch {
- val result = avatars.getBrowser(
- code = "aa",
- )
- println(result); // Resource URL
- }
- }
-}
\ No newline at end of file
+val result = avatars.getBrowser(
+ code = "aa",
+)
diff --git a/docs/examples/kotlin/avatars/get-credit-card.md b/docs/examples/kotlin/avatars/get-credit-card.md
index 7507c40..cf82474 100644
--- a/docs/examples/kotlin/avatars/get-credit-card.md
+++ b/docs/examples/kotlin/avatars/get-credit-card.md
@@ -1,26 +1,12 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Avatars
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val avatars = Avatars(client)
- val avatars = Avatars(client)
-
- GlobalScope.launch {
- val result = avatars.getCreditCard(
- code = "amex",
- )
- println(result); // Resource URL
- }
- }
-}
\ No newline at end of file
+val result = avatars.getCreditCard(
+ code = "amex",
+)
diff --git a/docs/examples/kotlin/avatars/get-favicon.md b/docs/examples/kotlin/avatars/get-favicon.md
index f8e2b40..102d773 100644
--- a/docs/examples/kotlin/avatars/get-favicon.md
+++ b/docs/examples/kotlin/avatars/get-favicon.md
@@ -1,26 +1,12 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Avatars
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val avatars = Avatars(client)
- val avatars = Avatars(client)
-
- GlobalScope.launch {
- val result = avatars.getFavicon(
- url = "https://example.com"
- )
- println(result); // Resource URL
- }
- }
-}
\ No newline at end of file
+val result = avatars.getFavicon(
+ url = "https://example.com"
+)
diff --git a/docs/examples/kotlin/avatars/get-flag.md b/docs/examples/kotlin/avatars/get-flag.md
index 738ec8a..7a618a7 100644
--- a/docs/examples/kotlin/avatars/get-flag.md
+++ b/docs/examples/kotlin/avatars/get-flag.md
@@ -1,26 +1,12 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Avatars
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val avatars = Avatars(client)
- val avatars = Avatars(client)
-
- GlobalScope.launch {
- val result = avatars.getFlag(
- code = "af",
- )
- println(result); // Resource URL
- }
- }
-}
\ No newline at end of file
+val result = avatars.getFlag(
+ code = "af",
+)
diff --git a/docs/examples/kotlin/avatars/get-image.md b/docs/examples/kotlin/avatars/get-image.md
index 25171b1..fc1fe1d 100644
--- a/docs/examples/kotlin/avatars/get-image.md
+++ b/docs/examples/kotlin/avatars/get-image.md
@@ -1,26 +1,12 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Avatars
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val avatars = Avatars(client)
- val avatars = Avatars(client)
-
- GlobalScope.launch {
- val result = avatars.getImage(
- url = "https://example.com",
- )
- println(result); // Resource URL
- }
- }
-}
\ No newline at end of file
+val result = avatars.getImage(
+ url = "https://example.com",
+)
diff --git a/docs/examples/kotlin/avatars/get-initials.md b/docs/examples/kotlin/avatars/get-initials.md
index e53a647..448467e 100644
--- a/docs/examples/kotlin/avatars/get-initials.md
+++ b/docs/examples/kotlin/avatars/get-initials.md
@@ -1,25 +1,11 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Avatars
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val avatars = Avatars(client)
- val avatars = Avatars(client)
-
- GlobalScope.launch {
- val result = avatars.getInitials(
- )
- println(result); // Resource URL
- }
- }
-}
\ No newline at end of file
+val result = avatars.getInitials(
+)
diff --git a/docs/examples/kotlin/avatars/get-q-r.md b/docs/examples/kotlin/avatars/get-q-r.md
index c9d60ea..8d24934 100644
--- a/docs/examples/kotlin/avatars/get-q-r.md
+++ b/docs/examples/kotlin/avatars/get-q-r.md
@@ -1,26 +1,12 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Avatars
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val avatars = Avatars(client)
- val avatars = Avatars(client)
-
- GlobalScope.launch {
- val result = avatars.getQR(
- text = "[TEXT]",
- )
- println(result); // Resource URL
- }
- }
-}
\ No newline at end of file
+val result = avatars.getQR(
+ text = "[TEXT]",
+)
diff --git a/docs/examples/kotlin/databases/create-document.md b/docs/examples/kotlin/databases/create-document.md
index 8a755a2..da4d1eb 100644
--- a/docs/examples/kotlin/databases/create-document.md
+++ b/docs/examples/kotlin/databases/create-document.md
@@ -1,29 +1,15 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Databases
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val databases = Databases(client)
- val databases = Databases(client)
-
- GlobalScope.launch {
- val response = databases.createDocument(
- databaseId = "[DATABASE_ID]",
- collectionId = "[COLLECTION_ID]",
- documentId = "[DOCUMENT_ID]",
- data = mapOf( "a" to "b" ),
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = databases.createDocument(
+ databaseId = "[DATABASE_ID]",
+ collectionId = "[COLLECTION_ID]",
+ documentId = "[DOCUMENT_ID]",
+ data = mapOf( "a" to "b" ),
+)
diff --git a/docs/examples/kotlin/databases/delete-document.md b/docs/examples/kotlin/databases/delete-document.md
index f56293b..bb2193e 100644
--- a/docs/examples/kotlin/databases/delete-document.md
+++ b/docs/examples/kotlin/databases/delete-document.md
@@ -1,28 +1,14 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Databases
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val databases = Databases(client)
- val databases = Databases(client)
-
- GlobalScope.launch {
- val response = databases.deleteDocument(
- databaseId = "[DATABASE_ID]",
- collectionId = "[COLLECTION_ID]",
- documentId = "[DOCUMENT_ID]"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = databases.deleteDocument(
+ databaseId = "[DATABASE_ID]",
+ collectionId = "[COLLECTION_ID]",
+ documentId = "[DOCUMENT_ID]"
+)
diff --git a/docs/examples/kotlin/databases/get-document.md b/docs/examples/kotlin/databases/get-document.md
index 1f5bf29..b81f340 100644
--- a/docs/examples/kotlin/databases/get-document.md
+++ b/docs/examples/kotlin/databases/get-document.md
@@ -1,28 +1,14 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Databases
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val databases = Databases(client)
- val databases = Databases(client)
-
- GlobalScope.launch {
- val response = databases.getDocument(
- databaseId = "[DATABASE_ID]",
- collectionId = "[COLLECTION_ID]",
- documentId = "[DOCUMENT_ID]"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = databases.getDocument(
+ databaseId = "[DATABASE_ID]",
+ collectionId = "[COLLECTION_ID]",
+ documentId = "[DOCUMENT_ID]"
+)
diff --git a/docs/examples/kotlin/databases/list-documents.md b/docs/examples/kotlin/databases/list-documents.md
index 5277b46..0c2be1a 100644
--- a/docs/examples/kotlin/databases/list-documents.md
+++ b/docs/examples/kotlin/databases/list-documents.md
@@ -1,27 +1,13 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Databases
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val databases = Databases(client)
- val databases = Databases(client)
-
- GlobalScope.launch {
- val response = databases.listDocuments(
- databaseId = "[DATABASE_ID]",
- collectionId = "[COLLECTION_ID]",
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = databases.listDocuments(
+ databaseId = "[DATABASE_ID]",
+ collectionId = "[COLLECTION_ID]",
+)
diff --git a/docs/examples/kotlin/databases/update-document.md b/docs/examples/kotlin/databases/update-document.md
index 7807f52..68cc42e 100644
--- a/docs/examples/kotlin/databases/update-document.md
+++ b/docs/examples/kotlin/databases/update-document.md
@@ -1,28 +1,14 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Databases
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val databases = Databases(client)
- val databases = Databases(client)
-
- GlobalScope.launch {
- val response = databases.updateDocument(
- databaseId = "[DATABASE_ID]",
- collectionId = "[COLLECTION_ID]",
- documentId = "[DOCUMENT_ID]",
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = databases.updateDocument(
+ databaseId = "[DATABASE_ID]",
+ collectionId = "[COLLECTION_ID]",
+ documentId = "[DOCUMENT_ID]",
+)
diff --git a/docs/examples/kotlin/functions/create-execution.md b/docs/examples/kotlin/functions/create-execution.md
index 3a7e599..b064201 100644
--- a/docs/examples/kotlin/functions/create-execution.md
+++ b/docs/examples/kotlin/functions/create-execution.md
@@ -1,26 +1,12 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Functions
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val functions = Functions(client)
- val functions = Functions(client)
-
- GlobalScope.launch {
- val response = functions.createExecution(
- functionId = "[FUNCTION_ID]",
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = functions.createExecution(
+ functionId = "[FUNCTION_ID]",
+)
diff --git a/docs/examples/kotlin/functions/get-execution.md b/docs/examples/kotlin/functions/get-execution.md
index 781f26c..2f9d5ef 100644
--- a/docs/examples/kotlin/functions/get-execution.md
+++ b/docs/examples/kotlin/functions/get-execution.md
@@ -1,27 +1,13 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Functions
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val functions = Functions(client)
- val functions = Functions(client)
-
- GlobalScope.launch {
- val response = functions.getExecution(
- functionId = "[FUNCTION_ID]",
- executionId = "[EXECUTION_ID]"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = functions.getExecution(
+ functionId = "[FUNCTION_ID]",
+ executionId = "[EXECUTION_ID]"
+)
diff --git a/docs/examples/kotlin/functions/list-executions.md b/docs/examples/kotlin/functions/list-executions.md
index 4f11574..d8a1aa1 100644
--- a/docs/examples/kotlin/functions/list-executions.md
+++ b/docs/examples/kotlin/functions/list-executions.md
@@ -1,26 +1,12 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Functions
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val functions = Functions(client)
- val functions = Functions(client)
-
- GlobalScope.launch {
- val response = functions.listExecutions(
- functionId = "[FUNCTION_ID]",
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = functions.listExecutions(
+ functionId = "[FUNCTION_ID]",
+)
diff --git a/docs/examples/kotlin/functions/retry-build.md b/docs/examples/kotlin/functions/retry-build.md
deleted file mode 100644
index 597421c..0000000
--- a/docs/examples/kotlin/functions/retry-build.md
+++ /dev/null
@@ -1,28 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Functions
-
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
-
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
-
- val functions = Functions(client)
-
- GlobalScope.launch {
- val response = functions.retryBuild(
- functionId = "[FUNCTION_ID]",
- deploymentId = "[DEPLOYMENT_ID]",
- buildId = "[BUILD_ID]"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
diff --git a/docs/examples/kotlin/graphql/mutation.md b/docs/examples/kotlin/graphql/mutation.md
new file mode 100644
index 0000000..7222301
--- /dev/null
+++ b/docs/examples/kotlin/graphql/mutation.md
@@ -0,0 +1,12 @@
+import io.appwrite.Client
+import io.appwrite.services.Graphql
+
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+
+val graphql = Graphql(client)
+
+val response = graphql.mutation(
+ query = mapOf( "a" to "b" )
+)
diff --git a/docs/examples/kotlin/graphql/query.md b/docs/examples/kotlin/graphql/query.md
new file mode 100644
index 0000000..db0f571
--- /dev/null
+++ b/docs/examples/kotlin/graphql/query.md
@@ -0,0 +1,12 @@
+import io.appwrite.Client
+import io.appwrite.services.Graphql
+
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+
+val graphql = Graphql(client)
+
+val response = graphql.query(
+ query = mapOf( "a" to "b" )
+)
diff --git a/docs/examples/kotlin/locale/get-continents.md b/docs/examples/kotlin/locale/get-continents.md
deleted file mode 100644
index faf1448..0000000
--- a/docs/examples/kotlin/locale/get-continents.md
+++ /dev/null
@@ -1,24 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
-
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
-
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
-
- val locale = Locale(client)
-
- GlobalScope.launch {
- val response = locale.getContinents()
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
diff --git a/docs/examples/kotlin/locale/get-countries-e-u.md b/docs/examples/kotlin/locale/get-countries-e-u.md
deleted file mode 100644
index 5a3552f..0000000
--- a/docs/examples/kotlin/locale/get-countries-e-u.md
+++ /dev/null
@@ -1,24 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
-
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
-
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
-
- val locale = Locale(client)
-
- GlobalScope.launch {
- val response = locale.getCountriesEU()
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
diff --git a/docs/examples/kotlin/locale/get-countries-phones.md b/docs/examples/kotlin/locale/get-countries-phones.md
deleted file mode 100644
index 565097e..0000000
--- a/docs/examples/kotlin/locale/get-countries-phones.md
+++ /dev/null
@@ -1,24 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
-
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
-
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
-
- val locale = Locale(client)
-
- GlobalScope.launch {
- val response = locale.getCountriesPhones()
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
diff --git a/docs/examples/kotlin/locale/get-countries.md b/docs/examples/kotlin/locale/get-countries.md
deleted file mode 100644
index e327c14..0000000
--- a/docs/examples/kotlin/locale/get-countries.md
+++ /dev/null
@@ -1,24 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
-
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
-
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
-
- val locale = Locale(client)
-
- GlobalScope.launch {
- val response = locale.getCountries()
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
diff --git a/docs/examples/kotlin/locale/get-currencies.md b/docs/examples/kotlin/locale/get-currencies.md
deleted file mode 100644
index 00e1199..0000000
--- a/docs/examples/kotlin/locale/get-currencies.md
+++ /dev/null
@@ -1,24 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
-
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
-
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
-
- val locale = Locale(client)
-
- GlobalScope.launch {
- val response = locale.getCurrencies()
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
diff --git a/docs/examples/kotlin/locale/get-languages.md b/docs/examples/kotlin/locale/get-languages.md
deleted file mode 100644
index 796747a..0000000
--- a/docs/examples/kotlin/locale/get-languages.md
+++ /dev/null
@@ -1,24 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
-
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
-
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
-
- val locale = Locale(client)
-
- GlobalScope.launch {
- val response = locale.getLanguages()
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
diff --git a/docs/examples/kotlin/locale/get.md b/docs/examples/kotlin/locale/get.md
index f89c66a..da6b040 100644
--- a/docs/examples/kotlin/locale/get.md
+++ b/docs/examples/kotlin/locale/get.md
@@ -1,24 +1,10 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Locale
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val locale = Locale(client)
- val locale = Locale(client)
-
- GlobalScope.launch {
- val response = locale.get()
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = locale.get()
diff --git a/docs/examples/kotlin/locale/list-continents.md b/docs/examples/kotlin/locale/list-continents.md
index b582b40..8836a6c 100644
--- a/docs/examples/kotlin/locale/list-continents.md
+++ b/docs/examples/kotlin/locale/list-continents.md
@@ -1,24 +1,10 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Locale
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val locale = Locale(client)
- val locale = Locale(client)
-
- GlobalScope.launch {
- val response = locale.listContinents()
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = locale.listContinents()
diff --git a/docs/examples/kotlin/locale/list-countries-e-u.md b/docs/examples/kotlin/locale/list-countries-e-u.md
index 133da97..051c191 100644
--- a/docs/examples/kotlin/locale/list-countries-e-u.md
+++ b/docs/examples/kotlin/locale/list-countries-e-u.md
@@ -1,24 +1,10 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Locale
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val locale = Locale(client)
- val locale = Locale(client)
-
- GlobalScope.launch {
- val response = locale.listCountriesEU()
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = locale.listCountriesEU()
diff --git a/docs/examples/kotlin/locale/list-countries-phones.md b/docs/examples/kotlin/locale/list-countries-phones.md
index 7f17f47..c6efaae 100644
--- a/docs/examples/kotlin/locale/list-countries-phones.md
+++ b/docs/examples/kotlin/locale/list-countries-phones.md
@@ -1,24 +1,10 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Locale
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val locale = Locale(client)
- val locale = Locale(client)
-
- GlobalScope.launch {
- val response = locale.listCountriesPhones()
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = locale.listCountriesPhones()
diff --git a/docs/examples/kotlin/locale/list-countries.md b/docs/examples/kotlin/locale/list-countries.md
index 1d83452..4e2eeef 100644
--- a/docs/examples/kotlin/locale/list-countries.md
+++ b/docs/examples/kotlin/locale/list-countries.md
@@ -1,24 +1,10 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Locale
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val locale = Locale(client)
- val locale = Locale(client)
-
- GlobalScope.launch {
- val response = locale.listCountries()
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = locale.listCountries()
diff --git a/docs/examples/kotlin/locale/list-currencies.md b/docs/examples/kotlin/locale/list-currencies.md
index 657652f..f565be6 100644
--- a/docs/examples/kotlin/locale/list-currencies.md
+++ b/docs/examples/kotlin/locale/list-currencies.md
@@ -1,24 +1,10 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Locale
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val locale = Locale(client)
- val locale = Locale(client)
-
- GlobalScope.launch {
- val response = locale.listCurrencies()
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = locale.listCurrencies()
diff --git a/docs/examples/kotlin/locale/list-languages.md b/docs/examples/kotlin/locale/list-languages.md
index bdf023e..284f5ba 100644
--- a/docs/examples/kotlin/locale/list-languages.md
+++ b/docs/examples/kotlin/locale/list-languages.md
@@ -1,24 +1,10 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Locale
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val locale = Locale(client)
- val locale = Locale(client)
-
- GlobalScope.launch {
- val response = locale.listLanguages()
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = locale.listLanguages()
diff --git a/docs/examples/kotlin/storage/create-file.md b/docs/examples/kotlin/storage/create-file.md
index d3d7c60..fd52716 100644
--- a/docs/examples/kotlin/storage/create-file.md
+++ b/docs/examples/kotlin/storage/create-file.md
@@ -1,29 +1,15 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.models.InputFile
import io.appwrite.services.Storage
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val storage = Storage(client)
- val storage = Storage(client)
-
- GlobalScope.launch {
- val response = storage.createFile(
- bucketId = "[BUCKET_ID]",
- fileId = "[FILE_ID]",
- file = InputFile.fromPath("file.png"),
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = storage.createFile(
+ bucketId = "[BUCKET_ID]",
+ fileId = "[FILE_ID]",
+ file = InputFile.fromPath("file.png"),
+)
diff --git a/docs/examples/kotlin/storage/delete-file.md b/docs/examples/kotlin/storage/delete-file.md
index 1a4a5b9..945e1b9 100644
--- a/docs/examples/kotlin/storage/delete-file.md
+++ b/docs/examples/kotlin/storage/delete-file.md
@@ -1,27 +1,13 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Storage
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val storage = Storage(client)
- val storage = Storage(client)
-
- GlobalScope.launch {
- val response = storage.deleteFile(
- bucketId = "[BUCKET_ID]",
- fileId = "[FILE_ID]"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = storage.deleteFile(
+ bucketId = "[BUCKET_ID]",
+ fileId = "[FILE_ID]"
+)
diff --git a/docs/examples/kotlin/storage/get-file-download.md b/docs/examples/kotlin/storage/get-file-download.md
index 3970fb8..b5fde87 100644
--- a/docs/examples/kotlin/storage/get-file-download.md
+++ b/docs/examples/kotlin/storage/get-file-download.md
@@ -1,27 +1,13 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Storage
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val storage = Storage(client)
- val storage = Storage(client)
-
- GlobalScope.launch {
- val result = storage.getFileDownload(
- bucketId = "[BUCKET_ID]",
- fileId = "[FILE_ID]"
- )
- println(result); // Resource URL
- }
- }
-}
\ No newline at end of file
+val result = storage.getFileDownload(
+ bucketId = "[BUCKET_ID]",
+ fileId = "[FILE_ID]"
+)
diff --git a/docs/examples/kotlin/storage/get-file-preview.md b/docs/examples/kotlin/storage/get-file-preview.md
index 7804527..ea7d8d4 100644
--- a/docs/examples/kotlin/storage/get-file-preview.md
+++ b/docs/examples/kotlin/storage/get-file-preview.md
@@ -1,27 +1,13 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Storage
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val storage = Storage(client)
- val storage = Storage(client)
-
- GlobalScope.launch {
- val result = storage.getFilePreview(
- bucketId = "[BUCKET_ID]",
- fileId = "[FILE_ID]",
- )
- println(result); // Resource URL
- }
- }
-}
\ No newline at end of file
+val result = storage.getFilePreview(
+ bucketId = "[BUCKET_ID]",
+ fileId = "[FILE_ID]",
+)
diff --git a/docs/examples/kotlin/storage/get-file-view.md b/docs/examples/kotlin/storage/get-file-view.md
index 107ad45..c266fca 100644
--- a/docs/examples/kotlin/storage/get-file-view.md
+++ b/docs/examples/kotlin/storage/get-file-view.md
@@ -1,27 +1,13 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Storage
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val storage = Storage(client)
- val storage = Storage(client)
-
- GlobalScope.launch {
- val result = storage.getFileView(
- bucketId = "[BUCKET_ID]",
- fileId = "[FILE_ID]"
- )
- println(result); // Resource URL
- }
- }
-}
\ No newline at end of file
+val result = storage.getFileView(
+ bucketId = "[BUCKET_ID]",
+ fileId = "[FILE_ID]"
+)
diff --git a/docs/examples/kotlin/storage/get-file.md b/docs/examples/kotlin/storage/get-file.md
index 30f640b..73fd9a8 100644
--- a/docs/examples/kotlin/storage/get-file.md
+++ b/docs/examples/kotlin/storage/get-file.md
@@ -1,27 +1,13 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Storage
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val storage = Storage(client)
- val storage = Storage(client)
-
- GlobalScope.launch {
- val response = storage.getFile(
- bucketId = "[BUCKET_ID]",
- fileId = "[FILE_ID]"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = storage.getFile(
+ bucketId = "[BUCKET_ID]",
+ fileId = "[FILE_ID]"
+)
diff --git a/docs/examples/kotlin/storage/list-files.md b/docs/examples/kotlin/storage/list-files.md
index 20a253a..f915e5a 100644
--- a/docs/examples/kotlin/storage/list-files.md
+++ b/docs/examples/kotlin/storage/list-files.md
@@ -1,26 +1,12 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Storage
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val storage = Storage(client)
- val storage = Storage(client)
-
- GlobalScope.launch {
- val response = storage.listFiles(
- bucketId = "[BUCKET_ID]",
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = storage.listFiles(
+ bucketId = "[BUCKET_ID]",
+)
diff --git a/docs/examples/kotlin/storage/update-file.md b/docs/examples/kotlin/storage/update-file.md
index 35b1afb..23ce52a 100644
--- a/docs/examples/kotlin/storage/update-file.md
+++ b/docs/examples/kotlin/storage/update-file.md
@@ -1,27 +1,13 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Storage
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val storage = Storage(client)
- val storage = Storage(client)
-
- GlobalScope.launch {
- val response = storage.updateFile(
- bucketId = "[BUCKET_ID]",
- fileId = "[FILE_ID]",
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = storage.updateFile(
+ bucketId = "[BUCKET_ID]",
+ fileId = "[FILE_ID]",
+)
diff --git a/docs/examples/kotlin/teams/create-membership.md b/docs/examples/kotlin/teams/create-membership.md
index e2b7d16..60d39c0 100644
--- a/docs/examples/kotlin/teams/create-membership.md
+++ b/docs/examples/kotlin/teams/create-membership.md
@@ -1,29 +1,15 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Teams
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val teams = Teams(client)
- val teams = Teams(client)
-
- GlobalScope.launch {
- val response = teams.createMembership(
- teamId = "[TEAM_ID]",
- email = "email@example.com",
- roles = listOf(),
- url = "https://example.com",
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = teams.createMembership(
+ teamId = "[TEAM_ID]",
+ email = "email@example.com",
+ roles = listOf(),
+ url = "https://example.com",
+)
diff --git a/docs/examples/kotlin/teams/create.md b/docs/examples/kotlin/teams/create.md
index 73857b8..26bef65 100644
--- a/docs/examples/kotlin/teams/create.md
+++ b/docs/examples/kotlin/teams/create.md
@@ -1,27 +1,13 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Teams
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val teams = Teams(client)
- val teams = Teams(client)
-
- GlobalScope.launch {
- val response = teams.create(
- teamId = "[TEAM_ID]",
- name = "[NAME]",
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = teams.create(
+ teamId = "[TEAM_ID]",
+ name = "[NAME]",
+)
diff --git a/docs/examples/kotlin/teams/delete-membership.md b/docs/examples/kotlin/teams/delete-membership.md
index 6545af5..ac1b37a 100644
--- a/docs/examples/kotlin/teams/delete-membership.md
+++ b/docs/examples/kotlin/teams/delete-membership.md
@@ -1,27 +1,13 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Teams
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val teams = Teams(client)
- val teams = Teams(client)
-
- GlobalScope.launch {
- val response = teams.deleteMembership(
- teamId = "[TEAM_ID]",
- membershipId = "[MEMBERSHIP_ID]"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = teams.deleteMembership(
+ teamId = "[TEAM_ID]",
+ membershipId = "[MEMBERSHIP_ID]"
+)
diff --git a/docs/examples/kotlin/teams/delete.md b/docs/examples/kotlin/teams/delete.md
index de12449..c5bcd37 100644
--- a/docs/examples/kotlin/teams/delete.md
+++ b/docs/examples/kotlin/teams/delete.md
@@ -1,26 +1,12 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Teams
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val teams = Teams(client)
- val teams = Teams(client)
-
- GlobalScope.launch {
- val response = teams.delete(
- teamId = "[TEAM_ID]"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = teams.delete(
+ teamId = "[TEAM_ID]"
+)
diff --git a/docs/examples/kotlin/teams/get-membership.md b/docs/examples/kotlin/teams/get-membership.md
index aa3f29e..1ee6ec0 100644
--- a/docs/examples/kotlin/teams/get-membership.md
+++ b/docs/examples/kotlin/teams/get-membership.md
@@ -1,27 +1,13 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Teams
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val teams = Teams(client)
- val teams = Teams(client)
-
- GlobalScope.launch {
- val response = teams.getMembership(
- teamId = "[TEAM_ID]",
- membershipId = "[MEMBERSHIP_ID]"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = teams.getMembership(
+ teamId = "[TEAM_ID]",
+ membershipId = "[MEMBERSHIP_ID]"
+)
diff --git a/docs/examples/kotlin/teams/get-memberships.md b/docs/examples/kotlin/teams/get-memberships.md
deleted file mode 100644
index 89b4f54..0000000
--- a/docs/examples/kotlin/teams/get-memberships.md
+++ /dev/null
@@ -1,26 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Teams
-
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
-
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
-
- val teams = Teams(client)
-
- GlobalScope.launch {
- val response = teams.getMemberships(
- teamId = "[TEAM_ID]",
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/get.md b/docs/examples/kotlin/teams/get.md
index 54550b3..557e998 100644
--- a/docs/examples/kotlin/teams/get.md
+++ b/docs/examples/kotlin/teams/get.md
@@ -1,26 +1,12 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Teams
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val teams = Teams(client)
- val teams = Teams(client)
-
- GlobalScope.launch {
- val response = teams.get(
- teamId = "[TEAM_ID]"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = teams.get(
+ teamId = "[TEAM_ID]"
+)
diff --git a/docs/examples/kotlin/teams/list-memberships.md b/docs/examples/kotlin/teams/list-memberships.md
index 32ef3bd..d7f2920 100644
--- a/docs/examples/kotlin/teams/list-memberships.md
+++ b/docs/examples/kotlin/teams/list-memberships.md
@@ -1,26 +1,12 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Teams
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val teams = Teams(client)
- val teams = Teams(client)
-
- GlobalScope.launch {
- val response = teams.listMemberships(
- teamId = "[TEAM_ID]",
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = teams.listMemberships(
+ teamId = "[TEAM_ID]",
+)
diff --git a/docs/examples/kotlin/teams/list.md b/docs/examples/kotlin/teams/list.md
index 6444205..f056d33 100644
--- a/docs/examples/kotlin/teams/list.md
+++ b/docs/examples/kotlin/teams/list.md
@@ -1,25 +1,11 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Teams
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val teams = Teams(client)
- val teams = Teams(client)
-
- GlobalScope.launch {
- val response = teams.list(
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = teams.list(
+)
diff --git a/docs/examples/kotlin/teams/update-membership-roles.md b/docs/examples/kotlin/teams/update-membership-roles.md
index d9a8a41..5727e11 100644
--- a/docs/examples/kotlin/teams/update-membership-roles.md
+++ b/docs/examples/kotlin/teams/update-membership-roles.md
@@ -1,28 +1,14 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Teams
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val teams = Teams(client)
- val teams = Teams(client)
-
- GlobalScope.launch {
- val response = teams.updateMembershipRoles(
- teamId = "[TEAM_ID]",
- membershipId = "[MEMBERSHIP_ID]",
- roles = listOf()
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = teams.updateMembershipRoles(
+ teamId = "[TEAM_ID]",
+ membershipId = "[MEMBERSHIP_ID]",
+ roles = listOf()
+)
diff --git a/docs/examples/kotlin/teams/update-membership-status.md b/docs/examples/kotlin/teams/update-membership-status.md
index f8e10fd..a36b710 100644
--- a/docs/examples/kotlin/teams/update-membership-status.md
+++ b/docs/examples/kotlin/teams/update-membership-status.md
@@ -1,29 +1,15 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Teams
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val teams = Teams(client)
- val teams = Teams(client)
-
- GlobalScope.launch {
- val response = teams.updateMembershipStatus(
- teamId = "[TEAM_ID]",
- membershipId = "[MEMBERSHIP_ID]",
- userId = "[USER_ID]",
- secret = "[SECRET]"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = teams.updateMembershipStatus(
+ teamId = "[TEAM_ID]",
+ membershipId = "[MEMBERSHIP_ID]",
+ userId = "[USER_ID]",
+ secret = "[SECRET]"
+)
diff --git a/docs/examples/kotlin/teams/update.md b/docs/examples/kotlin/teams/update.md
index 59dd69f..1a54434 100644
--- a/docs/examples/kotlin/teams/update.md
+++ b/docs/examples/kotlin/teams/update.md
@@ -1,27 +1,13 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Teams
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
- val client = Client(applicationContext)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+val teams = Teams(client)
- val teams = Teams(client)
-
- GlobalScope.launch {
- val response = teams.update(
- teamId = "[TEAM_ID]",
- name = "[NAME]"
- )
- val json = response.body?.string()
- }
- }
-}
\ No newline at end of file
+val response = teams.update(
+ teamId = "[TEAM_ID]",
+ name = "[NAME]"
+)
diff --git a/example-java/src/main/java/io/appwrite/example_java/MainActivity.java b/example-java/src/main/java/io/appwrite/example_java/MainActivity.java
index 28e3222..04f46b3 100644
--- a/example-java/src/main/java/io/appwrite/example_java/MainActivity.java
+++ b/example-java/src/main/java/io/appwrite/example_java/MainActivity.java
@@ -1,18 +1,13 @@
package io.appwrite.example_java;
-import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
-import org.jetbrains.annotations.NotNull;
+
+import androidx.appcompat.app.AppCompatActivity;
+
import io.appwrite.Client;
-import io.appwrite.exceptions.AppwriteException;
-import io.appwrite.extensions.JsonExtensionsKt;
-import io.appwrite.models.Session;
+import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Account;
-import kotlin.Result;
-import kotlin.coroutines.Continuation;
-import kotlin.coroutines.CoroutineContext;
-import kotlin.coroutines.EmptyCoroutineContext;
public class MainActivity extends AppCompatActivity {
@@ -27,31 +22,13 @@ protected void onCreate(Bundle savedInstanceState) {
Account account = new Account(client);
- try {
- account.createSession("test7@test.com","password", new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Session session = (Session) o;
- Log.d("RESPONSE", JsonExtensionsKt.toJson(session));
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
- } catch (AppwriteException e) {
- e.printStackTrace();
- }
+ account.createEmailSession("test7@test.com", "password", new CoroutineCallback<>((session, error) -> {
+ if (error != null) {
+ Log.e("Appwrite", error.getMessage());
+ return;
+ }
+
+ Log.d("Appwrite", session.toMap().toString());
+ }));
}
}
\ No newline at end of file
diff --git a/example/src/main/java/io/appwrite/android/ui/accounts/AccountsViewModel.kt b/example/src/main/java/io/appwrite/android/ui/accounts/AccountsViewModel.kt
index 1e7b084..ede86d3 100644
--- a/example/src/main/java/io/appwrite/android/ui/accounts/AccountsViewModel.kt
+++ b/example/src/main/java/io/appwrite/android/ui/accounts/AccountsViewModel.kt
@@ -29,7 +29,7 @@ class AccountsViewModel : ViewModel() {
fun onLogin(email: Editable, password: Editable) {
viewModelScope.launch {
try {
- val session = accountService.createSession(email.toString(), password.toString())
+ val session = accountService.createEmailSession(email.toString(), password.toString())
_response.postValue(Event(session.toJson()))
} catch (e: AppwriteException) {
_error.postValue(Event(e))
diff --git a/library/build.gradle b/library/build.gradle
index 7045591..6be6a48 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -22,11 +22,11 @@ ext {
version PUBLISH_VERSION
android {
- compileSdkVersion(31)
+ compileSdkVersion(33)
defaultConfig {
minSdkVersion(21)
- targetSdkVersion(31)
+ targetSdkVersion(33)
versionCode = 1
versionName = "1.0"
buildConfigField "String", "SDK_VERSION", "\"${PUBLISH_VERSION}\""
@@ -54,27 +54,27 @@ android {
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION}")
- api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2")
- api("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2")
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1")
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1")
- api(platform("com.squareup.okhttp3:okhttp-bom:4.9.0"))
+ api(platform("com.squareup.okhttp3:okhttp-bom:4.10.0"))
api("com.squareup.okhttp3:okhttp")
implementation("com.squareup.okhttp3:okhttp-urlconnection")
implementation("com.squareup.okhttp3:logging-interceptor")
- implementation("com.google.code.gson:gson:2.8.7")
+ implementation("com.google.code.gson:gson:2.9.0")
- implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.3.1")
- implementation("androidx.lifecycle:lifecycle-common-java8:2.3.1")
- implementation("androidx.appcompat:appcompat:1.3.1")
- implementation("androidx.fragment:fragment-ktx:1.3.6")
- implementation("androidx.activity:activity-ktx:1.3.1")
- implementation("androidx.browser:browser:1.3.0")
+ implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.5.1")
+ implementation("androidx.lifecycle:lifecycle-common-java8:2.5.1")
+ implementation("androidx.appcompat:appcompat:1.5.1")
+ implementation("androidx.fragment:fragment-ktx:1.5.3")
+ implementation("androidx.activity:activity-ktx:1.6.0")
+ implementation("androidx.browser:browser:1.4.0")
testImplementation 'junit:junit:4.+'
testImplementation "androidx.test.ext:junit-ktx:1.1.3"
testImplementation "androidx.test:core-ktx:1.4.0"
testImplementation "org.robolectric:robolectric:4.5.1"
- testApi("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.1")
+ testApi("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.1")
}
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/Client.kt b/library/src/main/java/io/appwrite/Client.kt
index 7faa46d..0d87b5b 100644
--- a/library/src/main/java/io/appwrite/Client.kt
+++ b/library/src/main/java/io/appwrite/Client.kt
@@ -88,7 +88,7 @@ class Client @JvmOverloads constructor(
"x-sdk-name" to "Android",
"x-sdk-platform" to "client",
"x-sdk-language" to "android",
- "x-sdk-version" to "1.1.0",
+ "x-sdk-version" to "1.2.0",
"x-appwrite-response-format" to "1.0.0"
)
config = mutableMapOf()
@@ -250,7 +250,7 @@ class Client @JvmOverloads constructor(
headers: Map = mapOf(),
params: Map = mapOf(),
responseType: Class,
- converter: ((Map) -> T)? = null
+ converter: ((Any) -> T)? = null
): T {
val filteredParams = params.filterValues { it != null }
@@ -341,7 +341,7 @@ class Client @JvmOverloads constructor(
headers: MutableMap,
params: MutableMap,
responseType: Class,
- converter: ((Map) -> T),
+ converter: ((Any) -> T),
paramName: String,
idParamName: String? = null,
onProgress: ((UploadProgress) -> Unit)? = null,
@@ -464,7 +464,7 @@ class Client @JvmOverloads constructor(
private suspend fun awaitResponse(
request: Request,
responseType: Class,
- converter: ((Map) -> T)? = null
+ converter: ((Any) -> T)? = null
) = suspendCancellableCoroutine {
http.newCall(request).enqueue(object : Callback {
override fun onFailure(call: Call, e: IOException) {
@@ -525,9 +525,9 @@ class Client @JvmOverloads constructor(
it.resume(true as T)
return
}
- val map = gson.fromJson>(
+ val map = gson.fromJson(
body,
- object : TypeToken>(){}.type
+ object : TypeToken(){}.type
)
it.resume(
converter?.invoke(map) ?: map as T
diff --git a/library/src/main/java/io/appwrite/coroutines/Callback.kt b/library/src/main/java/io/appwrite/coroutines/Callback.kt
new file mode 100644
index 0000000..baa30fe
--- /dev/null
+++ b/library/src/main/java/io/appwrite/coroutines/Callback.kt
@@ -0,0 +1,18 @@
+package io.appwrite.coroutines
+
+import kotlinx.coroutines.Dispatchers
+import kotlin.coroutines.Continuation
+import kotlin.coroutines.CoroutineContext
+
+interface Callback {
+ fun onComplete(result: T?, error: Throwable?)
+}
+
+class CoroutineCallback @JvmOverloads constructor(
+ private val callback: Callback,
+ override val context: CoroutineContext = Dispatchers.Default
+) : Continuation {
+ override fun resumeWith(result: Result) {
+ callback.onComplete(result.getOrNull(), result.exceptionOrNull())
+ }
+}
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/extensions/TypeExtensions.kt b/library/src/main/java/io/appwrite/extensions/TypeExtensions.kt
new file mode 100644
index 0000000..2674b99
--- /dev/null
+++ b/library/src/main/java/io/appwrite/extensions/TypeExtensions.kt
@@ -0,0 +1,8 @@
+package io.appwrite.extensions
+
+import kotlin.reflect.KClass
+import kotlin.reflect.typeOf
+
+inline fun classOf(): Class {
+ return (typeOf().classifier!! as KClass).java
+}
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/models/Account.kt b/library/src/main/java/io/appwrite/models/Account.kt
index 1450b82..1b87beb 100644
--- a/library/src/main/java/io/appwrite/models/Account.kt
+++ b/library/src/main/java/io/appwrite/models/Account.kt
@@ -1,98 +1,134 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
+import io.appwrite.extensions.jsonCast
/**
* Account
*/
-data class Account(
+data class Account(
/**
* User ID.
- *
*/
@SerializedName("\$id")
val id: String,
/**
* User creation date in ISO 8601 format.
- *
*/
@SerializedName("\$createdAt")
val createdAt: String,
/**
* User update date in ISO 8601 format.
- *
*/
@SerializedName("\$updatedAt")
val updatedAt: String,
/**
* User name.
- *
*/
@SerializedName("name")
val name: String,
/**
* User registration date in ISO 8601 format.
- *
*/
@SerializedName("registration")
val registration: String,
/**
* User status. Pass `true` for enabled and `false` for disabled.
- *
*/
@SerializedName("status")
val status: Boolean,
/**
* Password update time in ISO 8601 format.
- *
*/
@SerializedName("passwordUpdate")
val passwordUpdate: String,
/**
* User email address.
- *
*/
@SerializedName("email")
val email: String,
/**
* User phone number in E.164 format.
- *
*/
@SerializedName("phone")
val phone: String,
/**
* Email verification status.
- *
*/
@SerializedName("emailVerification")
val emailVerification: Boolean,
/**
* Phone verification status.
- *
*/
@SerializedName("phoneVerification")
val phoneVerification: Boolean,
/**
* User preferences as a key-value object
- *
*/
@SerializedName("prefs")
- val prefs: Preferences
+ val prefs: Preferences,
+
) {
+ fun toMap(): Map = mapOf(
+ "\$id" to id as Any,
+ "\$createdAt" to createdAt as Any,
+ "\$updatedAt" to updatedAt as Any,
+ "name" to name as Any,
+ "registration" to registration as Any,
+ "status" to status 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,
+ )
+
companion object {
+ operator fun invoke(
+ id: String,
+ createdAt: String,
+ updatedAt: String,
+ name: String,
+ registration: String,
+ status: Boolean,
+ passwordUpdate: String,
+ email: String,
+ phone: String,
+ emailVerification: Boolean,
+ phoneVerification: Boolean,
+ prefs: Preferences>,
+ ) = Account>(
+ id,
+ createdAt,
+ updatedAt,
+ name,
+ registration,
+ status,
+ passwordUpdate,
+ email,
+ phone,
+ emailVerification,
+ phoneVerification,
+ prefs,
+ )
+
@Suppress("UNCHECKED_CAST")
- fun from(map: Map) = Account(
+ fun from(
+ map: Map,
+ nestedType: Class
+ ) = Account(
id = map["\$id"] as String,
createdAt = map["\$createdAt"] as String,
updatedAt = map["\$updatedAt"] as String,
@@ -104,22 +140,7 @@ data class Account(
phone = map["phone"] as String,
emailVerification = map["emailVerification"] as Boolean,
phoneVerification = map["phoneVerification"] as Boolean,
- prefs = Preferences.from(map = map["prefs"] as Map)
+ prefs = Preferences.from(map = map["prefs"] as Map, nestedType),
)
}
-
- fun toMap(): Map = mapOf(
- "\$id" to id as Any,
- "\$createdAt" to createdAt as Any,
- "\$updatedAt" to updatedAt as Any,
- "name" to name as Any,
- "registration" to registration as Any,
- "status" to status 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
- )
}
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/models/Continent.kt b/library/src/main/java/io/appwrite/models/Continent.kt
index ba8b5ae..818c15b 100644
--- a/library/src/main/java/io/appwrite/models/Continent.kt
+++ b/library/src/main/java/io/appwrite/models/Continent.kt
@@ -1,6 +1,7 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
+import io.appwrite.extensions.jsonCast
/**
* Continent
@@ -8,28 +9,30 @@ import com.google.gson.annotations.SerializedName
data class Continent(
/**
* Continent name.
- *
*/
@SerializedName("name")
val name: String,
/**
* Continent two letter code.
- *
*/
@SerializedName("code")
- val code: String
+ val code: String,
+
) {
+ fun toMap(): Map = mapOf(
+ "name" to name as Any,
+ "code" to code as Any,
+ )
+
companion object {
+
@Suppress("UNCHECKED_CAST")
- fun from(map: Map) = Continent(
+ fun from(
+ map: Map,
+ ) = Continent(
name = map["name"] as String,
- code = map["code"] as String
+ code = map["code"] as String,
)
}
-
- fun toMap(): Map = mapOf(
- "name" to name as Any,
- "code" to code as Any
- )
}
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/models/ContinentList.kt b/library/src/main/java/io/appwrite/models/ContinentList.kt
index 6a09c92..fdd490a 100644
--- a/library/src/main/java/io/appwrite/models/ContinentList.kt
+++ b/library/src/main/java/io/appwrite/models/ContinentList.kt
@@ -1,6 +1,7 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
+import io.appwrite.extensions.jsonCast
/**
* Continents List
@@ -8,28 +9,30 @@ import com.google.gson.annotations.SerializedName
data class ContinentList(
/**
* Total number of continents documents that matched your query.
- *
*/
@SerializedName("total")
val total: Long,
/**
* List of continents.
- *
*/
@SerializedName("continents")
- val continents: List
+ val continents: List,
+
) {
+ fun toMap(): Map = mapOf(
+ "total" to total as Any,
+ "continents" to continents.map { it.toMap() } as Any,
+ )
+
companion object {
+
@Suppress("UNCHECKED_CAST")
- fun from(map: Map) = ContinentList(
+ fun from(
+ map: Map,
+ ) = ContinentList(
total = (map["total"] as Number).toLong(),
- continents = (map["continents"] as List>).map { Continent.from(map = it) }
+ continents = (map["continents"] as List>).map { Continent.from(map = it) },
)
}
-
- fun toMap(): Map = mapOf(
- "total" to total as Any,
- "continents" to continents.map { it.toMap() } as Any
- )
}
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/models/Country.kt b/library/src/main/java/io/appwrite/models/Country.kt
index 51fee8f..92ab89a 100644
--- a/library/src/main/java/io/appwrite/models/Country.kt
+++ b/library/src/main/java/io/appwrite/models/Country.kt
@@ -1,6 +1,7 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
+import io.appwrite.extensions.jsonCast
/**
* Country
@@ -8,28 +9,30 @@ import com.google.gson.annotations.SerializedName
data class Country(
/**
* Country name.
- *
*/
@SerializedName("name")
val name: String,
/**
* Country two-character ISO 3166-1 alpha code.
- *
*/
@SerializedName("code")
- val code: String
+ val code: String,
+
) {
+ fun toMap(): Map = mapOf(
+ "name" to name as Any,
+ "code" to code as Any,
+ )
+
companion object {
+
@Suppress("UNCHECKED_CAST")
- fun from(map: Map) = Country(
+ fun from(
+ map: Map,
+ ) = Country(
name = map["name"] as String,
- code = map["code"] as String
+ code = map["code"] as String,
)
}
-
- fun toMap(): Map = mapOf(
- "name" to name as Any,
- "code" to code as Any
- )
}
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/models/CountryList.kt b/library/src/main/java/io/appwrite/models/CountryList.kt
index 98dbfcd..350a894 100644
--- a/library/src/main/java/io/appwrite/models/CountryList.kt
+++ b/library/src/main/java/io/appwrite/models/CountryList.kt
@@ -1,6 +1,7 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
+import io.appwrite.extensions.jsonCast
/**
* Countries List
@@ -8,28 +9,30 @@ import com.google.gson.annotations.SerializedName
data class CountryList(
/**
* Total number of countries documents that matched your query.
- *
*/
@SerializedName("total")
val total: Long,
/**
* List of countries.
- *
*/
@SerializedName("countries")
- val countries: List
+ val countries: List,
+
) {
+ fun toMap(): Map = mapOf(
+ "total" to total as Any,
+ "countries" to countries.map { it.toMap() } as Any,
+ )
+
companion object {
+
@Suppress("UNCHECKED_CAST")
- fun from(map: Map) = CountryList(
+ fun from(
+ map: Map,
+ ) = CountryList(
total = (map["total"] as Number).toLong(),
- countries = (map["countries"] as List>).map { Country.from(map = it) }
+ countries = (map["countries"] as List>).map { Country.from(map = it) },
)
}
-
- fun toMap(): Map = mapOf(
- "total" to total as Any,
- "countries" to countries.map { it.toMap() } as Any
- )
}
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/models/Currency.kt b/library/src/main/java/io/appwrite/models/Currency.kt
index df6e230..96b65d0 100644
--- a/library/src/main/java/io/appwrite/models/Currency.kt
+++ b/library/src/main/java/io/appwrite/models/Currency.kt
@@ -1,6 +1,7 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
+import io.appwrite.extensions.jsonCast
/**
* Currency
@@ -8,73 +9,70 @@ import com.google.gson.annotations.SerializedName
data class Currency(
/**
* Currency symbol.
- *
*/
@SerializedName("symbol")
val symbol: String,
/**
* Currency name.
- *
*/
@SerializedName("name")
val name: String,
/**
* Currency native symbol.
- *
*/
@SerializedName("symbolNative")
val symbolNative: String,
/**
* Number of decimal digits.
- *
*/
@SerializedName("decimalDigits")
val decimalDigits: Long,
/**
* Currency digit rounding.
- *
*/
@SerializedName("rounding")
val rounding: Double,
/**
* Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format.
- *
*/
@SerializedName("code")
val code: String,
/**
* Currency plural name
- *
*/
@SerializedName("namePlural")
- val namePlural: String
+ val namePlural: String,
+
) {
+ fun toMap(): Map = mapOf(
+ "symbol" to symbol as Any,
+ "name" to name as Any,
+ "symbolNative" to symbolNative as Any,
+ "decimalDigits" to decimalDigits as Any,
+ "rounding" to rounding as Any,
+ "code" to code as Any,
+ "namePlural" to namePlural as Any,
+ )
+
companion object {
+
@Suppress("UNCHECKED_CAST")
- fun from(map: Map) = Currency(
+ fun from(
+ map: Map,
+ ) = Currency(
symbol = map["symbol"] as String,
name = map["name"] as String,
symbolNative = map["symbolNative"] as String,
decimalDigits = (map["decimalDigits"] as Number).toLong(),
rounding = (map["rounding"] as Number).toDouble(),
code = map["code"] as String,
- namePlural = map["namePlural"] as String
+ namePlural = map["namePlural"] as String,
)
}
-
- fun toMap(): Map = mapOf(
- "symbol" to symbol as Any,
- "name" to name as Any,
- "symbolNative" to symbolNative as Any,
- "decimalDigits" to decimalDigits as Any,
- "rounding" to rounding as Any,
- "code" to code as Any,
- "namePlural" to namePlural as Any
- )
}
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/models/CurrencyList.kt b/library/src/main/java/io/appwrite/models/CurrencyList.kt
index abc719d..fe1e001 100644
--- a/library/src/main/java/io/appwrite/models/CurrencyList.kt
+++ b/library/src/main/java/io/appwrite/models/CurrencyList.kt
@@ -1,6 +1,7 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
+import io.appwrite.extensions.jsonCast
/**
* Currencies List
@@ -8,28 +9,30 @@ import com.google.gson.annotations.SerializedName
data class CurrencyList(
/**
* Total number of currencies documents that matched your query.
- *
*/
@SerializedName("total")
val total: Long,
/**
* List of currencies.
- *
*/
@SerializedName("currencies")
- val currencies: List
+ val currencies: List,
+
) {
+ fun toMap(): Map = mapOf(
+ "total" to total as Any,
+ "currencies" to currencies.map { it.toMap() } as Any,
+ )
+
companion object {
+
@Suppress("UNCHECKED_CAST")
- fun from(map: Map) = CurrencyList(
+ fun from(
+ map: Map,
+ ) = CurrencyList(
total = (map["total"] as Number).toLong(),
- currencies = (map["currencies"] as List>).map { Currency.from(map = it) }
+ currencies = (map["currencies"] as List>).map { Currency.from(map = it) },
)
}
-
- fun toMap(): Map = mapOf(
- "total" to total as Any,
- "currencies" to currencies.map { it.toMap() } as Any
- )
}
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/models/Document.kt b/library/src/main/java/io/appwrite/models/Document.kt
index a57214e..27830d4 100644
--- a/library/src/main/java/io/appwrite/models/Document.kt
+++ b/library/src/main/java/io/appwrite/models/Document.kt
@@ -1,68 +1,54 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
+import io.appwrite.extensions.jsonCast
/**
* Document
*/
-data class Document(
+data class Document(
/**
* Document ID.
- *
*/
@SerializedName("\$id")
val id: String,
/**
* Collection ID.
- *
*/
@SerializedName("\$collectionId")
val collectionId: String,
/**
* Database ID.
- *
*/
@SerializedName("\$databaseId")
val databaseId: String,
/**
* Document creation date in ISO 8601 format.
- *
*/
@SerializedName("\$createdAt")
val createdAt: String,
/**
* Document update date in ISO 8601 format.
- *
*/
@SerializedName("\$updatedAt")
val updatedAt: String,
/**
* Document permissions. [Learn more about permissions](/docs/permissions).
- *
*/
@SerializedName("\$permissions")
val permissions: List,
- val data: Map
+ /**
+ * Additional properties
+ */
+ @SerializedName("data")
+ val data: T
) {
- companion object {
- @Suppress("UNCHECKED_CAST")
- fun from(map: Map) = Document(
- id = map["\$id"] as String,
- collectionId = map["\$collectionId"] as String,
- databaseId = map["\$databaseId"] as String,
- createdAt = map["\$createdAt"] as String,
- updatedAt = map["\$updatedAt"] as String,
- permissions = map["\$permissions"] as List,
- data = map
- )
- }
-
fun toMap(): Map = mapOf(
"\$id" to id as Any,
"\$collectionId" to collectionId as Any,
@@ -70,10 +56,40 @@ data class Document(
"\$createdAt" to createdAt as Any,
"\$updatedAt" to updatedAt as Any,
"\$permissions" to permissions as Any,
- "data" to data
+ "data" to data!!.jsonCast(to = Map::class.java)
)
- fun convertTo(fromJson: (Map) -> T): T {
- return fromJson(data)
+ companion object {
+ operator fun invoke(
+ id: String,
+ collectionId: String,
+ databaseId: String,
+ createdAt: String,
+ updatedAt: String,
+ permissions: List,
+ data: Map
+ ) = Document>(
+ id,
+ collectionId,
+ databaseId,
+ createdAt,
+ updatedAt,
+ permissions,
+ data
+ )
+
+ @Suppress("UNCHECKED_CAST")
+ fun from(
+ map: Map,
+ nestedType: Class
+ ) = Document(
+ id = map["\$id"] as String,
+ collectionId = map["\$collectionId"] as String,
+ databaseId = map["\$databaseId"] as String,
+ createdAt = map["\$createdAt"] as String,
+ updatedAt = map["\$updatedAt"] as String,
+ permissions = map["\$permissions"] as List,
+ data = map.jsonCast(to = nestedType)
+ )
}
}
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/models/DocumentList.kt b/library/src/main/java/io/appwrite/models/DocumentList.kt
index f8e41b5..fa3dd20 100644
--- a/library/src/main/java/io/appwrite/models/DocumentList.kt
+++ b/library/src/main/java/io/appwrite/models/DocumentList.kt
@@ -1,38 +1,46 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
+import io.appwrite.extensions.jsonCast
/**
* Documents List
*/
-data class DocumentList(
+data class DocumentList(
/**
* Total number of documents documents that matched your query.
- *
*/
@SerializedName("total")
val total: Long,
/**
* List of documents.
- *
*/
@SerializedName("documents")
- val documents: List
+ val documents: List>,
+
) {
+ fun toMap(): Map = mapOf(
+ "total" to total as Any,
+ "documents" to documents.map { it.toMap() } as Any,
+ )
+
companion object {
+ operator fun invoke(
+ total: Long,
+ documents: List>>,
+ ) = DocumentList>(
+ total,
+ documents,
+ )
+
@Suppress("UNCHECKED_CAST")
- fun from(map: Map) = DocumentList(
+ fun from(
+ map: Map,
+ nestedType: Class
+ ) = DocumentList(
total = (map["total"] as Number).toLong(),
- documents = (map["documents"] as List>).map { Document.from(map = it) }
+ documents = (map["documents"] as List>).map { Document.from(map = it, nestedType) },
)
}
-
- fun toMap(): Map = mapOf(
- "total" to total as Any,
- "documents" to documents.map { it.toMap() } as Any
- )
-
- fun convertTo(fromJson: (Map) -> T) =
- documents.map { it.convertTo(fromJson = fromJson) }
}
\ 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 b1179f5..a573562 100644
--- a/library/src/main/java/io/appwrite/models/Execution.kt
+++ b/library/src/main/java/io/appwrite/models/Execution.kt
@@ -1,6 +1,7 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
+import io.appwrite.extensions.jsonCast
/**
* Execution
@@ -8,91 +9,98 @@ import com.google.gson.annotations.SerializedName
data class Execution(
/**
* Execution ID.
- *
*/
@SerializedName("\$id")
val id: String,
/**
* Execution creation date in ISO 8601 format.
- *
*/
@SerializedName("\$createdAt")
val createdAt: String,
/**
* Execution upate date in ISO 8601 format.
- *
*/
@SerializedName("\$updatedAt")
val updatedAt: String,
/**
* Execution roles.
- *
*/
@SerializedName("\$permissions")
val permissions: List,
/**
* Function ID.
- *
*/
@SerializedName("functionId")
val functionId: String,
/**
* The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`.
- *
*/
@SerializedName("trigger")
val trigger: String,
/**
* The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`.
- *
*/
@SerializedName("status")
val status: String,
/**
* The script status code.
- *
*/
@SerializedName("statusCode")
val statusCode: Long,
/**
* The script response output string. Logs the last 4,000 characters of the execution response output.
- *
*/
@SerializedName("response")
val response: 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.
- *
*/
@SerializedName("stdout")
val stdout: String,
/**
* 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.
- *
*/
@SerializedName("stderr")
val stderr: String,
/**
* The script execution duration in seconds.
- *
*/
@SerializedName("duration")
- val duration: Double
+ val duration: Double,
+
) {
+ fun toMap(): Map = mapOf(
+ "\$id" to id as Any,
+ "\$createdAt" to createdAt as Any,
+ "\$updatedAt" to updatedAt as Any,
+ "\$permissions" to permissions as Any,
+ "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,
+ "duration" to duration as Any,
+ )
+
companion object {
+
@Suppress("UNCHECKED_CAST")
- fun from(map: Map) = Execution(
+ fun from(
+ map: Map,
+ ) = Execution(
id = map["\$id"] as String,
createdAt = map["\$createdAt"] as String,
updatedAt = map["\$updatedAt"] as String,
@@ -104,22 +112,7 @@ data class Execution(
response = map["response"] as String,
stdout = map["stdout"] as String,
stderr = map["stderr"] as String,
- duration = (map["duration"] as Number).toDouble()
+ duration = (map["duration"] as Number).toDouble(),
)
}
-
- fun toMap(): Map = mapOf(
- "\$id" to id as Any,
- "\$createdAt" to createdAt as Any,
- "\$updatedAt" to updatedAt as Any,
- "\$permissions" to permissions as Any,
- "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,
- "duration" to duration as Any
- )
}
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/models/ExecutionList.kt b/library/src/main/java/io/appwrite/models/ExecutionList.kt
index 2131ffc..322aeee 100644
--- a/library/src/main/java/io/appwrite/models/ExecutionList.kt
+++ b/library/src/main/java/io/appwrite/models/ExecutionList.kt
@@ -1,6 +1,7 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
+import io.appwrite.extensions.jsonCast
/**
* Executions List
@@ -8,28 +9,30 @@ import com.google.gson.annotations.SerializedName
data class ExecutionList(
/**
* Total number of executions documents that matched your query.
- *
*/
@SerializedName("total")
val total: Long,
/**
* List of executions.
- *
*/
@SerializedName("executions")
- val executions: List
+ val executions: List,
+
) {
+ fun toMap(): Map = mapOf(
+ "total" to total as Any,
+ "executions" to executions.map { it.toMap() } as Any,
+ )
+
companion object {
+
@Suppress("UNCHECKED_CAST")
- fun from(map: Map) = ExecutionList(
+ fun from(
+ map: Map,
+ ) = ExecutionList(
total = (map["total"] as Number).toLong(),
- executions = (map["executions"] as List>).map { Execution.from(map = it) }
+ executions = (map["executions"] as List>).map { Execution.from(map = it) },
)
}
-
- fun toMap(): Map = mapOf(
- "total" to total as Any,
- "executions" to executions.map { it.toMap() } as Any
- )
}
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/models/File.kt b/library/src/main/java/io/appwrite/models/File.kt
index 3f1a296..bd35d42 100644
--- a/library/src/main/java/io/appwrite/models/File.kt
+++ b/library/src/main/java/io/appwrite/models/File.kt
@@ -1,6 +1,7 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
+import io.appwrite.extensions.jsonCast
/**
* File
@@ -8,84 +9,91 @@ import com.google.gson.annotations.SerializedName
data class File(
/**
* File ID.
- *
*/
@SerializedName("\$id")
val id: String,
/**
* Bucket ID.
- *
*/
@SerializedName("bucketId")
val bucketId: String,
/**
* File creation date in ISO 8601 format.
- *
*/
@SerializedName("\$createdAt")
val createdAt: String,
/**
* File update date in ISO 8601 format.
- *
*/
@SerializedName("\$updatedAt")
val updatedAt: String,
/**
* File permissions. [Learn more about permissions](/docs/permissions).
- *
*/
@SerializedName("\$permissions")
val permissions: List,
/**
* File name.
- *
*/
@SerializedName("name")
val name: String,
/**
* File MD5 signature.
- *
*/
@SerializedName("signature")
val signature: String,
/**
* File mime type.
- *
*/
@SerializedName("mimeType")
val mimeType: String,
/**
* File original size in bytes.
- *
*/
@SerializedName("sizeOriginal")
val sizeOriginal: Long,
/**
* Total number of chunks available
- *
*/
@SerializedName("chunksTotal")
val chunksTotal: Long,
/**
* Total number of chunks uploaded
- *
*/
@SerializedName("chunksUploaded")
- val chunksUploaded: Long
+ val chunksUploaded: Long,
+
) {
+ fun toMap(): Map = mapOf(
+ "\$id" to id as Any,
+ "bucketId" to bucketId as Any,
+ "\$createdAt" to createdAt as Any,
+ "\$updatedAt" to updatedAt as Any,
+ "\$permissions" to permissions as Any,
+ "name" to name as Any,
+ "signature" to signature as Any,
+ "mimeType" to mimeType as Any,
+ "sizeOriginal" to sizeOriginal as Any,
+ "chunksTotal" to chunksTotal as Any,
+ "chunksUploaded" to chunksUploaded as Any,
+ )
+
companion object {
+
@Suppress("UNCHECKED_CAST")
- fun from(map: Map) = File(
+ fun from(
+ map: Map,
+ ) = File(
id = map["\$id"] as String,
bucketId = map["bucketId"] as String,
createdAt = map["\$createdAt"] as String,
@@ -96,21 +104,7 @@ data class File(
mimeType = map["mimeType"] as String,
sizeOriginal = (map["sizeOriginal"] as Number).toLong(),
chunksTotal = (map["chunksTotal"] as Number).toLong(),
- chunksUploaded = (map["chunksUploaded"] as Number).toLong()
+ chunksUploaded = (map["chunksUploaded"] as Number).toLong(),
)
}
-
- fun toMap(): Map = mapOf(
- "\$id" to id as Any,
- "bucketId" to bucketId as Any,
- "\$createdAt" to createdAt as Any,
- "\$updatedAt" to updatedAt as Any,
- "\$permissions" to permissions as Any,
- "name" to name as Any,
- "signature" to signature as Any,
- "mimeType" to mimeType as Any,
- "sizeOriginal" to sizeOriginal as Any,
- "chunksTotal" to chunksTotal as Any,
- "chunksUploaded" to chunksUploaded as Any
- )
}
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/models/FileList.kt b/library/src/main/java/io/appwrite/models/FileList.kt
index 477bad2..5af18f1 100644
--- a/library/src/main/java/io/appwrite/models/FileList.kt
+++ b/library/src/main/java/io/appwrite/models/FileList.kt
@@ -1,6 +1,7 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
+import io.appwrite.extensions.jsonCast
/**
* Files List
@@ -8,28 +9,30 @@ import com.google.gson.annotations.SerializedName
data class FileList(
/**
* Total number of files documents that matched your query.
- *
*/
@SerializedName("total")
val total: Long,
/**
* List of files.
- *
*/
@SerializedName("files")
- val files: List
+ val files: List,
+
) {
+ fun toMap(): Map = mapOf(
+ "total" to total as Any,
+ "files" to files.map { it.toMap() } as Any,
+ )
+
companion object {
+
@Suppress("UNCHECKED_CAST")
- fun from(map: Map) = FileList(
+ fun from(
+ map: Map,
+ ) = FileList(
total = (map["total"] as Number).toLong(),
- files = (map["files"] as List>).map { File.from(map = it) }
+ files = (map["files"] as List>).map { File.from(map = it) },
)
}
-
- fun toMap(): Map = mapOf(
- "total" to total as Any,
- "files" to files.map { it.toMap() } as Any
- )
}
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/models/Jwt.kt b/library/src/main/java/io/appwrite/models/Jwt.kt
index c871237..f55c103 100644
--- a/library/src/main/java/io/appwrite/models/Jwt.kt
+++ b/library/src/main/java/io/appwrite/models/Jwt.kt
@@ -1,6 +1,7 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
+import io.appwrite.extensions.jsonCast
/**
* JWT
@@ -8,19 +9,22 @@ import com.google.gson.annotations.SerializedName
data class Jwt(
/**
* JWT encoded string.
- *
*/
@SerializedName("jwt")
- val jwt: String
+ val jwt: String,
+
) {
+ fun toMap(): Map = mapOf(
+ "jwt" to jwt as Any,
+ )
+
companion object {
+
@Suppress("UNCHECKED_CAST")
- fun from(map: Map) = Jwt(
- jwt = map["jwt"] as String
+ fun from(
+ map: Map,
+ ) = Jwt(
+ jwt = map["jwt"] as String,
)
}
-
- fun toMap(): Map = mapOf(
- "jwt" to jwt as Any
- )
}
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/models/Language.kt b/library/src/main/java/io/appwrite/models/Language.kt
index 045202f..8860aad 100644
--- a/library/src/main/java/io/appwrite/models/Language.kt
+++ b/library/src/main/java/io/appwrite/models/Language.kt
@@ -1,6 +1,7 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
+import io.appwrite.extensions.jsonCast
/**
* Language
@@ -8,37 +9,38 @@ import com.google.gson.annotations.SerializedName
data class Language(
/**
* Language name.
- *
*/
@SerializedName("name")
val name: String,
/**
* Language two-character ISO 639-1 codes.
- *
*/
@SerializedName("code")
val code: String,
/**
* Language native name.
- *
*/
@SerializedName("nativeName")
- val nativeName: String
+ val nativeName: String,
+
) {
+ fun toMap(): Map = mapOf(
+ "name" to name as Any,
+ "code" to code as Any,
+ "nativeName" to nativeName as Any,
+ )
+
companion object {
+
@Suppress("UNCHECKED_CAST")
- fun from(map: Map) = Language(
+ fun from(
+ map: Map,
+ ) = Language(
name = map["name"] as String,
code = map["code"] as String,
- nativeName = map["nativeName"] as String
+ nativeName = map["nativeName"] as String,
)
}
-
- fun toMap(): Map = mapOf(
- "name" to name as Any,
- "code" to code as Any,
- "nativeName" to nativeName as Any
- )
}
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/models/LanguageList.kt b/library/src/main/java/io/appwrite/models/LanguageList.kt
index 8ca4f5f..07559b9 100644
--- a/library/src/main/java/io/appwrite/models/LanguageList.kt
+++ b/library/src/main/java/io/appwrite/models/LanguageList.kt
@@ -1,6 +1,7 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
+import io.appwrite.extensions.jsonCast
/**
* Languages List
@@ -8,28 +9,30 @@ import com.google.gson.annotations.SerializedName
data class LanguageList(
/**
* Total number of languages documents that matched your query.
- *
*/
@SerializedName("total")
val total: Long,
/**
* List of languages.
- *
*/
@SerializedName("languages")
- val languages: List
+ val languages: List,
+
) {
+ fun toMap(): Map = mapOf(
+ "total" to total as Any,
+ "languages" to languages.map { it.toMap() } as Any,
+ )
+
companion object {
+
@Suppress("UNCHECKED_CAST")
- fun from(map: Map) = LanguageList(
+ fun from(
+ map: Map,
+ ) = LanguageList(
total = (map["total"] as Number).toLong(),
- languages = (map["languages"] as List>).map { Language.from(map = it) }
+ languages = (map["languages"] as List>).map { Language.from(map = it) },
)
}
-
- fun toMap(): Map = mapOf(
- "total" to total as Any,
- "languages" to languages.map { it.toMap() } as Any
- )
}
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/models/Locale.kt b/library/src/main/java/io/appwrite/models/Locale.kt
index d8d3fcf..4327545 100644
--- a/library/src/main/java/io/appwrite/models/Locale.kt
+++ b/library/src/main/java/io/appwrite/models/Locale.kt
@@ -1,6 +1,7 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
+import io.appwrite.extensions.jsonCast
/**
* Locale
@@ -8,73 +9,70 @@ import com.google.gson.annotations.SerializedName
data class Locale(
/**
* User IP address.
- *
*/
@SerializedName("ip")
val ip: String,
/**
* Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format
- *
*/
@SerializedName("countryCode")
val countryCode: String,
/**
* Country name. This field support localization.
- *
*/
@SerializedName("country")
val country: String,
/**
* Continent code. A two character continent code "AF" for Africa, "AN" for Antarctica, "AS" for Asia, "EU" for Europe, "NA" for North America, "OC" for Oceania, and "SA" for South America.
- *
*/
@SerializedName("continentCode")
val continentCode: String,
/**
* Continent name. This field support localization.
- *
*/
@SerializedName("continent")
val continent: String,
/**
* True if country is part of the Europian Union.
- *
*/
@SerializedName("eu")
val eu: Boolean,
/**
* Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format
- *
*/
@SerializedName("currency")
- val currency: String
+ val currency: String,
+
) {
+ fun toMap(): Map = mapOf(
+ "ip" to ip as Any,
+ "countryCode" to countryCode as Any,
+ "country" to country as Any,
+ "continentCode" to continentCode as Any,
+ "continent" to continent as Any,
+ "eu" to eu as Any,
+ "currency" to currency as Any,
+ )
+
companion object {
+
@Suppress("UNCHECKED_CAST")
- fun from(map: Map) = Locale(
+ fun from(
+ map: Map,
+ ) = Locale(
ip = map["ip"] as String,
countryCode = map["countryCode"] as String,
country = map["country"] as String,
continentCode = map["continentCode"] as String,
continent = map["continent"] as String,
eu = map["eu"] as Boolean,
- currency = map["currency"] as String
+ currency = map["currency"] as String,
)
}
-
- fun toMap(): Map = mapOf(
- "ip" to ip as Any,
- "countryCode" to countryCode as Any,
- "country" to country as Any,
- "continentCode" to continentCode as Any,
- "continent" to continent as Any,
- "eu" to eu as Any,
- "currency" to currency as Any
- )
}
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/models/Log.kt b/library/src/main/java/io/appwrite/models/Log.kt
index 2343352..c2df960 100644
--- a/library/src/main/java/io/appwrite/models/Log.kt
+++ b/library/src/main/java/io/appwrite/models/Log.kt
@@ -1,6 +1,7 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
+import io.appwrite.extensions.jsonCast
/**
* Log
@@ -8,154 +9,161 @@ import com.google.gson.annotations.SerializedName
data class Log(
/**
* Event name.
- *
*/
@SerializedName("event")
val event: String,
/**
* User ID.
- *
*/
@SerializedName("userId")
val userId: String,
/**
* User Email.
- *
*/
@SerializedName("userEmail")
val userEmail: String,
/**
* User Name.
- *
*/
@SerializedName("userName")
val userName: String,
/**
* API mode when event triggered.
- *
*/
@SerializedName("mode")
val mode: String,
/**
* IP session in use when the session was created.
- *
*/
@SerializedName("ip")
val ip: String,
/**
* Log creation date in ISO 8601 format.
- *
*/
@SerializedName("time")
val time: String,
/**
* Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json).
- *
*/
@SerializedName("osCode")
val osCode: String,
/**
* Operating system name.
- *
*/
@SerializedName("osName")
val osName: String,
/**
* Operating system version.
- *
*/
@SerializedName("osVersion")
val osVersion: String,
/**
* Client type.
- *
*/
@SerializedName("clientType")
val clientType: String,
/**
* Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json).
- *
*/
@SerializedName("clientCode")
val clientCode: String,
/**
* Client name.
- *
*/
@SerializedName("clientName")
val clientName: String,
/**
* Client version.
- *
*/
@SerializedName("clientVersion")
val clientVersion: String,
/**
* Client engine name.
- *
*/
@SerializedName("clientEngine")
val clientEngine: String,
/**
* Client engine name.
- *
*/
@SerializedName("clientEngineVersion")
val clientEngineVersion: String,
/**
* Device name.
- *
*/
@SerializedName("deviceName")
val deviceName: String,
/**
* Device brand name.
- *
*/
@SerializedName("deviceBrand")
val deviceBrand: String,
/**
* Device model name.
- *
*/
@SerializedName("deviceModel")
val deviceModel: String,
/**
* Country two-character ISO 3166-1 alpha code.
- *
*/
@SerializedName("countryCode")
val countryCode: String,
/**
* Country name.
- *
*/
@SerializedName("countryName")
- val countryName: String
+ val countryName: String,
+
) {
+ fun toMap(): Map = mapOf(
+ "event" to event as Any,
+ "userId" to userId as Any,
+ "userEmail" to userEmail as Any,
+ "userName" to userName as Any,
+ "mode" to mode as Any,
+ "ip" to ip as Any,
+ "time" to time as Any,
+ "osCode" to osCode as Any,
+ "osName" to osName as Any,
+ "osVersion" to osVersion as Any,
+ "clientType" to clientType as Any,
+ "clientCode" to clientCode as Any,
+ "clientName" to clientName as Any,
+ "clientVersion" to clientVersion as Any,
+ "clientEngine" to clientEngine as Any,
+ "clientEngineVersion" to clientEngineVersion as Any,
+ "deviceName" to deviceName as Any,
+ "deviceBrand" to deviceBrand as Any,
+ "deviceModel" to deviceModel as Any,
+ "countryCode" to countryCode as Any,
+ "countryName" to countryName as Any,
+ )
+
companion object {
+
@Suppress("UNCHECKED_CAST")
- fun from(map: Map) = Log(
+ fun from(
+ map: Map,
+ ) = Log(
event = map["event"] as String,
userId = map["userId"] as String,
userEmail = map["userEmail"] as String,
@@ -176,31 +184,7 @@ data class Log(
deviceBrand = map["deviceBrand"] as String,
deviceModel = map["deviceModel"] as String,
countryCode = map["countryCode"] as String,
- countryName = map["countryName"] as String
+ countryName = map["countryName"] as String,
)
}
-
- fun toMap(): Map = mapOf(
- "event" to event as Any,
- "userId" to userId as Any,
- "userEmail" to userEmail as Any,
- "userName" to userName as Any,
- "mode" to mode as Any,
- "ip" to ip as Any,
- "time" to time as Any,
- "osCode" to osCode as Any,
- "osName" to osName as Any,
- "osVersion" to osVersion as Any,
- "clientType" to clientType as Any,
- "clientCode" to clientCode as Any,
- "clientName" to clientName as Any,
- "clientVersion" to clientVersion as Any,
- "clientEngine" to clientEngine as Any,
- "clientEngineVersion" to clientEngineVersion as Any,
- "deviceName" to deviceName as Any,
- "deviceBrand" to deviceBrand as Any,
- "deviceModel" to deviceModel as Any,
- "countryCode" to countryCode as Any,
- "countryName" to countryName as Any
- )
}
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/models/LogList.kt b/library/src/main/java/io/appwrite/models/LogList.kt
index 47d5680..b9f381c 100644
--- a/library/src/main/java/io/appwrite/models/LogList.kt
+++ b/library/src/main/java/io/appwrite/models/LogList.kt
@@ -1,6 +1,7 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
+import io.appwrite.extensions.jsonCast
/**
* Logs List
@@ -8,28 +9,30 @@ import com.google.gson.annotations.SerializedName
data class LogList(
/**
* Total number of logs documents that matched your query.
- *
*/
@SerializedName("total")
val total: Long,
/**
* List of logs.
- *
*/
@SerializedName("logs")
- val logs: List
+ val logs: List,
+
) {
+ fun toMap(): Map = mapOf(
+ "total" to total as Any,
+ "logs" to logs.map { it.toMap() } as Any,
+ )
+
companion object {
+
@Suppress("UNCHECKED_CAST")
- fun from(map: Map) = LogList(
+ fun from(
+ map: Map,
+ ) = LogList(
total = (map["total"] as Number).toLong(),
- logs = (map["logs"] as List>).map { Log.from(map = it) }
+ logs = (map["logs"] as List>).map { Log.from(map = it) },
)
}
-
- fun toMap(): Map = mapOf(
- "total" to total as Any,
- "logs" to logs.map { it.toMap() } as Any
- )
}
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/models/Membership.kt b/library/src/main/java/io/appwrite/models/Membership.kt
index a923fea..96a364f 100644
--- a/library/src/main/java/io/appwrite/models/Membership.kt
+++ b/library/src/main/java/io/appwrite/models/Membership.kt
@@ -1,6 +1,7 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
+import io.appwrite.extensions.jsonCast
/**
* Membership
@@ -8,91 +9,98 @@ import com.google.gson.annotations.SerializedName
data class Membership(
/**
* Membership ID.
- *
*/
@SerializedName("\$id")
val id: String,
/**
* Membership creation date in ISO 8601 format.
- *
*/
@SerializedName("\$createdAt")
val createdAt: String,
/**
* Membership update date in ISO 8601 format.
- *
*/
@SerializedName("\$updatedAt")
val updatedAt: String,
/**
* User ID.
- *
*/
@SerializedName("userId")
val userId: String,
/**
* User name.
- *
*/
@SerializedName("userName")
val userName: String,
/**
* User email address.
- *
*/
@SerializedName("userEmail")
val userEmail: String,
/**
* Team ID.
- *
*/
@SerializedName("teamId")
val teamId: String,
/**
* Team name.
- *
*/
@SerializedName("teamName")
val teamName: String,
/**
* Date, the user has been invited to join the team in ISO 8601 format.
- *
*/
@SerializedName("invited")
val invited: String,
/**
* Date, the user has accepted the invitation to join the team in ISO 8601 format.
- *
*/
@SerializedName("joined")
val joined: String,
/**
* User confirmation status, true if the user has joined the team or false otherwise.
- *
*/
@SerializedName("confirm")
val confirm: Boolean,
/**
* User list of roles
- *
*/
@SerializedName("roles")
- val roles: List
+ val roles: List,
+
) {
+ fun toMap(): Map = mapOf(
+ "\$id" to id as Any,
+ "\$createdAt" to createdAt as Any,
+ "\$updatedAt" to updatedAt as Any,
+ "userId" to userId as Any,
+ "userName" to userName as Any,
+ "userEmail" to userEmail as Any,
+ "teamId" to teamId as Any,
+ "teamName" to teamName as Any,
+ "invited" to invited as Any,
+ "joined" to joined as Any,
+ "confirm" to confirm as Any,
+ "roles" to roles as Any,
+ )
+
companion object {
+
@Suppress("UNCHECKED_CAST")
- fun from(map: Map) = Membership(
+ fun from(
+ map: Map,
+ ) = Membership(
id = map["\$id"] as String,
createdAt = map["\$createdAt"] as String,
updatedAt = map["\$updatedAt"] as String,
@@ -104,22 +112,7 @@ data class Membership(
invited = map["invited"] as String,
joined = map["joined"] as String,
confirm = map["confirm"] as Boolean,
- roles = map["roles"] as List
+ roles = map["roles"] as List,
)
}
-
- fun toMap(): Map = mapOf(
- "\$id" to id as Any,
- "\$createdAt" to createdAt as Any,
- "\$updatedAt" to updatedAt as Any,
- "userId" to userId as Any,
- "userName" to userName as Any,
- "userEmail" to userEmail as Any,
- "teamId" to teamId as Any,
- "teamName" to teamName as Any,
- "invited" to invited as Any,
- "joined" to joined as Any,
- "confirm" to confirm as Any,
- "roles" to roles as Any
- )
}
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/models/MembershipList.kt b/library/src/main/java/io/appwrite/models/MembershipList.kt
index 1b7549d..7feaaaa 100644
--- a/library/src/main/java/io/appwrite/models/MembershipList.kt
+++ b/library/src/main/java/io/appwrite/models/MembershipList.kt
@@ -1,6 +1,7 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
+import io.appwrite.extensions.jsonCast
/**
* Memberships List
@@ -8,28 +9,30 @@ import com.google.gson.annotations.SerializedName
data class MembershipList(
/**
* Total number of memberships documents that matched your query.
- *
*/
@SerializedName("total")
val total: Long,
/**
* List of memberships.
- *
*/
@SerializedName("memberships")
- val memberships: List
+ val memberships: List