diff --git a/LICENSE.md b/LICENSE.md
index 47cfdfb..5479bb8 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -1,4 +1,4 @@
-Copyright (c) 2023 Appwrite (https://appwrite.io) and individual contributors.
+Copyright (c) 2024 Appwrite (https://appwrite.io) and individual contributors.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
diff --git a/README.md b/README.md
index e5d5922..054a54c 100644
--- a/README.md
+++ b/README.md
@@ -2,12 +2,12 @@


-
+
[](https://travis-ci.com/appwrite/sdk-generator)
[](https://twitter.com/appwrite)
[](https://appwrite.io/discord)
-**This SDK is compatible with Appwrite server version 1.4.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-android/releases).**
+**This SDK is compatible with Appwrite server version 1.5.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-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:4.0.1")
+implementation("io.appwrite:sdk-for-android:5.0.0-rc.1")
```
### Maven
@@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file:
io.appwrite
sdk-for-android
- 4.0.1
+ 5.0.0-rc.1
```
diff --git a/build.gradle b/build.gradle
index f2080e6..0b0c86c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,20 +2,19 @@ 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.8.0"
+ ext.kotlin_version = "1.9.10"
+
version System.getenv("SDK_VERSION")
+
repositories {
maven { url "https://plugins.gradle.org/m2/" }
google()
mavenCentral()
}
dependencies {
- classpath "com.android.tools.build:gradle:4.2.2"
+ classpath "com.android.tools.build:gradle:8.2.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
- classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'
-
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
+ classpath "io.github.gradle-nexus:publish-plugin:1.3.0"
}
}
diff --git a/docs/examples/java/account/add-authenticator.md b/docs/examples/java/account/add-authenticator.md
new file mode 100644
index 0000000..35935a4
--- /dev/null
+++ b/docs/examples/java/account/add-authenticator.md
@@ -0,0 +1,22 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
+import io.appwrite.enums.AuthenticatorFactor;
+
+Client client = new Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
+
+Account account = new Account(client);
+
+account.addAuthenticator(
+ AuthenticatorFactor.TOTP,
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/create-anonymous-session.md b/docs/examples/java/account/create-anonymous-session.md
index 59c7630..46ae275 100644
--- a/docs/examples/java/account/create-anonymous-session.md
+++ b/docs/examples/java/account/create-anonymous-session.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Account account = new Account(client);
account.createAnonymousSession(new CoroutineCallback<>((result, error) -> {
- if (error != null)
+ if (error != null) {
error.printStackTrace();
return;
}
diff --git a/docs/examples/java/account/create-challenge.md b/docs/examples/java/account/create-challenge.md
new file mode 100644
index 0000000..5080f10
--- /dev/null
+++ b/docs/examples/java/account/create-challenge.md
@@ -0,0 +1,22 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
+import io.appwrite.enums.AuthenticatorProvider;
+
+Client client = new Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
+
+Account account = new Account(client);
+
+account.createChallenge(
+ AuthenticatorProvider.TOTP,
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/create-email-password-session.md b/docs/examples/java/account/create-email-password-session.md
new file mode 100644
index 0000000..e3cd353
--- /dev/null
+++ b/docs/examples/java/account/create-email-password-session.md
@@ -0,0 +1,22 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
+
+Client client = new Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
+
+Account account = new Account(client);
+
+account.createEmailPasswordSession(
+ "email@example.com",
+ "password",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/create-magic-u-r-l-session.md b/docs/examples/java/account/create-email-token.md
similarity index 94%
rename from docs/examples/java/account/create-magic-u-r-l-session.md
rename to docs/examples/java/account/create-email-token.md
index 0ed43dc..f032eb6 100644
--- a/docs/examples/java/account/create-magic-u-r-l-session.md
+++ b/docs/examples/java/account/create-email-token.md
@@ -8,7 +8,7 @@ Client client = new Client(context)
Account account = new Account(client);
-account.createMagicURLSession(
+account.createEmailToken(
"[USER_ID]",
"email@example.com",
new CoroutineCallback<>((result, error) -> {
@@ -19,4 +19,4 @@ account.createMagicURLSession(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/create-j-w-t.md b/docs/examples/java/account/create-j-w-t.md
index c312386..13e6e49 100644
--- a/docs/examples/java/account/create-j-w-t.md
+++ b/docs/examples/java/account/create-j-w-t.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Account account = new Account(client);
account.createJWT(new CoroutineCallback<>((result, error) -> {
- if (error != null)
+ if (error != null) {
error.printStackTrace();
return;
}
diff --git a/docs/examples/java/account/create-email-session.md b/docs/examples/java/account/create-magic-u-r-l-token.md
similarity index 91%
rename from docs/examples/java/account/create-email-session.md
rename to docs/examples/java/account/create-magic-u-r-l-token.md
index e3e6fdd..48a8b9b 100644
--- a/docs/examples/java/account/create-email-session.md
+++ b/docs/examples/java/account/create-magic-u-r-l-token.md
@@ -8,9 +8,9 @@ Client client = new Client(context)
Account account = new Account(client);
-account.createEmailSession(
+account.createMagicURLToken(
+ "[USER_ID]",
"email@example.com",
- "password"
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -19,4 +19,4 @@ account.createEmailSession(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/create-o-auth2session.md b/docs/examples/java/account/create-o-auth2session.md
index cb9386a..1389673 100644
--- a/docs/examples/java/account/create-o-auth2session.md
+++ b/docs/examples/java/account/create-o-auth2session.md
@@ -1,6 +1,7 @@
import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Account;
+import io.appwrite.enums.OAuthProvider;
Client client = new Client(context)
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
@@ -9,7 +10,7 @@ Client client = new Client(context)
Account account = new Account(client);
account.createOAuth2Session(
- "amazon",
+ OAuthProvider.AMAZON,
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -18,4 +19,4 @@ account.createOAuth2Session(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/create-phone-session.md b/docs/examples/java/account/create-phone-token.md
similarity index 91%
rename from docs/examples/java/account/create-phone-session.md
rename to docs/examples/java/account/create-phone-token.md
index df5bc86..a839e81 100644
--- a/docs/examples/java/account/create-phone-session.md
+++ b/docs/examples/java/account/create-phone-token.md
@@ -8,9 +8,9 @@ Client client = new Client(context)
Account account = new Account(client);
-account.createPhoneSession(
+account.createPhoneToken(
"[USER_ID]",
- "+12065550100"
+ "+12065550100",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -19,4 +19,4 @@ account.createPhoneSession(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/create-phone-verification.md b/docs/examples/java/account/create-phone-verification.md
index 1545d0f..ef14ce8 100644
--- a/docs/examples/java/account/create-phone-verification.md
+++ b/docs/examples/java/account/create-phone-verification.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Account account = new Account(client);
account.createPhoneVerification(new CoroutineCallback<>((result, error) -> {
- if (error != null)
+ if (error != null) {
error.printStackTrace();
return;
}
diff --git a/docs/examples/java/account/create-push-target.md b/docs/examples/java/account/create-push-target.md
new file mode 100644
index 0000000..18a5e76
--- /dev/null
+++ b/docs/examples/java/account/create-push-target.md
@@ -0,0 +1,22 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
+
+Client client = new Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
+
+Account account = new Account(client);
+
+account.createPushTarget(
+ "[TARGET_ID]",
+ "[IDENTIFIER]",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/create-recovery.md b/docs/examples/java/account/create-recovery.md
index 5e8584f..f167af2 100644
--- a/docs/examples/java/account/create-recovery.md
+++ b/docs/examples/java/account/create-recovery.md
@@ -10,7 +10,7 @@ Account account = new Account(client);
account.createRecovery(
"email@example.com",
- "https://example.com"
+ "https://example.com",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -19,4 +19,4 @@ account.createRecovery(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/update-phone-session.md b/docs/examples/java/account/create-session.md
similarity index 92%
rename from docs/examples/java/account/update-phone-session.md
rename to docs/examples/java/account/create-session.md
index 589e4ff..d853209 100644
--- a/docs/examples/java/account/update-phone-session.md
+++ b/docs/examples/java/account/create-session.md
@@ -8,9 +8,9 @@ Client client = new Client(context)
Account account = new Account(client);
-account.updatePhoneSession(
+account.createSession(
"[USER_ID]",
- "[SECRET]"
+ "[SECRET]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -19,4 +19,4 @@ account.updatePhoneSession(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/create-verification.md b/docs/examples/java/account/create-verification.md
index fcea98f..eb7a537 100644
--- a/docs/examples/java/account/create-verification.md
+++ b/docs/examples/java/account/create-verification.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Account account = new Account(client);
account.createVerification(
- "https://example.com"
+ "https://example.com",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -18,4 +18,4 @@ account.createVerification(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/create.md b/docs/examples/java/account/create.md
index e08731f..a16d2c7 100644
--- a/docs/examples/java/account/create.md
+++ b/docs/examples/java/account/create.md
@@ -20,4 +20,4 @@ account.create(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/delete-authenticator.md b/docs/examples/java/account/delete-authenticator.md
new file mode 100644
index 0000000..d7e4196
--- /dev/null
+++ b/docs/examples/java/account/delete-authenticator.md
@@ -0,0 +1,23 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
+import io.appwrite.enums.AuthenticatorProvider;
+
+Client client = new Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
+
+Account account = new Account(client);
+
+account.deleteAuthenticator(
+ AuthenticatorProvider.TOTP,
+ "[OTP]",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/delete-identity.md b/docs/examples/java/account/delete-identity.md
index 0d92d04..f33c29a 100644
--- a/docs/examples/java/account/delete-identity.md
+++ b/docs/examples/java/account/delete-identity.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Account account = new Account(client);
account.deleteIdentity(
- "[IDENTITY_ID]"
+ "[IDENTITY_ID]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -18,4 +18,4 @@ account.deleteIdentity(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/delete-push-target.md b/docs/examples/java/account/delete-push-target.md
new file mode 100644
index 0000000..77b21d6
--- /dev/null
+++ b/docs/examples/java/account/delete-push-target.md
@@ -0,0 +1,21 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
+
+Client client = new Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
+
+Account account = new Account(client);
+
+account.deletePushTarget(
+ "[TARGET_ID]",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/delete-session.md b/docs/examples/java/account/delete-session.md
index 28009d0..2b8d228 100644
--- a/docs/examples/java/account/delete-session.md
+++ b/docs/examples/java/account/delete-session.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Account account = new Account(client);
account.deleteSession(
- "[SESSION_ID]"
+ "[SESSION_ID]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -18,4 +18,4 @@ account.deleteSession(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/delete-sessions.md b/docs/examples/java/account/delete-sessions.md
index 6bdc840..147523e 100644
--- a/docs/examples/java/account/delete-sessions.md
+++ b/docs/examples/java/account/delete-sessions.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Account account = new Account(client);
account.deleteSessions(new CoroutineCallback<>((result, error) -> {
- if (error != null)
+ if (error != null) {
error.printStackTrace();
return;
}
diff --git a/docs/examples/java/account/get-prefs.md b/docs/examples/java/account/get-prefs.md
index 9911ad3..bfa3c1a 100644
--- a/docs/examples/java/account/get-prefs.md
+++ b/docs/examples/java/account/get-prefs.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Account account = new Account(client);
account.getPrefs(new CoroutineCallback<>((result, error) -> {
- if (error != null)
+ if (error != null) {
error.printStackTrace();
return;
}
diff --git a/docs/examples/java/account/get-session.md b/docs/examples/java/account/get-session.md
index fecb543..dd9c89c 100644
--- a/docs/examples/java/account/get-session.md
+++ b/docs/examples/java/account/get-session.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Account account = new Account(client);
account.getSession(
- "[SESSION_ID]"
+ "[SESSION_ID]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -18,4 +18,4 @@ account.getSession(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/get.md b/docs/examples/java/account/get.md
index 2e5f40a..9006cb8 100644
--- a/docs/examples/java/account/get.md
+++ b/docs/examples/java/account/get.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Account account = new Account(client);
account.get(new CoroutineCallback<>((result, error) -> {
- if (error != null)
+ if (error != null) {
error.printStackTrace();
return;
}
diff --git a/docs/examples/java/account/list-factors.md b/docs/examples/java/account/list-factors.md
new file mode 100644
index 0000000..e2d92b5
--- /dev/null
+++ b/docs/examples/java/account/list-factors.md
@@ -0,0 +1,18 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
+
+Client client = new Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
+
+Account account = new Account(client);
+
+account.listFactors(new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/account/list-identities.md b/docs/examples/java/account/list-identities.md
index d1f6a48..08d4c19 100644
--- a/docs/examples/java/account/list-identities.md
+++ b/docs/examples/java/account/list-identities.md
@@ -17,4 +17,4 @@ account.listIdentities(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/list-logs.md b/docs/examples/java/account/list-logs.md
index d2ce790..f4c39fb 100644
--- a/docs/examples/java/account/list-logs.md
+++ b/docs/examples/java/account/list-logs.md
@@ -17,4 +17,4 @@ account.listLogs(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/list-sessions.md b/docs/examples/java/account/list-sessions.md
index 7fd587e..9e70f0d 100644
--- a/docs/examples/java/account/list-sessions.md
+++ b/docs/examples/java/account/list-sessions.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Account account = new Account(client);
account.listSessions(new CoroutineCallback<>((result, error) -> {
- if (error != null)
+ if (error != null) {
error.printStackTrace();
return;
}
diff --git a/docs/examples/java/account/update-challenge.md b/docs/examples/java/account/update-challenge.md
new file mode 100644
index 0000000..d972a14
--- /dev/null
+++ b/docs/examples/java/account/update-challenge.md
@@ -0,0 +1,22 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
+
+Client client = new Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
+
+Account account = new Account(client);
+
+account.updateChallenge(
+ "[CHALLENGE_ID]",
+ "[OTP]",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/update-email.md b/docs/examples/java/account/update-email.md
index 8034ada..a7cb414 100644
--- a/docs/examples/java/account/update-email.md
+++ b/docs/examples/java/account/update-email.md
@@ -10,7 +10,7 @@ Account account = new Account(client);
account.updateEmail(
"email@example.com",
- "password"
+ "password",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -19,4 +19,4 @@ account.updateEmail(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/update-m-f-a.md b/docs/examples/java/account/update-m-f-a.md
new file mode 100644
index 0000000..16f6973
--- /dev/null
+++ b/docs/examples/java/account/update-m-f-a.md
@@ -0,0 +1,21 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
+
+Client client = new Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
+
+Account account = new Account(client);
+
+account.updateMFA(
+ false,
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
\ No newline at end of file
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 0f8f2b3..f46422b 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
@@ -10,7 +10,7 @@ Account account = new Account(client);
account.updateMagicURLSession(
"[USER_ID]",
- "[SECRET]"
+ "[SECRET]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -19,4 +19,4 @@ account.updateMagicURLSession(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/update-name.md b/docs/examples/java/account/update-name.md
index 5940f93..8b27389 100644
--- a/docs/examples/java/account/update-name.md
+++ b/docs/examples/java/account/update-name.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Account account = new Account(client);
account.updateName(
- "[NAME]"
+ "[NAME]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -18,4 +18,4 @@ account.updateName(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/update-password.md b/docs/examples/java/account/update-password.md
index d942632..430ab7e 100644
--- a/docs/examples/java/account/update-password.md
+++ b/docs/examples/java/account/update-password.md
@@ -18,4 +18,4 @@ account.updatePassword(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/update-phone-verification.md b/docs/examples/java/account/update-phone-verification.md
index 81785f9..7d66fd9 100644
--- a/docs/examples/java/account/update-phone-verification.md
+++ b/docs/examples/java/account/update-phone-verification.md
@@ -10,7 +10,7 @@ Account account = new Account(client);
account.updatePhoneVerification(
"[USER_ID]",
- "[SECRET]"
+ "[SECRET]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -19,4 +19,4 @@ account.updatePhoneVerification(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/update-phone.md b/docs/examples/java/account/update-phone.md
index a8572f9..c958911 100644
--- a/docs/examples/java/account/update-phone.md
+++ b/docs/examples/java/account/update-phone.md
@@ -10,7 +10,7 @@ Account account = new Account(client);
account.updatePhone(
"+12065550100",
- "password"
+ "password",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -19,4 +19,4 @@ account.updatePhone(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/update-prefs.md b/docs/examples/java/account/update-prefs.md
index ffd5ef0..5d2e75d 100644
--- a/docs/examples/java/account/update-prefs.md
+++ b/docs/examples/java/account/update-prefs.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Account account = new Account(client);
account.updatePrefs(
- mapOf( "a" to "b" )
+ mapOf( "a" to "b" ),
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -18,4 +18,4 @@ account.updatePrefs(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/update-push-target.md b/docs/examples/java/account/update-push-target.md
new file mode 100644
index 0000000..10efbad
--- /dev/null
+++ b/docs/examples/java/account/update-push-target.md
@@ -0,0 +1,22 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
+
+Client client = new Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
+
+Account account = new Account(client);
+
+account.updatePushTarget(
+ "[TARGET_ID]",
+ "[IDENTIFIER]",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/update-recovery.md b/docs/examples/java/account/update-recovery.md
index 7b0f392..313eaa5 100644
--- a/docs/examples/java/account/update-recovery.md
+++ b/docs/examples/java/account/update-recovery.md
@@ -11,8 +11,7 @@ Account account = new Account(client);
account.updateRecovery(
"[USER_ID]",
"[SECRET]",
- "password",
- "password"
+ "",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -21,4 +20,4 @@ account.updateRecovery(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/update-session.md b/docs/examples/java/account/update-session.md
index 27b8f00..66eda54 100644
--- a/docs/examples/java/account/update-session.md
+++ b/docs/examples/java/account/update-session.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Account account = new Account(client);
account.updateSession(
- "[SESSION_ID]"
+ "[SESSION_ID]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -18,4 +18,4 @@ account.updateSession(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/update-status.md b/docs/examples/java/account/update-status.md
index 1e18ded..61cb944 100644
--- a/docs/examples/java/account/update-status.md
+++ b/docs/examples/java/account/update-status.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Account account = new Account(client);
account.updateStatus(new CoroutineCallback<>((result, error) -> {
- if (error != null)
+ if (error != null) {
error.printStackTrace();
return;
}
diff --git a/docs/examples/java/account/update-verification.md b/docs/examples/java/account/update-verification.md
index d852dbf..9beb1bd 100644
--- a/docs/examples/java/account/update-verification.md
+++ b/docs/examples/java/account/update-verification.md
@@ -10,7 +10,7 @@ Account account = new Account(client);
account.updateVerification(
"[USER_ID]",
- "[SECRET]"
+ "[SECRET]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -19,4 +19,4 @@ account.updateVerification(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/account/verify-authenticator.md b/docs/examples/java/account/verify-authenticator.md
new file mode 100644
index 0000000..7a99ffc
--- /dev/null
+++ b/docs/examples/java/account/verify-authenticator.md
@@ -0,0 +1,23 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
+import io.appwrite.enums.AuthenticatorFactor;
+
+Client client = new Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
+
+Account account = new Account(client);
+
+account.verifyAuthenticator(
+ AuthenticatorFactor.TOTP,
+ "[OTP]",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
\ No newline at end of file
diff --git a/docs/examples/java/avatars/get-browser.md b/docs/examples/java/avatars/get-browser.md
index f072110..0652a47 100644
--- a/docs/examples/java/avatars/get-browser.md
+++ b/docs/examples/java/avatars/get-browser.md
@@ -1,6 +1,7 @@
import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Avatars;
+import io.appwrite.enums.Browser;
Client client = new Client(context)
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
@@ -9,7 +10,7 @@ Client client = new Client(context)
Avatars avatars = new Avatars(client);
avatars.getBrowser(
- "aa",
+ Browser.AVANT_BROWSER,
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -18,4 +19,4 @@ avatars.getBrowser(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/avatars/get-credit-card.md b/docs/examples/java/avatars/get-credit-card.md
index 0a73312..0f0541a 100644
--- a/docs/examples/java/avatars/get-credit-card.md
+++ b/docs/examples/java/avatars/get-credit-card.md
@@ -1,6 +1,7 @@
import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Avatars;
+import io.appwrite.enums.CreditCard;
Client client = new Client(context)
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
@@ -9,7 +10,7 @@ Client client = new Client(context)
Avatars avatars = new Avatars(client);
avatars.getCreditCard(
- "amex",
+ CreditCard.AMERICAN_EXPRESS,
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -18,4 +19,4 @@ avatars.getCreditCard(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/avatars/get-favicon.md b/docs/examples/java/avatars/get-favicon.md
index e0c1cb6..cef5b08 100644
--- a/docs/examples/java/avatars/get-favicon.md
+++ b/docs/examples/java/avatars/get-favicon.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Avatars avatars = new Avatars(client);
avatars.getFavicon(
- "https://example.com"
+ "https://example.com",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -18,4 +18,4 @@ avatars.getFavicon(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/avatars/get-flag.md b/docs/examples/java/avatars/get-flag.md
index a5f4790..c931336 100644
--- a/docs/examples/java/avatars/get-flag.md
+++ b/docs/examples/java/avatars/get-flag.md
@@ -1,6 +1,7 @@
import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Avatars;
+import io.appwrite.enums.Flag;
Client client = new Client(context)
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
@@ -9,7 +10,7 @@ Client client = new Client(context)
Avatars avatars = new Avatars(client);
avatars.getFlag(
- "af",
+ Flag.AFGHANISTAN,
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -18,4 +19,4 @@ avatars.getFlag(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/avatars/get-image.md b/docs/examples/java/avatars/get-image.md
index cdc8ac7..8ae4df1 100644
--- a/docs/examples/java/avatars/get-image.md
+++ b/docs/examples/java/avatars/get-image.md
@@ -18,4 +18,4 @@ avatars.getImage(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/avatars/get-initials.md b/docs/examples/java/avatars/get-initials.md
index c02490c..36757c4 100644
--- a/docs/examples/java/avatars/get-initials.md
+++ b/docs/examples/java/avatars/get-initials.md
@@ -17,4 +17,4 @@ avatars.getInitials(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/avatars/get-q-r.md b/docs/examples/java/avatars/get-q-r.md
index 2532f20..4894433 100644
--- a/docs/examples/java/avatars/get-q-r.md
+++ b/docs/examples/java/avatars/get-q-r.md
@@ -18,4 +18,4 @@ avatars.getQR(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/databases/create-document.md b/docs/examples/java/databases/create-document.md
index 715e4cd..c26a142 100644
--- a/docs/examples/java/databases/create-document.md
+++ b/docs/examples/java/databases/create-document.md
@@ -21,4 +21,4 @@ databases.createDocument(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/databases/delete-document.md b/docs/examples/java/databases/delete-document.md
index 1387f48..d59266b 100644
--- a/docs/examples/java/databases/delete-document.md
+++ b/docs/examples/java/databases/delete-document.md
@@ -11,7 +11,7 @@ Databases databases = new Databases(client);
databases.deleteDocument(
"[DATABASE_ID]",
"[COLLECTION_ID]",
- "[DOCUMENT_ID]"
+ "[DOCUMENT_ID]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -20,4 +20,4 @@ databases.deleteDocument(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/databases/get-document.md b/docs/examples/java/databases/get-document.md
index b1a7161..a63836e 100644
--- a/docs/examples/java/databases/get-document.md
+++ b/docs/examples/java/databases/get-document.md
@@ -20,4 +20,4 @@ databases.getDocument(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/databases/list-documents.md b/docs/examples/java/databases/list-documents.md
index 62dc2c7..6f577ef 100644
--- a/docs/examples/java/databases/list-documents.md
+++ b/docs/examples/java/databases/list-documents.md
@@ -19,4 +19,4 @@ databases.listDocuments(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/databases/update-document.md b/docs/examples/java/databases/update-document.md
index d1ed59d..ae4d539 100644
--- a/docs/examples/java/databases/update-document.md
+++ b/docs/examples/java/databases/update-document.md
@@ -20,4 +20,4 @@ databases.updateDocument(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/functions/create-execution.md b/docs/examples/java/functions/create-execution.md
index 3cce1c3..985d502 100644
--- a/docs/examples/java/functions/create-execution.md
+++ b/docs/examples/java/functions/create-execution.md
@@ -18,4 +18,4 @@ functions.createExecution(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/functions/get-execution.md b/docs/examples/java/functions/get-execution.md
index 459d743..c066540 100644
--- a/docs/examples/java/functions/get-execution.md
+++ b/docs/examples/java/functions/get-execution.md
@@ -10,7 +10,7 @@ Functions functions = new Functions(client);
functions.getExecution(
"[FUNCTION_ID]",
- "[EXECUTION_ID]"
+ "[EXECUTION_ID]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -19,4 +19,4 @@ functions.getExecution(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/functions/list-executions.md b/docs/examples/java/functions/list-executions.md
index c1f982b..53f45ca 100644
--- a/docs/examples/java/functions/list-executions.md
+++ b/docs/examples/java/functions/list-executions.md
@@ -18,4 +18,4 @@ functions.listExecutions(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/graphql/mutation.md b/docs/examples/java/graphql/mutation.md
index 262e513..5d140d6 100644
--- a/docs/examples/java/graphql/mutation.md
+++ b/docs/examples/java/graphql/mutation.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Graphql graphql = new Graphql(client);
graphql.mutation(
- mapOf( "a" to "b" )
+ mapOf( "a" to "b" ),
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -18,4 +18,4 @@ graphql.mutation(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/graphql/query.md b/docs/examples/java/graphql/query.md
index 4291b47..de693fa 100644
--- a/docs/examples/java/graphql/query.md
+++ b/docs/examples/java/graphql/query.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Graphql graphql = new Graphql(client);
graphql.query(
- mapOf( "a" to "b" )
+ mapOf( "a" to "b" ),
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -18,4 +18,4 @@ graphql.query(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/locale/get.md b/docs/examples/java/locale/get.md
index 4d14be6..cc37896 100644
--- a/docs/examples/java/locale/get.md
+++ b/docs/examples/java/locale/get.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Locale locale = new Locale(client);
locale.get(new CoroutineCallback<>((result, error) -> {
- if (error != null)
+ if (error != null) {
error.printStackTrace();
return;
}
diff --git a/docs/examples/java/locale/list-codes.md b/docs/examples/java/locale/list-codes.md
index 599070e..3fbdf85 100644
--- a/docs/examples/java/locale/list-codes.md
+++ b/docs/examples/java/locale/list-codes.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Locale locale = new Locale(client);
locale.listCodes(new CoroutineCallback<>((result, error) -> {
- if (error != null)
+ if (error != null) {
error.printStackTrace();
return;
}
diff --git a/docs/examples/java/locale/list-continents.md b/docs/examples/java/locale/list-continents.md
index 6abe97a..296eade 100644
--- a/docs/examples/java/locale/list-continents.md
+++ b/docs/examples/java/locale/list-continents.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Locale locale = new Locale(client);
locale.listContinents(new CoroutineCallback<>((result, error) -> {
- if (error != null)
+ if (error != null) {
error.printStackTrace();
return;
}
diff --git a/docs/examples/java/locale/list-countries-e-u.md b/docs/examples/java/locale/list-countries-e-u.md
index 3c5ca3a..f674ac5 100644
--- a/docs/examples/java/locale/list-countries-e-u.md
+++ b/docs/examples/java/locale/list-countries-e-u.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Locale locale = new Locale(client);
locale.listCountriesEU(new CoroutineCallback<>((result, error) -> {
- if (error != null)
+ if (error != null) {
error.printStackTrace();
return;
}
diff --git a/docs/examples/java/locale/list-countries-phones.md b/docs/examples/java/locale/list-countries-phones.md
index 81ef94d..6280cbb 100644
--- a/docs/examples/java/locale/list-countries-phones.md
+++ b/docs/examples/java/locale/list-countries-phones.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Locale locale = new Locale(client);
locale.listCountriesPhones(new CoroutineCallback<>((result, error) -> {
- if (error != null)
+ if (error != null) {
error.printStackTrace();
return;
}
diff --git a/docs/examples/java/locale/list-countries.md b/docs/examples/java/locale/list-countries.md
index dc0d5f5..eab9ae2 100644
--- a/docs/examples/java/locale/list-countries.md
+++ b/docs/examples/java/locale/list-countries.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Locale locale = new Locale(client);
locale.listCountries(new CoroutineCallback<>((result, error) -> {
- if (error != null)
+ if (error != null) {
error.printStackTrace();
return;
}
diff --git a/docs/examples/java/locale/list-currencies.md b/docs/examples/java/locale/list-currencies.md
index 7a327b3..662e025 100644
--- a/docs/examples/java/locale/list-currencies.md
+++ b/docs/examples/java/locale/list-currencies.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Locale locale = new Locale(client);
locale.listCurrencies(new CoroutineCallback<>((result, error) -> {
- if (error != null)
+ if (error != null) {
error.printStackTrace();
return;
}
diff --git a/docs/examples/java/locale/list-languages.md b/docs/examples/java/locale/list-languages.md
index 0688614..dd68bf2 100644
--- a/docs/examples/java/locale/list-languages.md
+++ b/docs/examples/java/locale/list-languages.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Locale locale = new Locale(client);
locale.listLanguages(new CoroutineCallback<>((result, error) -> {
- if (error != null)
+ if (error != null) {
error.printStackTrace();
return;
}
diff --git a/docs/examples/java/messaging/create-subscriber.md b/docs/examples/java/messaging/create-subscriber.md
new file mode 100644
index 0000000..d071008
--- /dev/null
+++ b/docs/examples/java/messaging/create-subscriber.md
@@ -0,0 +1,23 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Messaging;
+
+Client client = new Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
+
+Messaging messaging = new Messaging(client);
+
+messaging.createSubscriber(
+ "[TOPIC_ID]",
+ "[SUBSCRIBER_ID]",
+ "[TARGET_ID]",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
\ No newline at end of file
diff --git a/docs/examples/java/messaging/delete-subscriber.md b/docs/examples/java/messaging/delete-subscriber.md
new file mode 100644
index 0000000..a1d5686
--- /dev/null
+++ b/docs/examples/java/messaging/delete-subscriber.md
@@ -0,0 +1,22 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Messaging;
+
+Client client = new Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
+
+Messaging messaging = new Messaging(client);
+
+messaging.deleteSubscriber(
+ "[TOPIC_ID]",
+ "[SUBSCRIBER_ID]",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
\ No newline at end of file
diff --git a/docs/examples/java/storage/create-file.md b/docs/examples/java/storage/create-file.md
index 732b302..b99312b 100644
--- a/docs/examples/java/storage/create-file.md
+++ b/docs/examples/java/storage/create-file.md
@@ -21,4 +21,4 @@ storage.createFile(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/storage/delete-file.md b/docs/examples/java/storage/delete-file.md
index 69a0f0f..9ac7f2e 100644
--- a/docs/examples/java/storage/delete-file.md
+++ b/docs/examples/java/storage/delete-file.md
@@ -10,7 +10,7 @@ Storage storage = new Storage(client);
storage.deleteFile(
"[BUCKET_ID]",
- "[FILE_ID]"
+ "[FILE_ID]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -19,4 +19,4 @@ storage.deleteFile(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/storage/get-file-download.md b/docs/examples/java/storage/get-file-download.md
index 2ab30dc..7428cc0 100644
--- a/docs/examples/java/storage/get-file-download.md
+++ b/docs/examples/java/storage/get-file-download.md
@@ -10,7 +10,7 @@ Storage storage = new Storage(client);
storage.getFileDownload(
"[BUCKET_ID]",
- "[FILE_ID]"
+ "[FILE_ID]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -19,4 +19,4 @@ storage.getFileDownload(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/storage/get-file-preview.md b/docs/examples/java/storage/get-file-preview.md
index 483f2fc..6de0abf 100644
--- a/docs/examples/java/storage/get-file-preview.md
+++ b/docs/examples/java/storage/get-file-preview.md
@@ -19,4 +19,4 @@ storage.getFilePreview(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/storage/get-file-view.md b/docs/examples/java/storage/get-file-view.md
index 5614b69..3c0392d 100644
--- a/docs/examples/java/storage/get-file-view.md
+++ b/docs/examples/java/storage/get-file-view.md
@@ -10,7 +10,7 @@ Storage storage = new Storage(client);
storage.getFileView(
"[BUCKET_ID]",
- "[FILE_ID]"
+ "[FILE_ID]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -19,4 +19,4 @@ storage.getFileView(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/storage/get-file.md b/docs/examples/java/storage/get-file.md
index 4ae0de0..c425758 100644
--- a/docs/examples/java/storage/get-file.md
+++ b/docs/examples/java/storage/get-file.md
@@ -10,7 +10,7 @@ Storage storage = new Storage(client);
storage.getFile(
"[BUCKET_ID]",
- "[FILE_ID]"
+ "[FILE_ID]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -19,4 +19,4 @@ storage.getFile(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/storage/list-files.md b/docs/examples/java/storage/list-files.md
index dedfb6c..b6d38aa 100644
--- a/docs/examples/java/storage/list-files.md
+++ b/docs/examples/java/storage/list-files.md
@@ -18,4 +18,4 @@ storage.listFiles(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/storage/update-file.md b/docs/examples/java/storage/update-file.md
index 9b4dd92..6aae427 100644
--- a/docs/examples/java/storage/update-file.md
+++ b/docs/examples/java/storage/update-file.md
@@ -19,4 +19,4 @@ storage.updateFile(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/teams/create-membership.md b/docs/examples/java/teams/create-membership.md
index 6073f5b..3091164 100644
--- a/docs/examples/java/teams/create-membership.md
+++ b/docs/examples/java/teams/create-membership.md
@@ -19,4 +19,4 @@ teams.createMembership(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/teams/create.md b/docs/examples/java/teams/create.md
index 263fa57..aa7f567 100644
--- a/docs/examples/java/teams/create.md
+++ b/docs/examples/java/teams/create.md
@@ -19,4 +19,4 @@ teams.create(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/teams/delete-membership.md b/docs/examples/java/teams/delete-membership.md
index 40f28f0..3837fad 100644
--- a/docs/examples/java/teams/delete-membership.md
+++ b/docs/examples/java/teams/delete-membership.md
@@ -10,7 +10,7 @@ Teams teams = new Teams(client);
teams.deleteMembership(
"[TEAM_ID]",
- "[MEMBERSHIP_ID]"
+ "[MEMBERSHIP_ID]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -19,4 +19,4 @@ teams.deleteMembership(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/teams/delete.md b/docs/examples/java/teams/delete.md
index 5b4c378..75355ae 100644
--- a/docs/examples/java/teams/delete.md
+++ b/docs/examples/java/teams/delete.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Teams teams = new Teams(client);
teams.delete(
- "[TEAM_ID]"
+ "[TEAM_ID]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -18,4 +18,4 @@ teams.delete(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/teams/get-membership.md b/docs/examples/java/teams/get-membership.md
index f2f1d99..0ba9c87 100644
--- a/docs/examples/java/teams/get-membership.md
+++ b/docs/examples/java/teams/get-membership.md
@@ -10,7 +10,7 @@ Teams teams = new Teams(client);
teams.getMembership(
"[TEAM_ID]",
- "[MEMBERSHIP_ID]"
+ "[MEMBERSHIP_ID]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -19,4 +19,4 @@ teams.getMembership(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/teams/get-prefs.md b/docs/examples/java/teams/get-prefs.md
index 6963cb4..e93b482 100644
--- a/docs/examples/java/teams/get-prefs.md
+++ b/docs/examples/java/teams/get-prefs.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Teams teams = new Teams(client);
teams.getPrefs(
- "[TEAM_ID]"
+ "[TEAM_ID]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -18,4 +18,4 @@ teams.getPrefs(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/teams/get.md b/docs/examples/java/teams/get.md
index 549af20..f5406a2 100644
--- a/docs/examples/java/teams/get.md
+++ b/docs/examples/java/teams/get.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Teams teams = new Teams(client);
teams.get(
- "[TEAM_ID]"
+ "[TEAM_ID]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -18,4 +18,4 @@ teams.get(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/teams/list-memberships.md b/docs/examples/java/teams/list-memberships.md
index 3da4e33..b61b0d0 100644
--- a/docs/examples/java/teams/list-memberships.md
+++ b/docs/examples/java/teams/list-memberships.md
@@ -18,4 +18,4 @@ teams.listMemberships(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/teams/list.md b/docs/examples/java/teams/list.md
index b20ad4a..2f21813 100644
--- a/docs/examples/java/teams/list.md
+++ b/docs/examples/java/teams/list.md
@@ -17,4 +17,4 @@ teams.list(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/teams/update-membership-status.md b/docs/examples/java/teams/update-membership-status.md
index 499251f..33bd869 100644
--- a/docs/examples/java/teams/update-membership-status.md
+++ b/docs/examples/java/teams/update-membership-status.md
@@ -12,7 +12,7 @@ teams.updateMembershipStatus(
"[TEAM_ID]",
"[MEMBERSHIP_ID]",
"[USER_ID]",
- "[SECRET]"
+ "[SECRET]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -21,4 +21,4 @@ teams.updateMembershipStatus(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/teams/update-membership.md b/docs/examples/java/teams/update-membership.md
index 6cb3346..48efbe3 100644
--- a/docs/examples/java/teams/update-membership.md
+++ b/docs/examples/java/teams/update-membership.md
@@ -11,7 +11,7 @@ Teams teams = new Teams(client);
teams.updateMembership(
"[TEAM_ID]",
"[MEMBERSHIP_ID]",
- listOf()
+ listOf(),
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -20,4 +20,4 @@ teams.updateMembership(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/teams/update-name.md b/docs/examples/java/teams/update-name.md
index 170ee59..a84ba84 100644
--- a/docs/examples/java/teams/update-name.md
+++ b/docs/examples/java/teams/update-name.md
@@ -10,7 +10,7 @@ Teams teams = new Teams(client);
teams.updateName(
"[TEAM_ID]",
- "[NAME]"
+ "[NAME]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -19,4 +19,4 @@ teams.updateName(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/teams/update-prefs.md b/docs/examples/java/teams/update-prefs.md
index a19ad82..874f976 100644
--- a/docs/examples/java/teams/update-prefs.md
+++ b/docs/examples/java/teams/update-prefs.md
@@ -10,7 +10,7 @@ Teams teams = new Teams(client);
teams.updatePrefs(
"[TEAM_ID]",
- mapOf( "a" to "b" )
+ mapOf( "a" to "b" ),
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -19,4 +19,4 @@ teams.updatePrefs(
Log.d("Appwrite", result.toString());
})
-);
+);
\ No newline at end of file
diff --git a/docs/examples/java/users/delete-authenticator.md b/docs/examples/java/users/delete-authenticator.md
new file mode 100644
index 0000000..2de3df7
--- /dev/null
+++ b/docs/examples/java/users/delete-authenticator.md
@@ -0,0 +1,24 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Users;
+import io.appwrite.enums.AuthenticatorProvider;
+
+Client client = new Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
+
+Users users = new Users(client);
+
+users.deleteAuthenticator(
+ "[USER_ID]",
+ AuthenticatorProvider.TOTP,
+ "[OTP]",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
\ No newline at end of file
diff --git a/docs/examples/java/users/list-providers.md b/docs/examples/java/users/list-providers.md
new file mode 100644
index 0000000..ca2f27d
--- /dev/null
+++ b/docs/examples/java/users/list-providers.md
@@ -0,0 +1,21 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Users;
+
+Client client = new Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2"); // Your project ID
+
+Users users = new Users(client);
+
+users.listProviders(
+ "[USER_ID]",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/add-authenticator.md b/docs/examples/kotlin/account/add-authenticator.md
new file mode 100644
index 0000000..adb0cf9
--- /dev/null
+++ b/docs/examples/kotlin/account/add-authenticator.md
@@ -0,0 +1,14 @@
+import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
+import io.appwrite.services.Account
+import io.appwrite.enums.AuthenticatorFactor
+
+val client = Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+
+val account = Account(client)
+
+val response = account.addAuthenticator(
+ factor = AuthenticatorFactor.TOTP,
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/create-anonymous-session.md b/docs/examples/kotlin/account/create-anonymous-session.md
index cdcf401..6d1e632 100644
--- a/docs/examples/kotlin/account/create-anonymous-session.md
+++ b/docs/examples/kotlin/account/create-anonymous-session.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
diff --git a/docs/examples/kotlin/account/create-challenge.md b/docs/examples/kotlin/account/create-challenge.md
new file mode 100644
index 0000000..d1b0df9
--- /dev/null
+++ b/docs/examples/kotlin/account/create-challenge.md
@@ -0,0 +1,14 @@
+import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
+import io.appwrite.services.Account
+import io.appwrite.enums.AuthenticatorProvider
+
+val client = Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+
+val account = Account(client)
+
+val response = account.createChallenge(
+ provider = AuthenticatorProvider.TOTP,
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/create-email-password-session.md b/docs/examples/kotlin/account/create-email-password-session.md
new file mode 100644
index 0000000..016e73b
--- /dev/null
+++ b/docs/examples/kotlin/account/create-email-password-session.md
@@ -0,0 +1,14 @@
+import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
+import io.appwrite.services.Account
+
+val client = Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+
+val account = Account(client)
+
+val response = account.createEmailPasswordSession(
+ email = "email@example.com",
+ password = "password",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/create-magic-u-r-l-session.md b/docs/examples/kotlin/account/create-email-token.md
similarity index 77%
rename from docs/examples/kotlin/account/create-magic-u-r-l-session.md
rename to docs/examples/kotlin/account/create-email-token.md
index 51368b5..6165707 100644
--- a/docs/examples/kotlin/account/create-magic-u-r-l-session.md
+++ b/docs/examples/kotlin/account/create-email-token.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
@@ -7,7 +8,7 @@ val client = Client(context)
val account = Account(client)
-val response = account.createMagicURLSession(
+val response = account.createEmailToken(
userId = "[USER_ID]",
email = "email@example.com",
-)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/create-j-w-t.md b/docs/examples/kotlin/account/create-j-w-t.md
index 35e7a6f..c3131e6 100644
--- a/docs/examples/kotlin/account/create-j-w-t.md
+++ b/docs/examples/kotlin/account/create-j-w-t.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
diff --git a/docs/examples/kotlin/account/create-email-session.md b/docs/examples/kotlin/account/create-magic-u-r-l-token.md
similarity index 70%
rename from docs/examples/kotlin/account/create-email-session.md
rename to docs/examples/kotlin/account/create-magic-u-r-l-token.md
index ab8d581..9d02c96 100644
--- a/docs/examples/kotlin/account/create-email-session.md
+++ b/docs/examples/kotlin/account/create-magic-u-r-l-token.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
@@ -7,7 +8,7 @@ val client = Client(context)
val account = Account(client)
-val response = account.createEmailSession(
+val response = account.createMagicURLToken(
+ userId = "[USER_ID]",
email = "email@example.com",
- password = "password"
-)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/create-o-auth2session.md b/docs/examples/kotlin/account/create-o-auth2session.md
index 395bfad..ac01fe5 100644
--- a/docs/examples/kotlin/account/create-o-auth2session.md
+++ b/docs/examples/kotlin/account/create-o-auth2session.md
@@ -1,5 +1,7 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
+import io.appwrite.enums.OAuthProvider
val client = Client(context)
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
@@ -8,5 +10,5 @@ val client = Client(context)
val account = Account(client)
account.createOAuth2Session(
- provider = "amazon",
-)
+ provider = OAuthProvider.AMAZON,
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/create-phone-token.md b/docs/examples/kotlin/account/create-phone-token.md
new file mode 100644
index 0000000..abb46c5
--- /dev/null
+++ b/docs/examples/kotlin/account/create-phone-token.md
@@ -0,0 +1,14 @@
+import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
+import io.appwrite.services.Account
+
+val client = Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+
+val account = Account(client)
+
+val response = account.createPhoneToken(
+ userId = "[USER_ID]",
+ phone = "+12065550100",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/create-phone-verification.md b/docs/examples/kotlin/account/create-phone-verification.md
index 12fb9f7..3fb5064 100644
--- a/docs/examples/kotlin/account/create-phone-verification.md
+++ b/docs/examples/kotlin/account/create-phone-verification.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
diff --git a/docs/examples/kotlin/account/create-push-target.md b/docs/examples/kotlin/account/create-push-target.md
new file mode 100644
index 0000000..30c4d39
--- /dev/null
+++ b/docs/examples/kotlin/account/create-push-target.md
@@ -0,0 +1,14 @@
+import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
+import io.appwrite.services.Account
+
+val client = Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+
+val account = Account(client)
+
+val response = account.createPushTarget(
+ targetId = "[TARGET_ID]",
+ identifier = "[IDENTIFIER]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/create-recovery.md b/docs/examples/kotlin/account/create-recovery.md
index 7d73a67..f678fcf 100644
--- a/docs/examples/kotlin/account/create-recovery.md
+++ b/docs/examples/kotlin/account/create-recovery.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
@@ -9,5 +10,5 @@ val account = Account(client)
val response = account.createRecovery(
email = "email@example.com",
- url = "https://example.com"
-)
+ url = "https://example.com",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/create-session.md b/docs/examples/kotlin/account/create-session.md
new file mode 100644
index 0000000..ceb7726
--- /dev/null
+++ b/docs/examples/kotlin/account/create-session.md
@@ -0,0 +1,14 @@
+import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
+import io.appwrite.services.Account
+
+val client = Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+
+val account = Account(client)
+
+val response = account.createSession(
+ userId = "[USER_ID]",
+ secret = "[SECRET]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/create-verification.md b/docs/examples/kotlin/account/create-verification.md
index b3dc43a..1832348 100644
--- a/docs/examples/kotlin/account/create-verification.md
+++ b/docs/examples/kotlin/account/create-verification.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
@@ -8,5 +9,5 @@ val client = Client(context)
val account = Account(client)
val response = account.createVerification(
- url = "https://example.com"
-)
+ url = "https://example.com",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/create.md b/docs/examples/kotlin/account/create.md
index c72ae90..8022955 100644
--- a/docs/examples/kotlin/account/create.md
+++ b/docs/examples/kotlin/account/create.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
@@ -11,4 +12,4 @@ val response = account.create(
userId = "[USER_ID]",
email = "email@example.com",
password = "",
-)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/delete-authenticator.md b/docs/examples/kotlin/account/delete-authenticator.md
new file mode 100644
index 0000000..beb63f1
--- /dev/null
+++ b/docs/examples/kotlin/account/delete-authenticator.md
@@ -0,0 +1,15 @@
+import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
+import io.appwrite.services.Account
+import io.appwrite.enums.AuthenticatorProvider
+
+val client = Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+
+val account = Account(client)
+
+val response = account.deleteAuthenticator(
+ provider = AuthenticatorProvider.TOTP,
+ otp = "[OTP]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/delete-identity.md b/docs/examples/kotlin/account/delete-identity.md
index 440333e..cbf6913 100644
--- a/docs/examples/kotlin/account/delete-identity.md
+++ b/docs/examples/kotlin/account/delete-identity.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
@@ -8,5 +9,5 @@ val client = Client(context)
val account = Account(client)
val response = account.deleteIdentity(
- identityId = "[IDENTITY_ID]"
-)
+ identityId = "[IDENTITY_ID]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/delete-push-target.md b/docs/examples/kotlin/account/delete-push-target.md
new file mode 100644
index 0000000..ea79749
--- /dev/null
+++ b/docs/examples/kotlin/account/delete-push-target.md
@@ -0,0 +1,13 @@
+import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
+import io.appwrite.services.Account
+
+val client = Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+
+val account = Account(client)
+
+val response = account.deletePushTarget(
+ targetId = "[TARGET_ID]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/delete-session.md b/docs/examples/kotlin/account/delete-session.md
index a98a286..615f218 100644
--- a/docs/examples/kotlin/account/delete-session.md
+++ b/docs/examples/kotlin/account/delete-session.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
@@ -8,5 +9,5 @@ val client = Client(context)
val account = Account(client)
val response = account.deleteSession(
- sessionId = "[SESSION_ID]"
-)
+ sessionId = "[SESSION_ID]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/delete-sessions.md b/docs/examples/kotlin/account/delete-sessions.md
index c9afbf1..db8e00d 100644
--- a/docs/examples/kotlin/account/delete-sessions.md
+++ b/docs/examples/kotlin/account/delete-sessions.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
diff --git a/docs/examples/kotlin/account/get-prefs.md b/docs/examples/kotlin/account/get-prefs.md
index bd3f81a..0112f8b 100644
--- a/docs/examples/kotlin/account/get-prefs.md
+++ b/docs/examples/kotlin/account/get-prefs.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
diff --git a/docs/examples/kotlin/account/get-session.md b/docs/examples/kotlin/account/get-session.md
index d6d6c72..1b15d5b 100644
--- a/docs/examples/kotlin/account/get-session.md
+++ b/docs/examples/kotlin/account/get-session.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
@@ -8,5 +9,5 @@ val client = Client(context)
val account = Account(client)
val response = account.getSession(
- sessionId = "[SESSION_ID]"
-)
+ sessionId = "[SESSION_ID]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/get.md b/docs/examples/kotlin/account/get.md
index 4c8f0be..6c08a1c 100644
--- a/docs/examples/kotlin/account/get.md
+++ b/docs/examples/kotlin/account/get.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
diff --git a/docs/examples/kotlin/account/update-phone-session.md b/docs/examples/kotlin/account/list-factors.md
similarity index 72%
rename from docs/examples/kotlin/account/update-phone-session.md
rename to docs/examples/kotlin/account/list-factors.md
index d3b02e0..e30f652 100644
--- a/docs/examples/kotlin/account/update-phone-session.md
+++ b/docs/examples/kotlin/account/list-factors.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
@@ -7,7 +8,4 @@ val client = Client(context)
val account = Account(client)
-val response = account.updatePhoneSession(
- userId = "[USER_ID]",
- secret = "[SECRET]"
-)
+val response = account.listFactors()
diff --git a/docs/examples/kotlin/account/list-identities.md b/docs/examples/kotlin/account/list-identities.md
index 3292b35..d87409c 100644
--- a/docs/examples/kotlin/account/list-identities.md
+++ b/docs/examples/kotlin/account/list-identities.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
@@ -8,4 +9,4 @@ val client = Client(context)
val account = Account(client)
val response = account.listIdentities(
-)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/list-logs.md b/docs/examples/kotlin/account/list-logs.md
index eb337ca..f4ce74f 100644
--- a/docs/examples/kotlin/account/list-logs.md
+++ b/docs/examples/kotlin/account/list-logs.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
@@ -8,4 +9,4 @@ val client = Client(context)
val account = Account(client)
val response = account.listLogs(
-)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/list-sessions.md b/docs/examples/kotlin/account/list-sessions.md
index cd9f63b..2c692b8 100644
--- a/docs/examples/kotlin/account/list-sessions.md
+++ b/docs/examples/kotlin/account/list-sessions.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
diff --git a/docs/examples/kotlin/account/update-challenge.md b/docs/examples/kotlin/account/update-challenge.md
new file mode 100644
index 0000000..23718d2
--- /dev/null
+++ b/docs/examples/kotlin/account/update-challenge.md
@@ -0,0 +1,14 @@
+import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
+import io.appwrite.services.Account
+
+val client = Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+
+val account = Account(client)
+
+val response = account.updateChallenge(
+ challengeId = "[CHALLENGE_ID]",
+ otp = "[OTP]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/update-email.md b/docs/examples/kotlin/account/update-email.md
index 85a0242..6b3655a 100644
--- a/docs/examples/kotlin/account/update-email.md
+++ b/docs/examples/kotlin/account/update-email.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
@@ -9,5 +10,5 @@ val account = Account(client)
val response = account.updateEmail(
email = "email@example.com",
- password = "password"
-)
+ password = "password",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/create-phone-session.md b/docs/examples/kotlin/account/update-m-f-a.md
similarity index 71%
rename from docs/examples/kotlin/account/create-phone-session.md
rename to docs/examples/kotlin/account/update-m-f-a.md
index eed6f7a..1bd3fd2 100644
--- a/docs/examples/kotlin/account/create-phone-session.md
+++ b/docs/examples/kotlin/account/update-m-f-a.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
@@ -7,7 +8,6 @@ val client = Client(context)
val account = Account(client)
-val response = account.createPhoneSession(
- userId = "[USER_ID]",
- phone = "+12065550100"
-)
+val response = account.updateMFA(
+ mfa = false,
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/update-magic-u-r-l-session.md b/docs/examples/kotlin/account/update-magic-u-r-l-session.md
index c7286ba..1f77281 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,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
@@ -9,5 +10,5 @@ val account = Account(client)
val response = account.updateMagicURLSession(
userId = "[USER_ID]",
- secret = "[SECRET]"
-)
+ secret = "[SECRET]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/update-name.md b/docs/examples/kotlin/account/update-name.md
index 574f493..5d18e1f 100644
--- a/docs/examples/kotlin/account/update-name.md
+++ b/docs/examples/kotlin/account/update-name.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
@@ -8,5 +9,5 @@ val client = Client(context)
val account = Account(client)
val response = account.updateName(
- name = "[NAME]"
-)
+ name = "[NAME]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/update-password.md b/docs/examples/kotlin/account/update-password.md
index c5338b8..45e9556 100644
--- a/docs/examples/kotlin/account/update-password.md
+++ b/docs/examples/kotlin/account/update-password.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
@@ -9,4 +10,4 @@ val account = Account(client)
val response = account.updatePassword(
password = "",
-)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/update-phone-verification.md b/docs/examples/kotlin/account/update-phone-verification.md
index 0314f74..c4c0e84 100644
--- a/docs/examples/kotlin/account/update-phone-verification.md
+++ b/docs/examples/kotlin/account/update-phone-verification.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
@@ -9,5 +10,5 @@ val account = Account(client)
val response = account.updatePhoneVerification(
userId = "[USER_ID]",
- secret = "[SECRET]"
-)
+ secret = "[SECRET]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/update-phone.md b/docs/examples/kotlin/account/update-phone.md
index 76eb8aa..d86e628 100644
--- a/docs/examples/kotlin/account/update-phone.md
+++ b/docs/examples/kotlin/account/update-phone.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
@@ -9,5 +10,5 @@ val account = Account(client)
val response = account.updatePhone(
phone = "+12065550100",
- password = "password"
-)
+ password = "password",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/update-prefs.md b/docs/examples/kotlin/account/update-prefs.md
index f16e40b..58d5cd0 100644
--- a/docs/examples/kotlin/account/update-prefs.md
+++ b/docs/examples/kotlin/account/update-prefs.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
@@ -8,5 +9,5 @@ val client = Client(context)
val account = Account(client)
val response = account.updatePrefs(
- prefs = mapOf( "a" to "b" )
-)
+ prefs = mapOf( "a" to "b" ),
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/update-push-target.md b/docs/examples/kotlin/account/update-push-target.md
new file mode 100644
index 0000000..ff1e3a1
--- /dev/null
+++ b/docs/examples/kotlin/account/update-push-target.md
@@ -0,0 +1,14 @@
+import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
+import io.appwrite.services.Account
+
+val client = Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+
+val account = Account(client)
+
+val response = account.updatePushTarget(
+ targetId = "[TARGET_ID]",
+ identifier = "[IDENTIFIER]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/update-recovery.md b/docs/examples/kotlin/account/update-recovery.md
index 9682899..6b7a6d0 100644
--- a/docs/examples/kotlin/account/update-recovery.md
+++ b/docs/examples/kotlin/account/update-recovery.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
@@ -10,6 +11,5 @@ val account = Account(client)
val response = account.updateRecovery(
userId = "[USER_ID]",
secret = "[SECRET]",
- password = "password",
- passwordAgain = "password"
-)
+ password = "",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/update-session.md b/docs/examples/kotlin/account/update-session.md
index e9e83d0..1257334 100644
--- a/docs/examples/kotlin/account/update-session.md
+++ b/docs/examples/kotlin/account/update-session.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
@@ -8,5 +9,5 @@ val client = Client(context)
val account = Account(client)
val response = account.updateSession(
- sessionId = "[SESSION_ID]"
-)
+ sessionId = "[SESSION_ID]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/update-status.md b/docs/examples/kotlin/account/update-status.md
index f7789ea..e822de9 100644
--- a/docs/examples/kotlin/account/update-status.md
+++ b/docs/examples/kotlin/account/update-status.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
diff --git a/docs/examples/kotlin/account/update-verification.md b/docs/examples/kotlin/account/update-verification.md
index af800c1..0dcd75b 100644
--- a/docs/examples/kotlin/account/update-verification.md
+++ b/docs/examples/kotlin/account/update-verification.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Account
val client = Client(context)
@@ -9,5 +10,5 @@ val account = Account(client)
val response = account.updateVerification(
userId = "[USER_ID]",
- secret = "[SECRET]"
-)
+ secret = "[SECRET]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/verify-authenticator.md b/docs/examples/kotlin/account/verify-authenticator.md
new file mode 100644
index 0000000..65144f7
--- /dev/null
+++ b/docs/examples/kotlin/account/verify-authenticator.md
@@ -0,0 +1,15 @@
+import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
+import io.appwrite.services.Account
+import io.appwrite.enums.AuthenticatorFactor
+
+val client = Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+
+val account = Account(client)
+
+val response = account.verifyAuthenticator(
+ factor = AuthenticatorFactor.TOTP,
+ otp = "[OTP]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/avatars/get-browser.md b/docs/examples/kotlin/avatars/get-browser.md
index b1b2d08..ab7c749 100644
--- a/docs/examples/kotlin/avatars/get-browser.md
+++ b/docs/examples/kotlin/avatars/get-browser.md
@@ -1,5 +1,7 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Avatars
+import io.appwrite.enums.Browser
val client = Client(context)
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
@@ -7,6 +9,6 @@ val client = Client(context)
val avatars = Avatars(client)
-val result = avatars.getBrowser(
- code = "aa",
-)
+val result =avatars.getBrowser(
+ code = Browser.AVANT_BROWSER,
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/avatars/get-credit-card.md b/docs/examples/kotlin/avatars/get-credit-card.md
index 411e05a..758f70d 100644
--- a/docs/examples/kotlin/avatars/get-credit-card.md
+++ b/docs/examples/kotlin/avatars/get-credit-card.md
@@ -1,5 +1,7 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Avatars
+import io.appwrite.enums.CreditCard
val client = Client(context)
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
@@ -7,6 +9,6 @@ val client = Client(context)
val avatars = Avatars(client)
-val result = avatars.getCreditCard(
- code = "amex",
-)
+val result =avatars.getCreditCard(
+ code = CreditCard.AMERICAN_EXPRESS,
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/avatars/get-favicon.md b/docs/examples/kotlin/avatars/get-favicon.md
index 1a4b217..1bb1372 100644
--- a/docs/examples/kotlin/avatars/get-favicon.md
+++ b/docs/examples/kotlin/avatars/get-favicon.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Avatars
val client = Client(context)
@@ -7,6 +8,6 @@ val client = Client(context)
val avatars = Avatars(client)
-val result = avatars.getFavicon(
- url = "https://example.com"
-)
+val result =avatars.getFavicon(
+ url = "https://example.com",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/avatars/get-flag.md b/docs/examples/kotlin/avatars/get-flag.md
index 5c882d6..142f626 100644
--- a/docs/examples/kotlin/avatars/get-flag.md
+++ b/docs/examples/kotlin/avatars/get-flag.md
@@ -1,5 +1,7 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Avatars
+import io.appwrite.enums.Flag
val client = Client(context)
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
@@ -7,6 +9,6 @@ val client = Client(context)
val avatars = Avatars(client)
-val result = avatars.getFlag(
- code = "af",
-)
+val result =avatars.getFlag(
+ code = Flag.AFGHANISTAN,
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/avatars/get-image.md b/docs/examples/kotlin/avatars/get-image.md
index 20d8dff..c1ccd96 100644
--- a/docs/examples/kotlin/avatars/get-image.md
+++ b/docs/examples/kotlin/avatars/get-image.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Avatars
val client = Client(context)
@@ -7,6 +8,6 @@ val client = Client(context)
val avatars = Avatars(client)
-val result = avatars.getImage(
+val result =avatars.getImage(
url = "https://example.com",
-)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/avatars/get-initials.md b/docs/examples/kotlin/avatars/get-initials.md
index 70ef9b2..62c69c8 100644
--- a/docs/examples/kotlin/avatars/get-initials.md
+++ b/docs/examples/kotlin/avatars/get-initials.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Avatars
val client = Client(context)
@@ -7,5 +8,5 @@ val client = Client(context)
val avatars = Avatars(client)
-val result = avatars.getInitials(
-)
+val result =avatars.getInitials(
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/avatars/get-q-r.md b/docs/examples/kotlin/avatars/get-q-r.md
index 92b17e1..85de6d3 100644
--- a/docs/examples/kotlin/avatars/get-q-r.md
+++ b/docs/examples/kotlin/avatars/get-q-r.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Avatars
val client = Client(context)
@@ -7,6 +8,6 @@ val client = Client(context)
val avatars = Avatars(client)
-val result = avatars.getQR(
+val result =avatars.getQR(
text = "[TEXT]",
-)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/databases/create-document.md b/docs/examples/kotlin/databases/create-document.md
index d7f1991..bc5445a 100644
--- a/docs/examples/kotlin/databases/create-document.md
+++ b/docs/examples/kotlin/databases/create-document.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Databases
val client = Client(context)
@@ -12,4 +13,4 @@ val response = databases.createDocument(
collectionId = "[COLLECTION_ID]",
documentId = "[DOCUMENT_ID]",
data = mapOf( "a" to "b" ),
-)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/databases/delete-document.md b/docs/examples/kotlin/databases/delete-document.md
index c5bf2a2..d24db61 100644
--- a/docs/examples/kotlin/databases/delete-document.md
+++ b/docs/examples/kotlin/databases/delete-document.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Databases
val client = Client(context)
@@ -10,5 +11,5 @@ val databases = Databases(client)
val response = databases.deleteDocument(
databaseId = "[DATABASE_ID]",
collectionId = "[COLLECTION_ID]",
- documentId = "[DOCUMENT_ID]"
-)
+ documentId = "[DOCUMENT_ID]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/databases/get-document.md b/docs/examples/kotlin/databases/get-document.md
index abdee36..328b801 100644
--- a/docs/examples/kotlin/databases/get-document.md
+++ b/docs/examples/kotlin/databases/get-document.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Databases
val client = Client(context)
@@ -11,4 +12,4 @@ val response = databases.getDocument(
databaseId = "[DATABASE_ID]",
collectionId = "[COLLECTION_ID]",
documentId = "[DOCUMENT_ID]",
-)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/databases/list-documents.md b/docs/examples/kotlin/databases/list-documents.md
index f97d878..b5511d6 100644
--- a/docs/examples/kotlin/databases/list-documents.md
+++ b/docs/examples/kotlin/databases/list-documents.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Databases
val client = Client(context)
@@ -10,4 +11,4 @@ val databases = Databases(client)
val response = databases.listDocuments(
databaseId = "[DATABASE_ID]",
collectionId = "[COLLECTION_ID]",
-)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/databases/update-document.md b/docs/examples/kotlin/databases/update-document.md
index 3820b89..e2d989e 100644
--- a/docs/examples/kotlin/databases/update-document.md
+++ b/docs/examples/kotlin/databases/update-document.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Databases
val client = Client(context)
@@ -11,4 +12,4 @@ val response = databases.updateDocument(
databaseId = "[DATABASE_ID]",
collectionId = "[COLLECTION_ID]",
documentId = "[DOCUMENT_ID]",
-)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/functions/create-execution.md b/docs/examples/kotlin/functions/create-execution.md
index 77d4587..96dad59 100644
--- a/docs/examples/kotlin/functions/create-execution.md
+++ b/docs/examples/kotlin/functions/create-execution.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Functions
val client = Client(context)
@@ -9,4 +10,4 @@ val functions = Functions(client)
val response = functions.createExecution(
functionId = "[FUNCTION_ID]",
-)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/functions/get-execution.md b/docs/examples/kotlin/functions/get-execution.md
index b576686..e366f4b 100644
--- a/docs/examples/kotlin/functions/get-execution.md
+++ b/docs/examples/kotlin/functions/get-execution.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Functions
val client = Client(context)
@@ -9,5 +10,5 @@ val functions = Functions(client)
val response = functions.getExecution(
functionId = "[FUNCTION_ID]",
- executionId = "[EXECUTION_ID]"
-)
+ executionId = "[EXECUTION_ID]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/functions/list-executions.md b/docs/examples/kotlin/functions/list-executions.md
index 14b613f..ba2ff2d 100644
--- a/docs/examples/kotlin/functions/list-executions.md
+++ b/docs/examples/kotlin/functions/list-executions.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Functions
val client = Client(context)
@@ -9,4 +10,4 @@ val functions = Functions(client)
val response = functions.listExecutions(
functionId = "[FUNCTION_ID]",
-)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/graphql/mutation.md b/docs/examples/kotlin/graphql/mutation.md
index dc37a3e..eee3f82 100644
--- a/docs/examples/kotlin/graphql/mutation.md
+++ b/docs/examples/kotlin/graphql/mutation.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Graphql
val client = Client(context)
@@ -8,5 +9,5 @@ val client = Client(context)
val graphql = Graphql(client)
val response = graphql.mutation(
- query = mapOf( "a" to "b" )
-)
+ query = mapOf( "a" to "b" ),
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/graphql/query.md b/docs/examples/kotlin/graphql/query.md
index d821070..1337d36 100644
--- a/docs/examples/kotlin/graphql/query.md
+++ b/docs/examples/kotlin/graphql/query.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Graphql
val client = Client(context)
@@ -8,5 +9,5 @@ val client = Client(context)
val graphql = Graphql(client)
val response = graphql.query(
- query = mapOf( "a" to "b" )
-)
+ query = mapOf( "a" to "b" ),
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/locale/get.md b/docs/examples/kotlin/locale/get.md
index a2044c7..ec7f625 100644
--- a/docs/examples/kotlin/locale/get.md
+++ b/docs/examples/kotlin/locale/get.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Locale
val client = Client(context)
diff --git a/docs/examples/kotlin/locale/list-codes.md b/docs/examples/kotlin/locale/list-codes.md
index b4e949b..e81e106 100644
--- a/docs/examples/kotlin/locale/list-codes.md
+++ b/docs/examples/kotlin/locale/list-codes.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Locale
val client = Client(context)
diff --git a/docs/examples/kotlin/locale/list-continents.md b/docs/examples/kotlin/locale/list-continents.md
index 610747e..0255e65 100644
--- a/docs/examples/kotlin/locale/list-continents.md
+++ b/docs/examples/kotlin/locale/list-continents.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Locale
val client = Client(context)
diff --git a/docs/examples/kotlin/locale/list-countries-e-u.md b/docs/examples/kotlin/locale/list-countries-e-u.md
index fa5483f..4cf60d9 100644
--- a/docs/examples/kotlin/locale/list-countries-e-u.md
+++ b/docs/examples/kotlin/locale/list-countries-e-u.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Locale
val client = Client(context)
diff --git a/docs/examples/kotlin/locale/list-countries-phones.md b/docs/examples/kotlin/locale/list-countries-phones.md
index 6aba463..1f8f75b 100644
--- a/docs/examples/kotlin/locale/list-countries-phones.md
+++ b/docs/examples/kotlin/locale/list-countries-phones.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Locale
val client = Client(context)
diff --git a/docs/examples/kotlin/locale/list-countries.md b/docs/examples/kotlin/locale/list-countries.md
index c58456b..f221fc6 100644
--- a/docs/examples/kotlin/locale/list-countries.md
+++ b/docs/examples/kotlin/locale/list-countries.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Locale
val client = Client(context)
diff --git a/docs/examples/kotlin/locale/list-currencies.md b/docs/examples/kotlin/locale/list-currencies.md
index 2cf0644..6e5ab0d 100644
--- a/docs/examples/kotlin/locale/list-currencies.md
+++ b/docs/examples/kotlin/locale/list-currencies.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Locale
val client = Client(context)
diff --git a/docs/examples/kotlin/locale/list-languages.md b/docs/examples/kotlin/locale/list-languages.md
index afc00b1..97a9eb7 100644
--- a/docs/examples/kotlin/locale/list-languages.md
+++ b/docs/examples/kotlin/locale/list-languages.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Locale
val client = Client(context)
diff --git a/docs/examples/kotlin/messaging/create-subscriber.md b/docs/examples/kotlin/messaging/create-subscriber.md
new file mode 100644
index 0000000..1da3ed3
--- /dev/null
+++ b/docs/examples/kotlin/messaging/create-subscriber.md
@@ -0,0 +1,15 @@
+import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
+import io.appwrite.services.Messaging
+
+val client = Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+
+val messaging = Messaging(client)
+
+val response = messaging.createSubscriber(
+ topicId = "[TOPIC_ID]",
+ subscriberId = "[SUBSCRIBER_ID]",
+ targetId = "[TARGET_ID]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/messaging/delete-subscriber.md b/docs/examples/kotlin/messaging/delete-subscriber.md
new file mode 100644
index 0000000..0096de3
--- /dev/null
+++ b/docs/examples/kotlin/messaging/delete-subscriber.md
@@ -0,0 +1,14 @@
+import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
+import io.appwrite.services.Messaging
+
+val client = Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+
+val messaging = Messaging(client)
+
+val response = messaging.deleteSubscriber(
+ topicId = "[TOPIC_ID]",
+ subscriberId = "[SUBSCRIBER_ID]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/storage/create-file.md b/docs/examples/kotlin/storage/create-file.md
index 7bb79ac..19eae0f 100644
--- a/docs/examples/kotlin/storage/create-file.md
+++ b/docs/examples/kotlin/storage/create-file.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.models.InputFile
import io.appwrite.services.Storage
@@ -12,4 +13,4 @@ val response = storage.createFile(
bucketId = "[BUCKET_ID]",
fileId = "[FILE_ID]",
file = InputFile.fromPath("file.png"),
-)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/storage/delete-file.md b/docs/examples/kotlin/storage/delete-file.md
index 9430d7e..c64e8dc 100644
--- a/docs/examples/kotlin/storage/delete-file.md
+++ b/docs/examples/kotlin/storage/delete-file.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Storage
val client = Client(context)
@@ -9,5 +10,5 @@ val storage = Storage(client)
val response = storage.deleteFile(
bucketId = "[BUCKET_ID]",
- fileId = "[FILE_ID]"
-)
+ fileId = "[FILE_ID]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/storage/get-file-download.md b/docs/examples/kotlin/storage/get-file-download.md
index 85bd22c..07ebcc0 100644
--- a/docs/examples/kotlin/storage/get-file-download.md
+++ b/docs/examples/kotlin/storage/get-file-download.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Storage
val client = Client(context)
@@ -7,7 +8,7 @@ val client = Client(context)
val storage = Storage(client)
-val result = storage.getFileDownload(
+val result =storage.getFileDownload(
bucketId = "[BUCKET_ID]",
- fileId = "[FILE_ID]"
-)
+ fileId = "[FILE_ID]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/storage/get-file-preview.md b/docs/examples/kotlin/storage/get-file-preview.md
index c5bbdef..b5995ae 100644
--- a/docs/examples/kotlin/storage/get-file-preview.md
+++ b/docs/examples/kotlin/storage/get-file-preview.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Storage
val client = Client(context)
@@ -7,7 +8,7 @@ val client = Client(context)
val storage = Storage(client)
-val result = storage.getFilePreview(
+val result =storage.getFilePreview(
bucketId = "[BUCKET_ID]",
fileId = "[FILE_ID]",
-)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/storage/get-file-view.md b/docs/examples/kotlin/storage/get-file-view.md
index 7e7589c..82b55c2 100644
--- a/docs/examples/kotlin/storage/get-file-view.md
+++ b/docs/examples/kotlin/storage/get-file-view.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Storage
val client = Client(context)
@@ -7,7 +8,7 @@ val client = Client(context)
val storage = Storage(client)
-val result = storage.getFileView(
+val result =storage.getFileView(
bucketId = "[BUCKET_ID]",
- fileId = "[FILE_ID]"
-)
+ fileId = "[FILE_ID]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/storage/get-file.md b/docs/examples/kotlin/storage/get-file.md
index 8fb6e24..9c1abd4 100644
--- a/docs/examples/kotlin/storage/get-file.md
+++ b/docs/examples/kotlin/storage/get-file.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Storage
val client = Client(context)
@@ -9,5 +10,5 @@ val storage = Storage(client)
val response = storage.getFile(
bucketId = "[BUCKET_ID]",
- fileId = "[FILE_ID]"
-)
+ fileId = "[FILE_ID]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/storage/list-files.md b/docs/examples/kotlin/storage/list-files.md
index 191a3cc..575a8b9 100644
--- a/docs/examples/kotlin/storage/list-files.md
+++ b/docs/examples/kotlin/storage/list-files.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Storage
val client = Client(context)
@@ -9,4 +10,4 @@ val storage = Storage(client)
val response = storage.listFiles(
bucketId = "[BUCKET_ID]",
-)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/storage/update-file.md b/docs/examples/kotlin/storage/update-file.md
index 005270f..75585fa 100644
--- a/docs/examples/kotlin/storage/update-file.md
+++ b/docs/examples/kotlin/storage/update-file.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Storage
val client = Client(context)
@@ -10,4 +11,4 @@ val storage = Storage(client)
val response = storage.updateFile(
bucketId = "[BUCKET_ID]",
fileId = "[FILE_ID]",
-)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/create-membership.md b/docs/examples/kotlin/teams/create-membership.md
index 4d1de49..231a991 100644
--- a/docs/examples/kotlin/teams/create-membership.md
+++ b/docs/examples/kotlin/teams/create-membership.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Teams
val client = Client(context)
@@ -10,4 +11,4 @@ val teams = Teams(client)
val response = teams.createMembership(
teamId = "[TEAM_ID]",
roles = listOf(),
-)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/create.md b/docs/examples/kotlin/teams/create.md
index 5e70bd8..dd1125c 100644
--- a/docs/examples/kotlin/teams/create.md
+++ b/docs/examples/kotlin/teams/create.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Teams
val client = Client(context)
@@ -10,4 +11,4 @@ val teams = Teams(client)
val response = teams.create(
teamId = "[TEAM_ID]",
name = "[NAME]",
-)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/delete-membership.md b/docs/examples/kotlin/teams/delete-membership.md
index 04ef5d3..3f165a7 100644
--- a/docs/examples/kotlin/teams/delete-membership.md
+++ b/docs/examples/kotlin/teams/delete-membership.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Teams
val client = Client(context)
@@ -9,5 +10,5 @@ val teams = Teams(client)
val response = teams.deleteMembership(
teamId = "[TEAM_ID]",
- membershipId = "[MEMBERSHIP_ID]"
-)
+ membershipId = "[MEMBERSHIP_ID]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/delete.md b/docs/examples/kotlin/teams/delete.md
index 7d58960..756e91f 100644
--- a/docs/examples/kotlin/teams/delete.md
+++ b/docs/examples/kotlin/teams/delete.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Teams
val client = Client(context)
@@ -8,5 +9,5 @@ val client = Client(context)
val teams = Teams(client)
val response = teams.delete(
- teamId = "[TEAM_ID]"
-)
+ teamId = "[TEAM_ID]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/get-membership.md b/docs/examples/kotlin/teams/get-membership.md
index 653bd52..7c5d286 100644
--- a/docs/examples/kotlin/teams/get-membership.md
+++ b/docs/examples/kotlin/teams/get-membership.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Teams
val client = Client(context)
@@ -9,5 +10,5 @@ val teams = Teams(client)
val response = teams.getMembership(
teamId = "[TEAM_ID]",
- membershipId = "[MEMBERSHIP_ID]"
-)
+ membershipId = "[MEMBERSHIP_ID]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/get-prefs.md b/docs/examples/kotlin/teams/get-prefs.md
index bfd8f75..2953dcf 100644
--- a/docs/examples/kotlin/teams/get-prefs.md
+++ b/docs/examples/kotlin/teams/get-prefs.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Teams
val client = Client(context)
@@ -8,5 +9,5 @@ val client = Client(context)
val teams = Teams(client)
val response = teams.getPrefs(
- teamId = "[TEAM_ID]"
-)
+ teamId = "[TEAM_ID]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/get.md b/docs/examples/kotlin/teams/get.md
index 72aea07..63cdd05 100644
--- a/docs/examples/kotlin/teams/get.md
+++ b/docs/examples/kotlin/teams/get.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Teams
val client = Client(context)
@@ -8,5 +9,5 @@ val client = Client(context)
val teams = Teams(client)
val response = teams.get(
- teamId = "[TEAM_ID]"
-)
+ teamId = "[TEAM_ID]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/list-memberships.md b/docs/examples/kotlin/teams/list-memberships.md
index 53bd6f3..c82fa52 100644
--- a/docs/examples/kotlin/teams/list-memberships.md
+++ b/docs/examples/kotlin/teams/list-memberships.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Teams
val client = Client(context)
@@ -9,4 +10,4 @@ val teams = Teams(client)
val response = teams.listMemberships(
teamId = "[TEAM_ID]",
-)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/list.md b/docs/examples/kotlin/teams/list.md
index 57c5fe8..f0f4af2 100644
--- a/docs/examples/kotlin/teams/list.md
+++ b/docs/examples/kotlin/teams/list.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Teams
val client = Client(context)
@@ -8,4 +9,4 @@ val client = Client(context)
val teams = Teams(client)
val response = teams.list(
-)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/update-membership-status.md b/docs/examples/kotlin/teams/update-membership-status.md
index 33de006..50f04a2 100644
--- a/docs/examples/kotlin/teams/update-membership-status.md
+++ b/docs/examples/kotlin/teams/update-membership-status.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Teams
val client = Client(context)
@@ -11,5 +12,5 @@ val response = teams.updateMembershipStatus(
teamId = "[TEAM_ID]",
membershipId = "[MEMBERSHIP_ID]",
userId = "[USER_ID]",
- secret = "[SECRET]"
-)
+ secret = "[SECRET]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/update-membership.md b/docs/examples/kotlin/teams/update-membership.md
index 40005ed..9990cc4 100644
--- a/docs/examples/kotlin/teams/update-membership.md
+++ b/docs/examples/kotlin/teams/update-membership.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Teams
val client = Client(context)
@@ -10,5 +11,5 @@ val teams = Teams(client)
val response = teams.updateMembership(
teamId = "[TEAM_ID]",
membershipId = "[MEMBERSHIP_ID]",
- roles = listOf()
-)
+ roles = listOf(),
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/update-name.md b/docs/examples/kotlin/teams/update-name.md
index 59c6812..1332fe1 100644
--- a/docs/examples/kotlin/teams/update-name.md
+++ b/docs/examples/kotlin/teams/update-name.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Teams
val client = Client(context)
@@ -9,5 +10,5 @@ val teams = Teams(client)
val response = teams.updateName(
teamId = "[TEAM_ID]",
- name = "[NAME]"
-)
+ name = "[NAME]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/update-prefs.md b/docs/examples/kotlin/teams/update-prefs.md
index 6a89ac7..5f77c6c 100644
--- a/docs/examples/kotlin/teams/update-prefs.md
+++ b/docs/examples/kotlin/teams/update-prefs.md
@@ -1,4 +1,5 @@
import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Teams
val client = Client(context)
@@ -9,5 +10,5 @@ val teams = Teams(client)
val response = teams.updatePrefs(
teamId = "[TEAM_ID]",
- prefs = mapOf( "a" to "b" )
-)
+ prefs = mapOf( "a" to "b" ),
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/users/delete-authenticator.md b/docs/examples/kotlin/users/delete-authenticator.md
new file mode 100644
index 0000000..9c36173
--- /dev/null
+++ b/docs/examples/kotlin/users/delete-authenticator.md
@@ -0,0 +1,16 @@
+import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
+import io.appwrite.services.Users
+import io.appwrite.enums.AuthenticatorProvider
+
+val client = Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+
+val users = Users(client)
+
+val response = users.deleteAuthenticator(
+ userId = "[USER_ID]",
+ provider = AuthenticatorProvider.TOTP,
+ otp = "[OTP]",
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/users/list-providers.md b/docs/examples/kotlin/users/list-providers.md
new file mode 100644
index 0000000..008cf93
--- /dev/null
+++ b/docs/examples/kotlin/users/list-providers.md
@@ -0,0 +1,13 @@
+import io.appwrite.Client
+import io.appwrite.coroutines.CoroutineCallback
+import io.appwrite.services.Users
+
+val client = Client(context)
+ .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+
+val users = Users(client)
+
+val response = users.listProviders(
+ userId = "[USER_ID]",
+)
\ No newline at end of file
diff --git a/example-java/.gitignore b/example-java/.gitignore
deleted file mode 100644
index 42afabf..0000000
--- a/example-java/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
\ No newline at end of file
diff --git a/example-java/build.gradle b/example-java/build.gradle
deleted file mode 100644
index 774d3ba..0000000
--- a/example-java/build.gradle
+++ /dev/null
@@ -1,39 +0,0 @@
-plugins {
- id 'com.android.application'
-}
-
-android {
- compileSdkVersion 33
-
- defaultConfig {
- applicationId "io.appwrite.example_java"
- minSdkVersion 23
- targetSdkVersion 33
- versionCode 1
- versionName "1.0"
-
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- }
-
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
-}
-
-dependencies {
- implementation project(path: ':library')
-
- implementation 'androidx.appcompat:appcompat:1.6.0'
- implementation 'com.google.android.material:material:1.8.0'
- implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
- testImplementation 'junit:junit:4.13.2'
- androidTestImplementation 'androidx.test.ext:junit:1.1.5'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
-}
\ No newline at end of file
diff --git a/example-java/src/main/AndroidManifest.xml b/example-java/src/main/AndroidManifest.xml
deleted file mode 100644
index 0276c9c..0000000
--- a/example-java/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
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
deleted file mode 100644
index 04f46b3..0000000
--- a/example-java/src/main/java/io/appwrite/example_java/MainActivity.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package io.appwrite.example_java;
-
-import android.os.Bundle;
-import android.util.Log;
-
-import androidx.appcompat.app.AppCompatActivity;
-
-import io.appwrite.Client;
-import io.appwrite.coroutines.CoroutineCallback;
-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://demo.appwrite.io/v1")
- .setProject("6070749e6acd4");
-
- Account account = new Account(client);
-
- 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-java/src/main/res/drawable/ic_launcher_background.xml b/example-java/src/main/res/drawable/ic_launcher_background.xml
deleted file mode 100644
index 07d5da9..0000000
--- a/example-java/src/main/res/drawable/ic_launcher_background.xml
+++ /dev/null
@@ -1,170 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/example-java/src/main/res/drawable/ic_launcher_foreground.xml b/example-java/src/main/res/drawable/ic_launcher_foreground.xml
deleted file mode 100644
index 2b068d1..0000000
--- a/example-java/src/main/res/drawable/ic_launcher_foreground.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/example-java/src/main/res/layout/activity_main.xml b/example-java/src/main/res/layout/activity_main.xml
deleted file mode 100644
index 4fc2444..0000000
--- a/example-java/src/main/res/layout/activity_main.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/example-java/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/example-java/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
deleted file mode 100644
index eca70cf..0000000
--- a/example-java/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/example-java/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/example-java/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
deleted file mode 100644
index eca70cf..0000000
--- a/example-java/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/example-java/src/main/res/values/colors.xml b/example-java/src/main/res/values/colors.xml
deleted file mode 100644
index f8c6127..0000000
--- a/example-java/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
- #FFBB86FC
- #FF6200EE
- #FF3700B3
- #FF03DAC5
- #FF018786
- #FF000000
- #FFFFFFFF
-
\ No newline at end of file
diff --git a/example-java/src/main/res/values/strings.xml b/example-java/src/main/res/values/strings.xml
deleted file mode 100644
index 71e50b3..0000000
--- a/example-java/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- Example Java
-
\ No newline at end of file
diff --git a/example-java/src/main/res/values/themes.xml b/example-java/src/main/res/values/themes.xml
deleted file mode 100644
index dde245d..0000000
--- a/example-java/src/main/res/values/themes.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/example/build.gradle b/example/build.gradle
index 62a34ed..e57d59b 100644
--- a/example/build.gradle
+++ b/example/build.gradle
@@ -1,15 +1,18 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
+ id 'kotlin-kapt'
}
android {
- compileSdkVersion 33
+ namespace "io.appwrite.android"
+
+ compileSdkVersion 34
defaultConfig {
applicationId "io.appwrite.android"
minSdkVersion 21
- targetSdkVersion 33
+ targetSdkVersion 34
versionCode 1
versionName "1.0"
@@ -39,19 +42,19 @@ dependencies {
implementation project(path: ':library')
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
- implementation 'androidx.core:core-ktx:1.9.0'
- implementation 'androidx.appcompat:appcompat:1.6.0'
- implementation 'com.google.android.material:material:1.8.0'
+ implementation 'androidx.core:core-ktx:1.12.0'
+ implementation 'androidx.appcompat:appcompat:1.6.1'
+ implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
- implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
- implementation "androidx.fragment:fragment-ktx:1.5.5"
- implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
- implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
- implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
- implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
- implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
- implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2"
- implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1"
+ implementation 'androidx.navigation:navigation-fragment-ktx:2.7.6'
+ implementation "androidx.fragment:fragment-ktx:1.6.2"
+ implementation 'androidx.navigation:navigation-ui-ktx:2.7.6'
+ implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.7.0'
+ implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0'
+ implementation 'androidx.navigation:navigation-fragment-ktx:2.7.6'
+ implementation 'androidx.navigation:navigation-ui-ktx:2.7.6'
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1"
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1"
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
diff --git a/example/src/main/AndroidManifest.xml b/example/src/main/AndroidManifest.xml
index e3c2421..5c2e7b0 100644
--- a/example/src/main/AndroidManifest.xml
+++ b/example/src/main/AndroidManifest.xml
@@ -3,12 +3,14 @@
package="io.appwrite.android">
+ android:theme="@style/Theme.AppwriteAndroidSDK"
+ android:usesCleartextTraffic="true">
+
@@ -24,6 +26,13 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/example/src/main/java/io/appwrite/android/ui/accounts/AccountsFragment.kt b/example/src/main/java/io/appwrite/android/ui/accounts/AccountsFragment.kt
index a31cced..7e590d5 100644
--- a/example/src/main/java/io/appwrite/android/ui/accounts/AccountsFragment.kt
+++ b/example/src/main/java/io/appwrite/android/ui/accounts/AccountsFragment.kt
@@ -34,34 +34,30 @@ class AccountsFragment : Fragment() {
binding.login.setOnClickListener{
viewModel.onLogin(binding.email.text, binding.password.text)
}
-
binding.signup.setOnClickListener{
viewModel.onSignup(binding.email.text, binding.password.text, binding.name.text)
}
-
binding.getUser.setOnClickListener{
viewModel.getUser()
}
-
binding.oAuth.setOnClickListener{
viewModel.oAuthLogin(activity as ComponentActivity)
}
-
binding.logout.setOnClickListener{
viewModel.logout()
}
- viewModel.error.observe(viewLifecycleOwner, Observer { event ->
- event?.getContentIfNotHandled()?.let { // Only proceed if the event has never been handled
- Toast.makeText(requireContext(), it.message , Toast.LENGTH_SHORT).show()
+ viewModel.error.observe(viewLifecycleOwner) { event ->
+ event?.getContentIfNotHandled()?.let {
+ Toast.makeText(requireContext(), it.message, Toast.LENGTH_SHORT).show()
}
- })
+ }
- viewModel.response.observe(viewLifecycleOwner, Observer { event ->
+ viewModel.response.observe(viewLifecycleOwner) { event ->
event?.getContentIfNotHandled()?.let {
binding.responseTV.setText(it)
}
- })
+ }
return binding.root
}
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 ede86d3..0e558f1 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
@@ -3,8 +3,10 @@ package io.appwrite.android.ui.accounts
import android.text.Editable
import androidx.activity.ComponentActivity
import androidx.lifecycle.*
+import io.appwrite.ID
import io.appwrite.android.utils.Client.client
import io.appwrite.android.utils.Event
+import io.appwrite.enums.OAuthProvider
import io.appwrite.exceptions.AppwriteException
import io.appwrite.extensions.toJson
import io.appwrite.services.Account
@@ -29,7 +31,10 @@ class AccountsViewModel : ViewModel() {
fun onLogin(email: Editable, password: Editable) {
viewModelScope.launch {
try {
- val session = accountService.createEmailSession(email.toString(), password.toString())
+ val session = accountService.createEmailPasswordSession(
+ email.toString(),
+ password.toString()
+ )
_response.postValue(Event(session.toJson()))
} catch (e: AppwriteException) {
_error.postValue(Event(e))
@@ -41,8 +46,12 @@ class AccountsViewModel : ViewModel() {
fun onSignup(email: Editable, password: Editable, name: Editable) {
viewModelScope.launch {
try {
- val user =
- accountService.create(email.toString(), password.toString(), name.toString())
+ val user = accountService.create(
+ ID.unique(),
+ email.toString(),
+ password.toString(),
+ name.toString()
+ )
_response.postValue(Event(user.toJson()))
} catch (e: AppwriteException) {
_error.postValue(Event(e))
@@ -56,7 +65,7 @@ class AccountsViewModel : ViewModel() {
try {
accountService.createOAuth2Session(
activity,
- "facebook",
+ OAuthProvider.FACEBOOK,
"appwrite-callback-6070749e6acd4://demo.appwrite.io/auth/oauth2/success",
"appwrite-callback-6070749e6acd4://demo.appwrite.io/auth/oauth2/failure"
)
diff --git a/example/src/main/java/io/appwrite/android/utils/Client.kt b/example/src/main/java/io/appwrite/android/utils/Client.kt
index 66ce681..027b718 100644
--- a/example/src/main/java/io/appwrite/android/utils/Client.kt
+++ b/example/src/main/java/io/appwrite/android/utils/Client.kt
@@ -8,13 +8,8 @@ object Client {
fun create(context: Context) {
client = Client(context)
- .setEndpoint("https://demo.appwrite.io/v1")
- .setProject("6070749e6acd4")
-
- /* Useful when testing locally */
-// client = Client(context)
-// .setEndpoint("https://192.168.1.35/v1")
-// .setProject("60bdbc911784e")
-// .setSelfSigned(true)
+ .setEndpoint("http://192.168.4.24/v1")
+ .setProject("65a8e2b4632c04b1f5da")
+ .setSelfSigned(true)
}
}
\ No newline at end of file
diff --git a/example/src/main/res/layout/fragment_account.xml b/example/src/main/res/layout/fragment_account.xml
index 2fb34c9..4173be1 100644
--- a/example/src/main/res/layout/fragment_account.xml
+++ b/example/src/main/res/layout/fragment_account.xml
@@ -57,6 +57,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:hint="name"
+ android:text="Tester"
android:inputType="text"
app:layout_constraintStart_toStartOf="@id/password"
app:layout_constraintTop_toBottomOf="@id/password" />
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 85e684f..ebd754f 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Tue Jun 01 15:55:54 IST 2021
distributionBase=GRADLE_USER_HOME
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
diff --git a/library/build.gradle b/library/build.gradle
index baa5b1e..b361708 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -22,11 +22,17 @@ ext {
version PUBLISH_VERSION
android {
- compileSdkVersion(33)
+ namespace PUBLISH_GROUP_ID
+
+ compileSdkVersion(34)
+
+ buildFeatures {
+ buildConfig true
+ }
defaultConfig {
minSdkVersion(21)
- targetSdkVersion(33)
+ targetSdkVersion(34)
versionCode = 1
versionName = "1.0"
buildConfigField "String", "SDK_VERSION", "\"${PUBLISH_VERSION}\""
@@ -43,10 +49,6 @@ android {
)
}
}
- compileOptions {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
- }
kotlinOptions {
jvmTarget = "1.8"
}
@@ -54,27 +56,31 @@ android {
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version")
- api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1")
- api("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1")
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1")
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1")
- api(platform("com.squareup.okhttp3:okhttp-bom:4.10.0"))
+ api(platform("com.squareup.okhttp3:okhttp-bom:4.12.0"))
api("com.squareup.okhttp3:okhttp")
implementation("com.squareup.okhttp3:okhttp-urlconnection")
implementation("com.squareup.okhttp3:logging-interceptor")
- implementation("com.google.code.gson:gson:2.9.0")
+ implementation("com.google.code.gson:gson:2.10.1")
- implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.5.1")
- implementation("androidx.lifecycle:lifecycle-common-java8:2.5.1")
- implementation("androidx.appcompat:appcompat:1.6.0")
- implementation("androidx.fragment:fragment-ktx:1.5.5")
- implementation("androidx.activity:activity-ktx:1.6.1")
- implementation("androidx.browser:browser:1.4.0")
+ api(platform("com.google.firebase:firebase-bom:32.7.0"))
+ api("com.google.firebase:firebase-messaging")
- testImplementation 'junit:junit:4.13.2'
- testImplementation "androidx.test.ext:junit-ktx:1.1.5"
- testImplementation "androidx.test:core-ktx:1.5.0"
- testImplementation "org.robolectric:robolectric:4.5.1"
- testApi("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.1")
+ implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
+ implementation("androidx.lifecycle:lifecycle-common-java8:2.7.0")
+ implementation("androidx.appcompat:appcompat:1.6.1")
+ implementation("androidx.fragment:fragment-ktx:1.6.2")
+ implementation("androidx.activity:activity-ktx:1.8.2")
+ implementation("androidx.browser:browser:1.7.0")
+ implementation("androidx.core:core-ktx:1.12.0")
+
+ testImplementation("junit:junit:4.13.2")
+ testImplementation("androidx.test.ext:junit-ktx:1.1.5")
+ testImplementation("androidx.test:core-ktx:1.5.0")
+ testImplementation("org.robolectric:robolectric:4.5.1")
+ testApi("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.1")
}
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
\ No newline at end of file
diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml
index b0ab63a..899321d 100644
--- a/library/src/main/AndroidManifest.xml
+++ b/library/src/main/AndroidManifest.xml
@@ -1,8 +1,7 @@
-
+
-
+
+
\ 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 94f82b6..eeda5ce 100644
--- a/library/src/main/java/io/appwrite/Client.kt
+++ b/library/src/main/java/io/appwrite/Client.kt
@@ -1,13 +1,13 @@
package io.appwrite
import android.content.Context
+import android.content.Intent
import android.content.pm.PackageManager
import com.google.gson.GsonBuilder
import com.google.gson.reflect.TypeToken
-import io.appwrite.appwrite.BuildConfig
+import io.appwrite.cookies.ListenableCookieJar
import io.appwrite.cookies.stores.SharedPreferencesCookieStore
import io.appwrite.exceptions.AppwriteException
-import io.appwrite.extensions.fromJson
import io.appwrite.json.PreciseNumberAdapter
import io.appwrite.models.InputFile
import io.appwrite.models.UploadProgress
@@ -30,7 +30,6 @@ import java.net.CookieManager
import java.net.CookiePolicy
import java.security.SecureRandom
import java.security.cert.X509Certificate
-import javax.net.ssl.HostnameVerifier
import javax.net.ssl.SSLContext
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.TrustManager
@@ -40,13 +39,15 @@ import kotlin.coroutines.resume
class Client @JvmOverloads constructor(
context: Context,
- var endPoint: String = "https://HOSTNAME/v1",
- var endPointRealtime: String? = null,
+ var endpoint: String = "https://HOSTNAME/v1",
+ var endpointRealtime: String? = null,
private var selfSigned: Boolean = false
) : CoroutineScope {
companion object {
- const val CHUNK_SIZE = 5*1024*1024; // 5MB
+ internal const val CHUNK_SIZE = 5*1024*1024; // 5MB
+ internal const val GLOBAL_PREFS = "io.appwrite"
+ internal const val COOKIE_PREFS = "myCookie"
}
override val coroutineContext: CoroutineContext
@@ -59,16 +60,16 @@ class Client @JvmOverloads constructor(
PreciseNumberAdapter()
).create()
- lateinit var http: OkHttpClient
+ internal lateinit var http: OkHttpClient
- private val headers: MutableMap
+ internal val headers: MutableMap
val config: MutableMap
- private val cookieJar = CookieManager(
- SharedPreferencesCookieStore(context, "myCookie"),
+ internal val cookieJar = ListenableCookieJar(CookieManager(
+ SharedPreferencesCookieStore(context.getSharedPreferences(COOKIE_PREFS, Context.MODE_PRIVATE)),
CookiePolicy.ACCEPT_ALL
- )
+ ))
private val appVersion by lazy {
try {
@@ -88,12 +89,18 @@ class Client @JvmOverloads constructor(
"x-sdk-name" to "Android",
"x-sdk-platform" to "client",
"x-sdk-language" to "android",
- "x-sdk-version" to "4.0.1",
+ "x-sdk-version" to "5.0.0-rc.1",
"x-appwrite-response-format" to "1.4.0"
)
config = mutableMapOf()
setSelfSigned(selfSigned)
+
+ NotificationHandler.client = this
+
+ context.startService(Intent(context, NotificationHandler::class.java).apply {
+ action = NotificationHandler.ACTION_CLIENT_INIT
+ })
}
/**
@@ -139,6 +146,21 @@ class Client @JvmOverloads constructor(
return this
}
+ /**
+ * Set Session
+ *
+ * The user session to authenticate with
+ *
+ * @param {string} session
+ *
+ * @return this
+ */
+ fun setSession(value: String): Client {
+ config["session"] = value
+ addHeader("x-appwrite-session", value)
+ return this
+ }
+
/**
* Set self Signed
*
@@ -151,7 +173,7 @@ class Client @JvmOverloads constructor(
val builder = OkHttpClient()
.newBuilder()
- .cookieJar(JavaNetCookieJar(cookieJar))
+ .cookieJar(cookieJar)
if (!selfSigned) {
http = builder.build()
@@ -181,7 +203,7 @@ class Client @JvmOverloads constructor(
// Create an ssl socket factory with our all-trusting manager
val sslSocketFactory: SSLSocketFactory = sslContext.socketFactory
builder.sslSocketFactory(sslSocketFactory, trustAllCerts[0] as X509TrustManager)
- builder.hostnameVerifier(HostnameVerifier { _, _ -> true })
+ builder.hostnameVerifier { _, _ -> true }
http = builder.build()
} catch (e: Exception) {
@@ -198,11 +220,11 @@ class Client @JvmOverloads constructor(
*
* @return this
*/
- fun setEndpoint(endPoint: String): Client {
- this.endPoint = endPoint
+ fun setEndpoint(endpoint: String): Client {
+ this.endpoint = endpoint
- if (this.endPointRealtime == null && endPoint.startsWith("http")) {
- this.endPointRealtime = endPoint.replaceFirst("http", "ws")
+ if (this.endpointRealtime == null && endpoint.startsWith("http")) {
+ this.endpointRealtime = endpoint.replaceFirst("http", "ws")
}
return this
@@ -215,8 +237,20 @@ class Client @JvmOverloads constructor(
*
* @return this
*/
- fun setEndpointRealtime(endPoint: String): Client {
- this.endPointRealtime = endPoint
+ fun setEndpointRealtime(endpoint: String): Client {
+ this.endpointRealtime = endpoint
+ return this
+ }
+
+ /**
+ * Set push provider ID
+ *
+ * @param endpoint
+ *
+ * @return this
+ */
+ fun setPushProviderId(providerId: String): Client {
+ NotificationHandler.providerId = providerId
return this
}
@@ -258,7 +292,7 @@ class Client @JvmOverloads constructor(
.addAll(headers.toHeaders())
.build()
- val httpBuilder = (endPoint + path).toHttpUrl().newBuilder()
+ val httpBuilder = (endpoint + path).toHttpUrl().newBuilder()
if ("GET" == method) {
filteredParams.forEach {
@@ -436,14 +470,14 @@ class Client @JvmOverloads constructor(
)
offset += CHUNK_SIZE
- headers["x-appwrite-id"] = result!!["\$id"].toString()
+ headers["x-appwrite-id"] = result["\$id"].toString()
onProgress?.invoke(
UploadProgress(
- id = result!!["\$id"].toString(),
+ id = result["\$id"].toString(),
progress = offset.coerceAtMost(size).toDouble() / size * 100,
sizeUploaded = offset.coerceAtMost(size),
- chunksTotal = result!!["chunksTotal"].toString().toInt(),
- chunksUploaded = result!!["chunksUploaded"].toString().toInt(),
+ chunksTotal = result["chunksTotal"].toString().toInt(),
+ chunksUploaded = result["chunksUploaded"].toString().toInt(),
)
)
}
diff --git a/library/src/main/java/io/appwrite/NotificationHandler.kt b/library/src/main/java/io/appwrite/NotificationHandler.kt
new file mode 100644
index 0000000..db007b8
--- /dev/null
+++ b/library/src/main/java/io/appwrite/NotificationHandler.kt
@@ -0,0 +1,410 @@
+package io.appwrite
+
+import android.Manifest
+import android.app.NotificationChannel
+import android.app.NotificationManager
+import android.app.PendingIntent
+import android.content.Context
+import android.content.Intent
+import android.content.SharedPreferences
+import android.content.pm.PackageManager
+import android.os.Build
+import android.util.Log
+import androidx.annotation.RequiresApi
+import androidx.core.app.NotificationCompat
+import com.google.android.gms.tasks.OnCompleteListener
+import com.google.firebase.messaging.FirebaseMessaging
+import com.google.firebase.messaging.FirebaseMessagingService
+import com.google.firebase.messaging.RemoteMessage
+import io.appwrite.cookies.CookieListener
+import io.appwrite.exceptions.AppwriteException
+import io.appwrite.extensions.fromJson
+import io.appwrite.extensions.onNotificationReceived
+import io.appwrite.extensions.toJson
+import io.appwrite.models.Notification
+import io.appwrite.models.Target
+import io.appwrite.models.User
+import io.appwrite.services.Account
+import kotlinx.coroutines.runBlocking
+import kotlinx.coroutines.suspendCancellableCoroutine
+import kotlinx.coroutines.sync.Mutex
+import kotlinx.coroutines.sync.withLock
+import okhttp3.Cookie
+import okhttp3.Headers
+import okhttp3.MediaType.Companion.toMediaType
+import okhttp3.OkHttpClient
+import okhttp3.Request
+import okhttp3.RequestBody
+import okhttp3.RequestBody.Companion.toRequestBody
+import okhttp3.internal.cookieToString
+import java.io.IOException
+import kotlin.properties.Delegates
+
+class NotificationHandler : FirebaseMessagingService() {
+
+ companion object {
+ internal const val ACTION_CLIENT_INIT = "io.appwrite.ACTION_CLIENT_INIT"
+ internal const val LISTENER_KEY = "io.appwrite.NotificationHandler"
+
+ internal val httpClient = OkHttpClient()
+
+ internal var client: Client? = null
+ internal var account: Account? = null
+ internal var providerId: String? = null
+
+ internal var cookieListener: CookieListener? = null
+
+ /**
+ * Should notifications be automatically displayed if the app is in the foreground
+ */
+ var displayForeground = true
+
+ /**
+ * The icon to display in the notification
+ */
+ var displayIcon by Delegates.notNull()
+
+ /**
+ * Should the notification be automatically canceled when the user clicks on it
+ */
+ var autoCancel = false
+
+ /**
+ * The intent to fire when the user clicks on the notification
+ */
+ var contentIntent: PendingIntent? = null
+
+ /**
+ * The channel id to use for the notification
+ */
+ @RequiresApi(Build.VERSION_CODES.N)
+ var channelId = "io.appwrite.notifications"
+
+ /**
+ * The channel name to use for the notification
+ */
+ @RequiresApi(Build.VERSION_CODES.N)
+ var channelName = "All Notifications"
+
+ /**
+ * The channel description to use for the notification
+ */
+ @RequiresApi(Build.VERSION_CODES.N)
+ var channelDescription = "All notifications"
+
+ /**
+ * The channel importance to use for the notification
+ */
+ @RequiresApi(Build.VERSION_CODES.N)
+ var channelImportance = NotificationManager.IMPORTANCE_DEFAULT
+ }
+
+ private lateinit var mutex: Mutex
+
+ private lateinit var globalPrefs: SharedPreferences
+
+ private var existingCookies: List = listOf()
+ private var newCookies: List = listOf()
+
+ override fun getStartCommandIntent(originalIntent: Intent?): Intent {
+ if (originalIntent?.action == ACTION_CLIENT_INIT) {
+ return originalIntent
+ }
+
+ return super.getStartCommandIntent(originalIntent)
+ }
+
+ override fun handleIntent(intent: Intent?) {
+ if (intent?.action == ACTION_CLIENT_INIT) {
+ onClientInit()
+ return
+ }
+
+ super.handleIntent(intent)
+ }
+
+ override fun onCreate() {
+ super.onCreate()
+
+ globalPrefs = applicationContext.getSharedPreferences(
+ Client.GLOBAL_PREFS, Context.MODE_PRIVATE
+ )
+
+ displayIcon = resources.getIdentifier(
+ "ic_launcher_foreground", "drawable", packageName
+ )
+
+ mutex = Mutex()
+
+ if (cookieListener == null) {
+ cookieListener = { existing, new ->
+ FirebaseMessaging.getInstance().token.addOnCompleteListener(OnCompleteListener { task ->
+ if (!task.isSuccessful) {
+ Log.w(javaClass.name, "Fetching FCM registration token failed", task.exception)
+ return@OnCompleteListener
+ }
+
+ val token = task.result
+ if (token.isNullOrEmpty()) {
+ return@OnCompleteListener
+ }
+
+ existingCookies = existing
+ newCookies = new
+
+ onNewToken(token)
+ })
+ }
+ }
+
+ if (client != null) {
+ client?.cookieJar?.onSave(LISTENER_KEY, cookieListener!!)
+ }
+ }
+
+ override fun onNewToken(token: String) {
+ runBlocking {
+ mutex.withLock {
+ pushToken(token)
+ }
+ }
+ }
+
+ override fun onMessageReceived(message: RemoteMessage) {
+ super.onMessageReceived(message)
+
+ // Fire callbacks before display so handler can be configured if needed
+ onNotificationReceived(
+ Notification(
+ title = message.notification?.title ?: "",
+ body = message.notification?.body ?: "",
+ clickAction = message.notification?.clickAction ?: "",
+ color = message.notification?.color ?: "",
+ icon = message.notification?.icon ?: "",
+ imageURL = message.notification?.imageUrl?.toString() ?: "",
+ sound = message.notification?.sound ?: "",
+ data = message.data
+ )
+ )
+
+ val notificationManager =
+ getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ val channel = NotificationChannel(
+ channelId, channelName, channelImportance
+ ).apply {
+ description = channelDescription
+ }
+
+ // Recreate is a no-op if the channel already exists
+ notificationManager.createNotificationChannel(channel)
+ }
+
+ if (message.notification != null && displayForeground) {
+ val builder = NotificationCompat.Builder(this, "io.appwrite.notifications")
+ .setContentTitle(message.notification?.title)
+ .setContentText(message.notification?.body)
+ .setPriority(NotificationCompat.PRIORITY_DEFAULT).setAutoCancel(autoCancel)
+ .setContentIntent(contentIntent)
+
+ if (displayIcon != 0) {
+ builder.setSmallIcon(displayIcon)
+ }
+
+ val notification = builder.build()
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ val hasPermission = packageManager.checkPermission(
+ Manifest.permission.POST_NOTIFICATIONS,
+ packageName
+ ) == PackageManager.PERMISSION_GRANTED
+
+ if (!hasPermission) {
+ Log.w(javaClass.name, "Permission denied, make sure you have requested the POST_NOTIFICATIONS permission")
+ }
+ }
+
+ notificationManager.notify(message.hashCode(), notification)
+ }
+ }
+
+ private fun onClientInit() {
+ if (client == null) {
+ return
+ }
+
+ if (account == null) {
+ account = Account(client!!)
+ }
+
+ client?.cookieJar?.onSave(LISTENER_KEY, cookieListener!!)
+ }
+
+ private suspend fun pushToken(token: String) {
+ if (client == null) {
+ return
+ }
+
+ val currentToken = globalPrefs.getString("fcmToken", "") ?: ""
+ var currentTargetId = globalPrefs.getString("targetId", "") ?: ""
+ val existingUser: User