diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index ffe898b..7145ba6 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -16,7 +16,6 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 17
- # Base64 decodes and pipes the GPG key content into the secret file
- name: Prepare environment
env:
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }}
diff --git a/README.md b/README.md
index 61632fd..c8363ac 100644
--- a/README.md
+++ b/README.md
@@ -38,7 +38,7 @@ repositories {
Next, add the dependency to your project's `build.gradle(.kts)` file:
```groovy
-implementation("io.appwrite:sdk-for-android:5.0.0-rc.4")
+implementation("io.appwrite:sdk-for-android:5.0.0-rc.5")
```
### Maven
@@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file:
io.appwrite
sdk-for-android
- 5.0.0-rc.4
+ 5.0.0-rc.5
```
@@ -109,8 +109,9 @@ When trying to connect to Appwrite from an emulator or a mobile device, localhos
val account = Account(client)
val response = account.create(
ID.unique(),
- "email@example.com",
- "password"
+ "email@example.com",
+ "password",
+ "Walter O'Brien"
)
```
@@ -129,8 +130,9 @@ val client = Client(context)
val account = Account(client)
val user = account.create(
ID.unique(),
- "email@example.com",
- "password"
+ "email@example.com",
+ "password",
+ "Walter O'Brien"
)
```
@@ -139,7 +141,7 @@ The Appwrite Android SDK raises an `AppwriteException` object with `message`, `c
```kotlin
try {
- var user = account.create(ID.unique(), "email@example.com", "password")
+ var user = account.create(ID.unique(),"email@example.com","password","Walter O'Brien")
Log.d("Appwrite user", user.toMap())
} catch(e : AppwriteException) {
e.printStackTrace()
@@ -153,6 +155,7 @@ You can use the following resources to learn more and get help
- 💬 [Discord Community](https://appwrite.io/discord)
- 🚂 [Appwrite Android Playground](https://github.com/appwrite/playground-for-android)
+
## Contribution
This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request.
diff --git a/docs/examples/java/account/create2f-a-challenge.md b/docs/examples/java/account/create-challenge.md
similarity index 95%
rename from docs/examples/java/account/create2f-a-challenge.md
rename to docs/examples/java/account/create-challenge.md
index e095df7..7a31920 100644
--- a/docs/examples/java/account/create2f-a-challenge.md
+++ b/docs/examples/java/account/create-challenge.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Account account = new Account(client);
-account.create2FAChallenge(
+account.createChallenge(
AuthenticationFactor.TOTP, // factor
new CoroutineCallback<>((result, error) -> {
if (error != null) {
diff --git a/docs/examples/java/account/create-email-token.md b/docs/examples/java/account/create-email-token.md
index c308ca7..adf8b3d 100644
--- a/docs/examples/java/account/create-email-token.md
+++ b/docs/examples/java/account/create-email-token.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Account account = new Account(client);
account.createEmailToken(
- "[USER_ID]", // userId
+ "", // userId
"email@example.com", // email
false, // phrase (optional)
new CoroutineCallback<>((result, error) -> {
diff --git a/docs/examples/java/account/create-magic-u-r-l-token.md b/docs/examples/java/account/create-magic-u-r-l-token.md
index c3a3392..21108cc 100644
--- a/docs/examples/java/account/create-magic-u-r-l-token.md
+++ b/docs/examples/java/account/create-magic-u-r-l-token.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Account account = new Account(client);
account.createMagicURLToken(
- "[USER_ID]", // userId
+ "", // userId
"email@example.com", // email
"https://example.com", // url (optional)
false, // phrase (optional)
diff --git a/docs/examples/java/account/create-o-auth2session.md b/docs/examples/java/account/create-o-auth2session.md
index 1e1a3b2..ba284a1 100644
--- a/docs/examples/java/account/create-o-auth2session.md
+++ b/docs/examples/java/account/create-o-auth2session.md
@@ -13,7 +13,6 @@ account.createOAuth2Session(
OAuthProvider.AMAZON, // provider
"https://example.com", // success (optional)
"https://example.com", // failure (optional)
- false, // token (optional)
listOf(), // scopes (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
diff --git a/docs/examples/java/account/create-o-auth2token.md b/docs/examples/java/account/create-o-auth2token.md
new file mode 100644
index 0000000..eb64da1
--- /dev/null
+++ b/docs/examples/java/account/create-o-auth2token.md
@@ -0,0 +1,26 @@
+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
+ .setProject("5df5acd0d48c2"); // Your project ID
+
+Account account = new Account(client);
+
+account.createOAuth2Token(
+ OAuthProvider.AMAZON, // provider
+ "https://example.com", // success (optional)
+ "https://example.com", // failure (optional)
+ listOf(), // scopes (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/account/create-phone-token.md b/docs/examples/java/account/create-phone-token.md
index a47d57b..29ef311 100644
--- a/docs/examples/java/account/create-phone-token.md
+++ b/docs/examples/java/account/create-phone-token.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Account account = new Account(client);
account.createPhoneToken(
- "[USER_ID]", // userId
+ "", // userId
"+12065550100", // phone
new CoroutineCallback<>((result, error) -> {
if (error != null) {
diff --git a/docs/examples/java/account/create-push-target.md b/docs/examples/java/account/create-push-target.md
index 8268bee..7eff453 100644
--- a/docs/examples/java/account/create-push-target.md
+++ b/docs/examples/java/account/create-push-target.md
@@ -9,9 +9,9 @@ Client client = new Client(context)
Account account = new Account(client);
account.createPushTarget(
- "[TARGET_ID]", // targetId
- "[IDENTIFIER]", // identifier
- "[PROVIDER_ID]", // providerId (optional)
+ "", // targetId
+ "", // identifier
+ "", // providerId (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/account/create-session.md b/docs/examples/java/account/create-session.md
index b1805fa..013d372 100644
--- a/docs/examples/java/account/create-session.md
+++ b/docs/examples/java/account/create-session.md
@@ -9,8 +9,8 @@ Client client = new Client(context)
Account account = new Account(client);
account.createSession(
- "[USER_ID]", // userId
- "[SECRET]", // secret
+ "", // userId
+ "", // secret
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/account/create.md b/docs/examples/java/account/create.md
index dce55b7..8ee1de3 100644
--- a/docs/examples/java/account/create.md
+++ b/docs/examples/java/account/create.md
@@ -9,10 +9,10 @@ Client client = new Client(context)
Account account = new Account(client);
account.create(
- "[USER_ID]", // userId
+ "", // userId
"email@example.com", // email
"", // password
- "[NAME]", // name (optional)
+ "", // name (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/account/delete-authenticator.md b/docs/examples/java/account/delete-authenticator.md
index 4525524..c988cfa 100644
--- a/docs/examples/java/account/delete-authenticator.md
+++ b/docs/examples/java/account/delete-authenticator.md
@@ -11,7 +11,7 @@ Account account = new Account(client);
account.deleteAuthenticator(
AuthenticatorType.TOTP, // type
- "[OTP]", // otp
+ "", // otp
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/account/delete-identity.md b/docs/examples/java/account/delete-identity.md
index 5cc7178..1d6922a 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]", // identityId
+ "", // identityId
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/account/delete-push-target.md b/docs/examples/java/account/delete-push-target.md
index f798ea9..484fc2c 100644
--- a/docs/examples/java/account/delete-push-target.md
+++ b/docs/examples/java/account/delete-push-target.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Account account = new Account(client);
account.deletePushTarget(
- "[TARGET_ID]", // targetId
+ "", // targetId
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/account/delete-session.md b/docs/examples/java/account/delete-session.md
index 9d11640..4344061 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]", // sessionId
+ "", // sessionId
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/account/get-session.md b/docs/examples/java/account/get-session.md
index fe01211..470f643 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]", // sessionId
+ "", // sessionId
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/account/update-challenge.md b/docs/examples/java/account/update-challenge.md
index 7e2d369..b2953e3 100644
--- a/docs/examples/java/account/update-challenge.md
+++ b/docs/examples/java/account/update-challenge.md
@@ -9,8 +9,8 @@ Client client = new Client(context)
Account account = new Account(client);
account.updateChallenge(
- "[CHALLENGE_ID]", // challengeId
- "[OTP]", // otp
+ "", // challengeId
+ "", // otp
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/account/update-magic-u-r-l-session.md b/docs/examples/java/account/update-magic-u-r-l-session.md
index 697e00a..339b1f7 100644
--- a/docs/examples/java/account/update-magic-u-r-l-session.md
+++ b/docs/examples/java/account/update-magic-u-r-l-session.md
@@ -9,8 +9,8 @@ Client client = new Client(context)
Account account = new Account(client);
account.updateMagicURLSession(
- "[USER_ID]", // userId
- "[SECRET]", // secret
+ "", // userId
+ "", // secret
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/account/update-name.md b/docs/examples/java/account/update-name.md
index bc64afc..ff23ace 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
+ "", // name
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/account/update-phone-verification.md b/docs/examples/java/account/update-phone-verification.md
index 94c2eb2..304e73e 100644
--- a/docs/examples/java/account/update-phone-verification.md
+++ b/docs/examples/java/account/update-phone-verification.md
@@ -9,8 +9,8 @@ Client client = new Client(context)
Account account = new Account(client);
account.updatePhoneVerification(
- "[USER_ID]", // userId
- "[SECRET]", // secret
+ "", // userId
+ "", // secret
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/account/update-push-target.md b/docs/examples/java/account/update-push-target.md
index 7dd97fd..90dc29e 100644
--- a/docs/examples/java/account/update-push-target.md
+++ b/docs/examples/java/account/update-push-target.md
@@ -9,8 +9,8 @@ Client client = new Client(context)
Account account = new Account(client);
account.updatePushTarget(
- "[TARGET_ID]", // targetId
- "[IDENTIFIER]", // identifier
+ "", // targetId
+ "", // identifier
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/account/update-recovery.md b/docs/examples/java/account/update-recovery.md
index b009e43..527351c 100644
--- a/docs/examples/java/account/update-recovery.md
+++ b/docs/examples/java/account/update-recovery.md
@@ -9,8 +9,8 @@ Client client = new Client(context)
Account account = new Account(client);
account.updateRecovery(
- "[USER_ID]", // userId
- "[SECRET]", // secret
+ "", // userId
+ "", // secret
"", // password
new CoroutineCallback<>((result, error) -> {
if (error != null) {
diff --git a/docs/examples/java/account/update-session.md b/docs/examples/java/account/update-session.md
index aac43e4..e2ef0c3 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]", // sessionId
+ "", // sessionId
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/account/update-verification.md b/docs/examples/java/account/update-verification.md
index f6020ae..3f14196 100644
--- a/docs/examples/java/account/update-verification.md
+++ b/docs/examples/java/account/update-verification.md
@@ -9,8 +9,8 @@ Client client = new Client(context)
Account account = new Account(client);
account.updateVerification(
- "[USER_ID]", // userId
- "[SECRET]", // secret
+ "", // userId
+ "", // secret
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/account/verify-authenticator.md b/docs/examples/java/account/verify-authenticator.md
index 7d5efe4..c73ac43 100644
--- a/docs/examples/java/account/verify-authenticator.md
+++ b/docs/examples/java/account/verify-authenticator.md
@@ -11,7 +11,7 @@ Account account = new Account(client);
account.verifyAuthenticator(
AuthenticatorType.TOTP, // type
- "[OTP]", // otp
+ "", // otp
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/avatars/get-initials.md b/docs/examples/java/avatars/get-initials.md
index d019a16..f6c3ee6 100644
--- a/docs/examples/java/avatars/get-initials.md
+++ b/docs/examples/java/avatars/get-initials.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Avatars avatars = new Avatars(client);
avatars.getInitials(
- "[NAME]", // name (optional)
+ "", // name (optional)
0, // width (optional)
0, // height (optional)
"", // background (optional)
diff --git a/docs/examples/java/avatars/get-q-r.md b/docs/examples/java/avatars/get-q-r.md
index 19fbe7a..d75b3b3 100644
--- a/docs/examples/java/avatars/get-q-r.md
+++ b/docs/examples/java/avatars/get-q-r.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Avatars avatars = new Avatars(client);
avatars.getQR(
- "[TEXT]", // text
+ "", // text
1, // size (optional)
0, // margin (optional)
false, // download (optional)
diff --git a/docs/examples/java/databases/create-document.md b/docs/examples/java/databases/create-document.md
index c409d8e..361d5fe 100644
--- a/docs/examples/java/databases/create-document.md
+++ b/docs/examples/java/databases/create-document.md
@@ -9,9 +9,9 @@ Client client = new Client(context)
Databases databases = new Databases(client);
databases.createDocument(
- "[DATABASE_ID]", // databaseId
- "[COLLECTION_ID]", // collectionId
- "[DOCUMENT_ID]", // documentId
+ "", // databaseId
+ "", // collectionId
+ "", // documentId
mapOf( "a" to "b" ), // data
listOf("read("any")"), // permissions (optional)
new CoroutineCallback<>((result, error) -> {
diff --git a/docs/examples/java/databases/delete-document.md b/docs/examples/java/databases/delete-document.md
index 8ab8f61..26b67a2 100644
--- a/docs/examples/java/databases/delete-document.md
+++ b/docs/examples/java/databases/delete-document.md
@@ -9,9 +9,9 @@ Client client = new Client(context)
Databases databases = new Databases(client);
databases.deleteDocument(
- "[DATABASE_ID]", // databaseId
- "[COLLECTION_ID]", // collectionId
- "[DOCUMENT_ID]", // documentId
+ "", // databaseId
+ "", // collectionId
+ "", // documentId
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/databases/get-document.md b/docs/examples/java/databases/get-document.md
index 4ee0d6d..ac89489 100644
--- a/docs/examples/java/databases/get-document.md
+++ b/docs/examples/java/databases/get-document.md
@@ -9,9 +9,9 @@ Client client = new Client(context)
Databases databases = new Databases(client);
databases.getDocument(
- "[DATABASE_ID]", // databaseId
- "[COLLECTION_ID]", // collectionId
- "[DOCUMENT_ID]", // documentId
+ "", // databaseId
+ "", // collectionId
+ "", // documentId
listOf(), // queries (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
diff --git a/docs/examples/java/databases/list-documents.md b/docs/examples/java/databases/list-documents.md
index 5aaf4f2..9f70425 100644
--- a/docs/examples/java/databases/list-documents.md
+++ b/docs/examples/java/databases/list-documents.md
@@ -9,8 +9,8 @@ Client client = new Client(context)
Databases databases = new Databases(client);
databases.listDocuments(
- "[DATABASE_ID]", // databaseId
- "[COLLECTION_ID]", // collectionId
+ "", // databaseId
+ "", // collectionId
listOf(), // queries (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
diff --git a/docs/examples/java/databases/update-document.md b/docs/examples/java/databases/update-document.md
index ba1b7a8..430a617 100644
--- a/docs/examples/java/databases/update-document.md
+++ b/docs/examples/java/databases/update-document.md
@@ -9,9 +9,9 @@ Client client = new Client(context)
Databases databases = new Databases(client);
databases.updateDocument(
- "[DATABASE_ID]", // databaseId
- "[COLLECTION_ID]", // collectionId
- "[DOCUMENT_ID]", // documentId
+ "", // databaseId
+ "", // collectionId
+ "", // documentId
mapOf( "a" to "b" ), // data (optional)
listOf("read("any")"), // permissions (optional)
new CoroutineCallback<>((result, error) -> {
diff --git a/docs/examples/java/functions/create-execution.md b/docs/examples/java/functions/create-execution.md
index ab1c32c..0db569b 100644
--- a/docs/examples/java/functions/create-execution.md
+++ b/docs/examples/java/functions/create-execution.md
@@ -9,10 +9,10 @@ Client client = new Client(context)
Functions functions = new Functions(client);
functions.createExecution(
- "[FUNCTION_ID]", // functionId
- "[BODY]", // body (optional)
+ "", // functionId
+ "", // body (optional)
false, // async (optional)
- "[PATH]", // path (optional)
+ "", // path (optional)
ExecutionMethod.GET, // method (optional)
mapOf( "a" to "b" ), // headers (optional)
new CoroutineCallback<>((result, error) -> {
diff --git a/docs/examples/java/functions/get-execution.md b/docs/examples/java/functions/get-execution.md
index 5f1a772..66bf263 100644
--- a/docs/examples/java/functions/get-execution.md
+++ b/docs/examples/java/functions/get-execution.md
@@ -9,8 +9,8 @@ Client client = new Client(context)
Functions functions = new Functions(client);
functions.getExecution(
- "[FUNCTION_ID]", // functionId
- "[EXECUTION_ID]", // executionId
+ "", // functionId
+ "", // executionId
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/functions/list-executions.md b/docs/examples/java/functions/list-executions.md
index 1405da6..1bb510a 100644
--- a/docs/examples/java/functions/list-executions.md
+++ b/docs/examples/java/functions/list-executions.md
@@ -9,9 +9,9 @@ Client client = new Client(context)
Functions functions = new Functions(client);
functions.listExecutions(
- "[FUNCTION_ID]", // functionId
+ "", // functionId
listOf(), // queries (optional)
- "[SEARCH]", // search (optional)
+ "", // search (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/messaging/create-subscriber.md b/docs/examples/java/messaging/create-subscriber.md
index f059ae2..e83b43c 100644
--- a/docs/examples/java/messaging/create-subscriber.md
+++ b/docs/examples/java/messaging/create-subscriber.md
@@ -9,9 +9,9 @@ Client client = new Client(context)
Messaging messaging = new Messaging(client);
messaging.createSubscriber(
- "[TOPIC_ID]", // topicId
- "[SUBSCRIBER_ID]", // subscriberId
- "[TARGET_ID]", // targetId
+ "", // topicId
+ "", // subscriberId
+ "", // targetId
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/messaging/delete-subscriber.md b/docs/examples/java/messaging/delete-subscriber.md
index ee2caa3..5e8302b 100644
--- a/docs/examples/java/messaging/delete-subscriber.md
+++ b/docs/examples/java/messaging/delete-subscriber.md
@@ -9,8 +9,8 @@ Client client = new Client(context)
Messaging messaging = new Messaging(client);
messaging.deleteSubscriber(
- "[TOPIC_ID]", // topicId
- "[SUBSCRIBER_ID]", // subscriberId
+ "", // topicId
+ "", // subscriberId
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/storage/create-file.md b/docs/examples/java/storage/create-file.md
index 3c67a7b..a060552 100644
--- a/docs/examples/java/storage/create-file.md
+++ b/docs/examples/java/storage/create-file.md
@@ -10,8 +10,8 @@ Client client = new Client(context)
Storage storage = new Storage(client);
storage.createFile(
- "[BUCKET_ID]", // bucketId
- "[FILE_ID]", // fileId
+ "", // bucketId
+ "", // fileId
InputFile.fromPath("file.png"), // file
listOf("read("any")"), // permissions (optional)
new CoroutineCallback<>((result, error) -> {
diff --git a/docs/examples/java/storage/delete-file.md b/docs/examples/java/storage/delete-file.md
index f216bbf..113dfce 100644
--- a/docs/examples/java/storage/delete-file.md
+++ b/docs/examples/java/storage/delete-file.md
@@ -9,8 +9,8 @@ Client client = new Client(context)
Storage storage = new Storage(client);
storage.deleteFile(
- "[BUCKET_ID]", // bucketId
- "[FILE_ID]", // fileId
+ "", // bucketId
+ "", // fileId
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/storage/get-file-download.md b/docs/examples/java/storage/get-file-download.md
index a46ae8e..22207ca 100644
--- a/docs/examples/java/storage/get-file-download.md
+++ b/docs/examples/java/storage/get-file-download.md
@@ -9,8 +9,8 @@ Client client = new Client(context)
Storage storage = new Storage(client);
storage.getFileDownload(
- "[BUCKET_ID]", // bucketId
- "[FILE_ID]", // fileId
+ "", // bucketId
+ "", // fileId
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/storage/get-file-preview.md b/docs/examples/java/storage/get-file-preview.md
index dfe66a7..df81fb4 100644
--- a/docs/examples/java/storage/get-file-preview.md
+++ b/docs/examples/java/storage/get-file-preview.md
@@ -9,8 +9,8 @@ Client client = new Client(context)
Storage storage = new Storage(client);
storage.getFilePreview(
- "[BUCKET_ID]", // bucketId
- "[FILE_ID]", // fileId
+ "", // bucketId
+ "", // fileId
0, // width (optional)
0, // height (optional)
ImageGravity.CENTER, // gravity (optional)
diff --git a/docs/examples/java/storage/get-file-view.md b/docs/examples/java/storage/get-file-view.md
index 18dd41e..d64c3e6 100644
--- a/docs/examples/java/storage/get-file-view.md
+++ b/docs/examples/java/storage/get-file-view.md
@@ -9,8 +9,8 @@ Client client = new Client(context)
Storage storage = new Storage(client);
storage.getFileView(
- "[BUCKET_ID]", // bucketId
- "[FILE_ID]", // fileId
+ "", // bucketId
+ "", // fileId
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/storage/get-file.md b/docs/examples/java/storage/get-file.md
index 5bc2456..b68bf78 100644
--- a/docs/examples/java/storage/get-file.md
+++ b/docs/examples/java/storage/get-file.md
@@ -9,8 +9,8 @@ Client client = new Client(context)
Storage storage = new Storage(client);
storage.getFile(
- "[BUCKET_ID]", // bucketId
- "[FILE_ID]", // fileId
+ "", // bucketId
+ "", // fileId
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/storage/list-files.md b/docs/examples/java/storage/list-files.md
index 2fdd026..8b84ecb 100644
--- a/docs/examples/java/storage/list-files.md
+++ b/docs/examples/java/storage/list-files.md
@@ -9,9 +9,9 @@ Client client = new Client(context)
Storage storage = new Storage(client);
storage.listFiles(
- "[BUCKET_ID]", // bucketId
+ "", // bucketId
listOf(), // queries (optional)
- "[SEARCH]", // search (optional)
+ "", // search (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/storage/update-file.md b/docs/examples/java/storage/update-file.md
index c445c28..12b6443 100644
--- a/docs/examples/java/storage/update-file.md
+++ b/docs/examples/java/storage/update-file.md
@@ -9,9 +9,9 @@ Client client = new Client(context)
Storage storage = new Storage(client);
storage.updateFile(
- "[BUCKET_ID]", // bucketId
- "[FILE_ID]", // fileId
- "[NAME]", // name (optional)
+ "", // bucketId
+ "", // fileId
+ "", // name (optional)
listOf("read("any")"), // permissions (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
diff --git a/docs/examples/java/teams/create-membership.md b/docs/examples/java/teams/create-membership.md
index 9d8a73a..468571e 100644
--- a/docs/examples/java/teams/create-membership.md
+++ b/docs/examples/java/teams/create-membership.md
@@ -9,13 +9,13 @@ Client client = new Client(context)
Teams teams = new Teams(client);
teams.createMembership(
- "[TEAM_ID]", // teamId
+ "", // teamId
listOf(), // roles
"email@example.com", // email (optional)
- "[USER_ID]", // userId (optional)
+ "", // userId (optional)
"+12065550100", // phone (optional)
"https://example.com", // url (optional)
- "[NAME]", // name (optional)
+ "", // name (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/teams/create.md b/docs/examples/java/teams/create.md
index f637994..3c757ac 100644
--- a/docs/examples/java/teams/create.md
+++ b/docs/examples/java/teams/create.md
@@ -9,8 +9,8 @@ Client client = new Client(context)
Teams teams = new Teams(client);
teams.create(
- "[TEAM_ID]", // teamId
- "[NAME]", // name
+ "", // teamId
+ "", // name
listOf(), // roles (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
diff --git a/docs/examples/java/teams/delete-membership.md b/docs/examples/java/teams/delete-membership.md
index ecf2bdc..e23409f 100644
--- a/docs/examples/java/teams/delete-membership.md
+++ b/docs/examples/java/teams/delete-membership.md
@@ -9,8 +9,8 @@ Client client = new Client(context)
Teams teams = new Teams(client);
teams.deleteMembership(
- "[TEAM_ID]", // teamId
- "[MEMBERSHIP_ID]", // membershipId
+ "", // teamId
+ "", // membershipId
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/teams/delete.md b/docs/examples/java/teams/delete.md
index 62bb284..567ea3d 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]", // teamId
+ "", // teamId
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/teams/get-membership.md b/docs/examples/java/teams/get-membership.md
index 5a0eb03..c09a267 100644
--- a/docs/examples/java/teams/get-membership.md
+++ b/docs/examples/java/teams/get-membership.md
@@ -9,8 +9,8 @@ Client client = new Client(context)
Teams teams = new Teams(client);
teams.getMembership(
- "[TEAM_ID]", // teamId
- "[MEMBERSHIP_ID]", // membershipId
+ "", // teamId
+ "", // membershipId
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/teams/get-prefs.md b/docs/examples/java/teams/get-prefs.md
index 78d01de..48a9815 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]", // teamId
+ "", // teamId
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/teams/get.md b/docs/examples/java/teams/get.md
index 9442b85..20a6f6a 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]", // teamId
+ "", // teamId
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/teams/list-memberships.md b/docs/examples/java/teams/list-memberships.md
index 92934bf..2de609c 100644
--- a/docs/examples/java/teams/list-memberships.md
+++ b/docs/examples/java/teams/list-memberships.md
@@ -9,9 +9,9 @@ Client client = new Client(context)
Teams teams = new Teams(client);
teams.listMemberships(
- "[TEAM_ID]", // teamId
+ "", // teamId
listOf(), // queries (optional)
- "[SEARCH]", // search (optional)
+ "", // search (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/teams/list.md b/docs/examples/java/teams/list.md
index 6eacc8e..7f7910c 100644
--- a/docs/examples/java/teams/list.md
+++ b/docs/examples/java/teams/list.md
@@ -10,7 +10,7 @@ Teams teams = new Teams(client);
teams.list(
listOf(), // queries (optional)
- "[SEARCH]", // search (optional)
+ "", // search (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/teams/update-membership-status.md b/docs/examples/java/teams/update-membership-status.md
index 8a01220..97e8242 100644
--- a/docs/examples/java/teams/update-membership-status.md
+++ b/docs/examples/java/teams/update-membership-status.md
@@ -9,10 +9,10 @@ Client client = new Client(context)
Teams teams = new Teams(client);
teams.updateMembershipStatus(
- "[TEAM_ID]", // teamId
- "[MEMBERSHIP_ID]", // membershipId
- "[USER_ID]", // userId
- "[SECRET]", // secret
+ "", // teamId
+ "", // membershipId
+ "", // userId
+ "", // secret
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/teams/update-membership.md b/docs/examples/java/teams/update-membership.md
index 779479b..86f0ddd 100644
--- a/docs/examples/java/teams/update-membership.md
+++ b/docs/examples/java/teams/update-membership.md
@@ -9,8 +9,8 @@ Client client = new Client(context)
Teams teams = new Teams(client);
teams.updateMembership(
- "[TEAM_ID]", // teamId
- "[MEMBERSHIP_ID]", // membershipId
+ "", // teamId
+ "", // membershipId
listOf(), // roles
new CoroutineCallback<>((result, error) -> {
if (error != null) {
diff --git a/docs/examples/java/teams/update-name.md b/docs/examples/java/teams/update-name.md
index 50960fb..1aa96f8 100644
--- a/docs/examples/java/teams/update-name.md
+++ b/docs/examples/java/teams/update-name.md
@@ -9,8 +9,8 @@ Client client = new Client(context)
Teams teams = new Teams(client);
teams.updateName(
- "[TEAM_ID]", // teamId
- "[NAME]", // name
+ "", // teamId
+ "", // name
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/teams/update-prefs.md b/docs/examples/java/teams/update-prefs.md
index 9949b44..e188a99 100644
--- a/docs/examples/java/teams/update-prefs.md
+++ b/docs/examples/java/teams/update-prefs.md
@@ -9,7 +9,7 @@ Client client = new Client(context)
Teams teams = new Teams(client);
teams.updatePrefs(
- "[TEAM_ID]", // teamId
+ "", // teamId
mapOf( "a" to "b" ), // prefs
new CoroutineCallback<>((result, error) -> {
if (error != null) {
diff --git a/docs/examples/kotlin/account/create2f-a-challenge.md b/docs/examples/kotlin/account/create-challenge.md
similarity index 89%
rename from docs/examples/kotlin/account/create2f-a-challenge.md
rename to docs/examples/kotlin/account/create-challenge.md
index 4608491..273d062 100644
--- a/docs/examples/kotlin/account/create2f-a-challenge.md
+++ b/docs/examples/kotlin/account/create-challenge.md
@@ -9,6 +9,6 @@ val client = Client(context)
val account = Account(client)
-val response = account.create2FAChallenge(
+val response = account.createChallenge(
factor = AuthenticationFactor.TOTP,
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/create-email-token.md b/docs/examples/kotlin/account/create-email-token.md
index f8ecea0..750be55 100644
--- a/docs/examples/kotlin/account/create-email-token.md
+++ b/docs/examples/kotlin/account/create-email-token.md
@@ -9,7 +9,7 @@ val client = Client(context)
val account = Account(client)
val response = account.createEmailToken(
- userId = "[USER_ID]",
+ userId = "",
email = "email@example.com",
phrase = false, // (optional)
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/create-magic-u-r-l-token.md b/docs/examples/kotlin/account/create-magic-u-r-l-token.md
index 93122ab..99ce7ae 100644
--- a/docs/examples/kotlin/account/create-magic-u-r-l-token.md
+++ b/docs/examples/kotlin/account/create-magic-u-r-l-token.md
@@ -9,7 +9,7 @@ val client = Client(context)
val account = Account(client)
val response = account.createMagicURLToken(
- userId = "[USER_ID]",
+ userId = "",
email = "email@example.com",
url = "https://example.com", // (optional)
phrase = false, // (optional)
diff --git a/docs/examples/kotlin/account/create-o-auth2session.md b/docs/examples/kotlin/account/create-o-auth2session.md
index 90a4e56..d642de8 100644
--- a/docs/examples/kotlin/account/create-o-auth2session.md
+++ b/docs/examples/kotlin/account/create-o-auth2session.md
@@ -13,6 +13,5 @@ account.createOAuth2Session(
provider = OAuthProvider.AMAZON,
success = "https://example.com", // (optional)
failure = "https://example.com", // (optional)
- token = false, // (optional)
scopes = listOf(), // (optional)
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/create-o-auth2token.md b/docs/examples/kotlin/account/create-o-auth2token.md
new file mode 100644
index 0000000..7d651b1
--- /dev/null
+++ b/docs/examples/kotlin/account/create-o-auth2token.md
@@ -0,0 +1,17 @@
+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
+ .setProject("5df5acd0d48c2") // Your project ID
+
+val account = Account(client)
+
+account.createOAuth2Token(
+ provider = OAuthProvider.AMAZON,
+ success = "https://example.com", // (optional)
+ failure = "https://example.com", // (optional)
+ scopes = listOf(), // (optional)
+)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/create-phone-token.md b/docs/examples/kotlin/account/create-phone-token.md
index b85d8c5..acef3bd 100644
--- a/docs/examples/kotlin/account/create-phone-token.md
+++ b/docs/examples/kotlin/account/create-phone-token.md
@@ -9,6 +9,6 @@ val client = Client(context)
val account = Account(client)
val response = account.createPhoneToken(
- userId = "[USER_ID]",
+ userId = "",
phone = "+12065550100",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/create-push-target.md b/docs/examples/kotlin/account/create-push-target.md
index f9dd27b..de9b5a2 100644
--- a/docs/examples/kotlin/account/create-push-target.md
+++ b/docs/examples/kotlin/account/create-push-target.md
@@ -9,7 +9,7 @@ val client = Client(context)
val account = Account(client)
val response = account.createPushTarget(
- targetId = "[TARGET_ID]",
- identifier = "[IDENTIFIER]",
- providerId = "[PROVIDER_ID]", // (optional)
+ targetId = "",
+ identifier = "",
+ providerId = "", // (optional)
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/create-session.md b/docs/examples/kotlin/account/create-session.md
index 5639145..1ea8d22 100644
--- a/docs/examples/kotlin/account/create-session.md
+++ b/docs/examples/kotlin/account/create-session.md
@@ -9,6 +9,6 @@ val client = Client(context)
val account = Account(client)
val response = account.createSession(
- userId = "[USER_ID]",
- secret = "[SECRET]",
+ userId = "",
+ secret = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/create.md b/docs/examples/kotlin/account/create.md
index 377cccc..21718ef 100644
--- a/docs/examples/kotlin/account/create.md
+++ b/docs/examples/kotlin/account/create.md
@@ -9,8 +9,8 @@ val client = Client(context)
val account = Account(client)
val response = account.create(
- userId = "[USER_ID]",
+ userId = "",
email = "email@example.com",
password = "",
- name = "[NAME]", // (optional)
+ name = "", // (optional)
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/delete-authenticator.md b/docs/examples/kotlin/account/delete-authenticator.md
index 7033470..6cb24db 100644
--- a/docs/examples/kotlin/account/delete-authenticator.md
+++ b/docs/examples/kotlin/account/delete-authenticator.md
@@ -11,5 +11,5 @@ val account = Account(client)
val response = account.deleteAuthenticator(
type = AuthenticatorType.TOTP,
- otp = "[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 96fa467..1507342 100644
--- a/docs/examples/kotlin/account/delete-identity.md
+++ b/docs/examples/kotlin/account/delete-identity.md
@@ -9,5 +9,5 @@ val client = Client(context)
val account = Account(client)
val response = account.deleteIdentity(
- identityId = "[IDENTITY_ID]",
+ identityId = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/delete-push-target.md b/docs/examples/kotlin/account/delete-push-target.md
index c03c13d..c774d02 100644
--- a/docs/examples/kotlin/account/delete-push-target.md
+++ b/docs/examples/kotlin/account/delete-push-target.md
@@ -9,5 +9,5 @@ val client = Client(context)
val account = Account(client)
val response = account.deletePushTarget(
- targetId = "[TARGET_ID]",
+ targetId = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/delete-session.md b/docs/examples/kotlin/account/delete-session.md
index 52ff38e..b49b3a5 100644
--- a/docs/examples/kotlin/account/delete-session.md
+++ b/docs/examples/kotlin/account/delete-session.md
@@ -9,5 +9,5 @@ val client = Client(context)
val account = Account(client)
val response = account.deleteSession(
- sessionId = "[SESSION_ID]",
+ sessionId = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/get-session.md b/docs/examples/kotlin/account/get-session.md
index 261f295..38a5fa6 100644
--- a/docs/examples/kotlin/account/get-session.md
+++ b/docs/examples/kotlin/account/get-session.md
@@ -9,5 +9,5 @@ val client = Client(context)
val account = Account(client)
val response = account.getSession(
- sessionId = "[SESSION_ID]",
+ sessionId = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/update-challenge.md b/docs/examples/kotlin/account/update-challenge.md
index 44a6dbd..2bf6754 100644
--- a/docs/examples/kotlin/account/update-challenge.md
+++ b/docs/examples/kotlin/account/update-challenge.md
@@ -9,6 +9,6 @@ val client = Client(context)
val account = Account(client)
val response = account.updateChallenge(
- challengeId = "[CHALLENGE_ID]",
- otp = "[OTP]",
+ challengeId = "",
+ otp = "",
)
\ 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 bbf5c65..9226177 100644
--- a/docs/examples/kotlin/account/update-magic-u-r-l-session.md
+++ b/docs/examples/kotlin/account/update-magic-u-r-l-session.md
@@ -9,6 +9,6 @@ val client = Client(context)
val account = Account(client)
val response = account.updateMagicURLSession(
- userId = "[USER_ID]",
- secret = "[SECRET]",
+ userId = "",
+ 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 9b1cb8c..5af1deb 100644
--- a/docs/examples/kotlin/account/update-name.md
+++ b/docs/examples/kotlin/account/update-name.md
@@ -9,5 +9,5 @@ val client = Client(context)
val account = Account(client)
val response = account.updateName(
- name = "[NAME]",
+ name = "",
)
\ 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 d86f478..0ef08ce 100644
--- a/docs/examples/kotlin/account/update-phone-verification.md
+++ b/docs/examples/kotlin/account/update-phone-verification.md
@@ -9,6 +9,6 @@ val client = Client(context)
val account = Account(client)
val response = account.updatePhoneVerification(
- userId = "[USER_ID]",
- secret = "[SECRET]",
+ userId = "",
+ secret = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/update-push-target.md b/docs/examples/kotlin/account/update-push-target.md
index 019f55c..2a7d4d7 100644
--- a/docs/examples/kotlin/account/update-push-target.md
+++ b/docs/examples/kotlin/account/update-push-target.md
@@ -9,6 +9,6 @@ val client = Client(context)
val account = Account(client)
val response = account.updatePushTarget(
- targetId = "[TARGET_ID]",
- identifier = "[IDENTIFIER]",
+ targetId = "",
+ identifier = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/update-recovery.md b/docs/examples/kotlin/account/update-recovery.md
index 176dd25..646c3a5 100644
--- a/docs/examples/kotlin/account/update-recovery.md
+++ b/docs/examples/kotlin/account/update-recovery.md
@@ -9,7 +9,7 @@ val client = Client(context)
val account = Account(client)
val response = account.updateRecovery(
- userId = "[USER_ID]",
- secret = "[SECRET]",
+ userId = "",
+ secret = "",
password = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/update-session.md b/docs/examples/kotlin/account/update-session.md
index afea816..2bad6e8 100644
--- a/docs/examples/kotlin/account/update-session.md
+++ b/docs/examples/kotlin/account/update-session.md
@@ -9,5 +9,5 @@ val client = Client(context)
val account = Account(client)
val response = account.updateSession(
- sessionId = "[SESSION_ID]",
+ sessionId = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/account/update-verification.md b/docs/examples/kotlin/account/update-verification.md
index eae6318..129b825 100644
--- a/docs/examples/kotlin/account/update-verification.md
+++ b/docs/examples/kotlin/account/update-verification.md
@@ -9,6 +9,6 @@ val client = Client(context)
val account = Account(client)
val response = account.updateVerification(
- userId = "[USER_ID]",
- secret = "[SECRET]",
+ userId = "",
+ 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
index 5b9b7ca..a0f5dd3 100644
--- a/docs/examples/kotlin/account/verify-authenticator.md
+++ b/docs/examples/kotlin/account/verify-authenticator.md
@@ -11,5 +11,5 @@ val account = Account(client)
val response = account.verifyAuthenticator(
type = AuthenticatorType.TOTP,
- otp = "[OTP]",
+ otp = "",
)
\ 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 5c84a34..69f2f9b 100644
--- a/docs/examples/kotlin/avatars/get-initials.md
+++ b/docs/examples/kotlin/avatars/get-initials.md
@@ -9,7 +9,7 @@ val client = Client(context)
val avatars = Avatars(client)
val result =avatars.getInitials(
- name = "[NAME]", // (optional)
+ name = "", // (optional)
width = 0, // (optional)
height = 0, // (optional)
background = "", // (optional)
diff --git a/docs/examples/kotlin/avatars/get-q-r.md b/docs/examples/kotlin/avatars/get-q-r.md
index bc525d0..e54b0c4 100644
--- a/docs/examples/kotlin/avatars/get-q-r.md
+++ b/docs/examples/kotlin/avatars/get-q-r.md
@@ -9,7 +9,7 @@ val client = Client(context)
val avatars = Avatars(client)
val result =avatars.getQR(
- text = "[TEXT]",
+ text = "",
size = 1, // (optional)
margin = 0, // (optional)
download = false, // (optional)
diff --git a/docs/examples/kotlin/databases/create-document.md b/docs/examples/kotlin/databases/create-document.md
index 7155af9..6a36558 100644
--- a/docs/examples/kotlin/databases/create-document.md
+++ b/docs/examples/kotlin/databases/create-document.md
@@ -9,9 +9,9 @@ val client = Client(context)
val databases = Databases(client)
val response = databases.createDocument(
- databaseId = "[DATABASE_ID]",
- collectionId = "[COLLECTION_ID]",
- documentId = "[DOCUMENT_ID]",
+ databaseId = "",
+ collectionId = "",
+ documentId = "",
data = mapOf( "a" to "b" ),
permissions = listOf("read("any")"), // (optional)
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/databases/delete-document.md b/docs/examples/kotlin/databases/delete-document.md
index f9e7a07..f8859a5 100644
--- a/docs/examples/kotlin/databases/delete-document.md
+++ b/docs/examples/kotlin/databases/delete-document.md
@@ -9,7 +9,7 @@ val client = Client(context)
val databases = Databases(client)
val response = databases.deleteDocument(
- databaseId = "[DATABASE_ID]",
- collectionId = "[COLLECTION_ID]",
- documentId = "[DOCUMENT_ID]",
+ databaseId = "",
+ collectionId = "",
+ documentId = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/databases/get-document.md b/docs/examples/kotlin/databases/get-document.md
index b52852c..5a8e260 100644
--- a/docs/examples/kotlin/databases/get-document.md
+++ b/docs/examples/kotlin/databases/get-document.md
@@ -9,8 +9,8 @@ val client = Client(context)
val databases = Databases(client)
val response = databases.getDocument(
- databaseId = "[DATABASE_ID]",
- collectionId = "[COLLECTION_ID]",
- documentId = "[DOCUMENT_ID]",
+ databaseId = "",
+ collectionId = "",
+ documentId = "",
queries = listOf(), // (optional)
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/databases/list-documents.md b/docs/examples/kotlin/databases/list-documents.md
index 9bcdea2..5601f06 100644
--- a/docs/examples/kotlin/databases/list-documents.md
+++ b/docs/examples/kotlin/databases/list-documents.md
@@ -9,7 +9,7 @@ val client = Client(context)
val databases = Databases(client)
val response = databases.listDocuments(
- databaseId = "[DATABASE_ID]",
- collectionId = "[COLLECTION_ID]",
+ databaseId = "",
+ collectionId = "",
queries = listOf(), // (optional)
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/databases/update-document.md b/docs/examples/kotlin/databases/update-document.md
index ae19c7e..583ba3f 100644
--- a/docs/examples/kotlin/databases/update-document.md
+++ b/docs/examples/kotlin/databases/update-document.md
@@ -9,9 +9,9 @@ val client = Client(context)
val databases = Databases(client)
val response = databases.updateDocument(
- databaseId = "[DATABASE_ID]",
- collectionId = "[COLLECTION_ID]",
- documentId = "[DOCUMENT_ID]",
+ databaseId = "",
+ collectionId = "",
+ documentId = "",
data = mapOf( "a" to "b" ), // (optional)
permissions = listOf("read("any")"), // (optional)
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/functions/create-execution.md b/docs/examples/kotlin/functions/create-execution.md
index 4a2cd3f..b0b5538 100644
--- a/docs/examples/kotlin/functions/create-execution.md
+++ b/docs/examples/kotlin/functions/create-execution.md
@@ -9,10 +9,10 @@ val client = Client(context)
val functions = Functions(client)
val response = functions.createExecution(
- functionId = "[FUNCTION_ID]",
- body = "[BODY]", // (optional)
+ functionId = "",
+ body = "", // (optional)
async = false, // (optional)
- path = "[PATH]", // (optional)
+ path = "", // (optional)
method = ExecutionMethod.GET, // (optional)
headers = mapOf( "a" to "b" ), // (optional)
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/functions/get-execution.md b/docs/examples/kotlin/functions/get-execution.md
index cbe8dd1..2adbf9a 100644
--- a/docs/examples/kotlin/functions/get-execution.md
+++ b/docs/examples/kotlin/functions/get-execution.md
@@ -9,6 +9,6 @@ val client = Client(context)
val functions = Functions(client)
val response = functions.getExecution(
- functionId = "[FUNCTION_ID]",
- executionId = "[EXECUTION_ID]",
+ functionId = "",
+ executionId = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/functions/list-executions.md b/docs/examples/kotlin/functions/list-executions.md
index 2b6c5f8..8e02409 100644
--- a/docs/examples/kotlin/functions/list-executions.md
+++ b/docs/examples/kotlin/functions/list-executions.md
@@ -9,7 +9,7 @@ val client = Client(context)
val functions = Functions(client)
val response = functions.listExecutions(
- functionId = "[FUNCTION_ID]",
+ functionId = "",
queries = listOf(), // (optional)
- search = "[SEARCH]", // (optional)
+ search = "", // (optional)
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/messaging/create-subscriber.md b/docs/examples/kotlin/messaging/create-subscriber.md
index 163c427..20771e5 100644
--- a/docs/examples/kotlin/messaging/create-subscriber.md
+++ b/docs/examples/kotlin/messaging/create-subscriber.md
@@ -9,7 +9,7 @@ val client = Client(context)
val messaging = Messaging(client)
val response = messaging.createSubscriber(
- topicId = "[TOPIC_ID]",
- subscriberId = "[SUBSCRIBER_ID]",
- targetId = "[TARGET_ID]",
+ topicId = "",
+ subscriberId = "",
+ targetId = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/messaging/delete-subscriber.md b/docs/examples/kotlin/messaging/delete-subscriber.md
index 7ac8930..02487c7 100644
--- a/docs/examples/kotlin/messaging/delete-subscriber.md
+++ b/docs/examples/kotlin/messaging/delete-subscriber.md
@@ -9,6 +9,6 @@ val client = Client(context)
val messaging = Messaging(client)
val response = messaging.deleteSubscriber(
- topicId = "[TOPIC_ID]",
- subscriberId = "[SUBSCRIBER_ID]",
+ topicId = "",
+ subscriberId = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/storage/create-file.md b/docs/examples/kotlin/storage/create-file.md
index 7381696..b5e4663 100644
--- a/docs/examples/kotlin/storage/create-file.md
+++ b/docs/examples/kotlin/storage/create-file.md
@@ -10,8 +10,8 @@ val client = Client(context)
val storage = Storage(client)
val response = storage.createFile(
- bucketId = "[BUCKET_ID]",
- fileId = "[FILE_ID]",
+ bucketId = "",
+ fileId = "",
file = InputFile.fromPath("file.png"),
permissions = listOf("read("any")"), // (optional)
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/storage/delete-file.md b/docs/examples/kotlin/storage/delete-file.md
index 0b14a1b..49a2505 100644
--- a/docs/examples/kotlin/storage/delete-file.md
+++ b/docs/examples/kotlin/storage/delete-file.md
@@ -9,6 +9,6 @@ val client = Client(context)
val storage = Storage(client)
val response = storage.deleteFile(
- bucketId = "[BUCKET_ID]",
- fileId = "[FILE_ID]",
+ bucketId = "",
+ fileId = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/storage/get-file-download.md b/docs/examples/kotlin/storage/get-file-download.md
index 83071ea..c6fe106 100644
--- a/docs/examples/kotlin/storage/get-file-download.md
+++ b/docs/examples/kotlin/storage/get-file-download.md
@@ -9,6 +9,6 @@ val client = Client(context)
val storage = Storage(client)
val result =storage.getFileDownload(
- bucketId = "[BUCKET_ID]",
- fileId = "[FILE_ID]",
+ bucketId = "",
+ fileId = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/storage/get-file-preview.md b/docs/examples/kotlin/storage/get-file-preview.md
index 4d23b0e..545391f 100644
--- a/docs/examples/kotlin/storage/get-file-preview.md
+++ b/docs/examples/kotlin/storage/get-file-preview.md
@@ -9,8 +9,8 @@ val client = Client(context)
val storage = Storage(client)
val result =storage.getFilePreview(
- bucketId = "[BUCKET_ID]",
- fileId = "[FILE_ID]",
+ bucketId = "",
+ fileId = "",
width = 0, // (optional)
height = 0, // (optional)
gravity = ImageGravity.CENTER, // (optional)
diff --git a/docs/examples/kotlin/storage/get-file-view.md b/docs/examples/kotlin/storage/get-file-view.md
index 552427e..307739d 100644
--- a/docs/examples/kotlin/storage/get-file-view.md
+++ b/docs/examples/kotlin/storage/get-file-view.md
@@ -9,6 +9,6 @@ val client = Client(context)
val storage = Storage(client)
val result =storage.getFileView(
- bucketId = "[BUCKET_ID]",
- fileId = "[FILE_ID]",
+ bucketId = "",
+ fileId = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/storage/get-file.md b/docs/examples/kotlin/storage/get-file.md
index 2f07fee..e82eb56 100644
--- a/docs/examples/kotlin/storage/get-file.md
+++ b/docs/examples/kotlin/storage/get-file.md
@@ -9,6 +9,6 @@ val client = Client(context)
val storage = Storage(client)
val response = storage.getFile(
- bucketId = "[BUCKET_ID]",
- fileId = "[FILE_ID]",
+ bucketId = "",
+ fileId = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/storage/list-files.md b/docs/examples/kotlin/storage/list-files.md
index c07afc2..54dbaa0 100644
--- a/docs/examples/kotlin/storage/list-files.md
+++ b/docs/examples/kotlin/storage/list-files.md
@@ -9,7 +9,7 @@ val client = Client(context)
val storage = Storage(client)
val response = storage.listFiles(
- bucketId = "[BUCKET_ID]",
+ bucketId = "",
queries = listOf(), // (optional)
- search = "[SEARCH]", // (optional)
+ search = "", // (optional)
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/storage/update-file.md b/docs/examples/kotlin/storage/update-file.md
index 8331e94..351ea52 100644
--- a/docs/examples/kotlin/storage/update-file.md
+++ b/docs/examples/kotlin/storage/update-file.md
@@ -9,8 +9,8 @@ val client = Client(context)
val storage = Storage(client)
val response = storage.updateFile(
- bucketId = "[BUCKET_ID]",
- fileId = "[FILE_ID]",
- name = "[NAME]", // (optional)
+ bucketId = "",
+ fileId = "",
+ name = "", // (optional)
permissions = listOf("read("any")"), // (optional)
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/create-membership.md b/docs/examples/kotlin/teams/create-membership.md
index 77fea6e..1a49b3e 100644
--- a/docs/examples/kotlin/teams/create-membership.md
+++ b/docs/examples/kotlin/teams/create-membership.md
@@ -9,11 +9,11 @@ val client = Client(context)
val teams = Teams(client)
val response = teams.createMembership(
- teamId = "[TEAM_ID]",
+ teamId = "",
roles = listOf(),
email = "email@example.com", // (optional)
- userId = "[USER_ID]", // (optional)
+ userId = "", // (optional)
phone = "+12065550100", // (optional)
url = "https://example.com", // (optional)
- name = "[NAME]", // (optional)
+ name = "", // (optional)
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/create.md b/docs/examples/kotlin/teams/create.md
index 4b841f9..1dce8a5 100644
--- a/docs/examples/kotlin/teams/create.md
+++ b/docs/examples/kotlin/teams/create.md
@@ -9,7 +9,7 @@ val client = Client(context)
val teams = Teams(client)
val response = teams.create(
- teamId = "[TEAM_ID]",
- name = "[NAME]",
+ teamId = "",
+ name = "",
roles = listOf(), // (optional)
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/delete-membership.md b/docs/examples/kotlin/teams/delete-membership.md
index 9ad5e21..1548551 100644
--- a/docs/examples/kotlin/teams/delete-membership.md
+++ b/docs/examples/kotlin/teams/delete-membership.md
@@ -9,6 +9,6 @@ val client = Client(context)
val teams = Teams(client)
val response = teams.deleteMembership(
- teamId = "[TEAM_ID]",
- membershipId = "[MEMBERSHIP_ID]",
+ teamId = "",
+ membershipId = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/delete.md b/docs/examples/kotlin/teams/delete.md
index bab1a31..3709d7b 100644
--- a/docs/examples/kotlin/teams/delete.md
+++ b/docs/examples/kotlin/teams/delete.md
@@ -9,5 +9,5 @@ val client = Client(context)
val teams = Teams(client)
val response = teams.delete(
- teamId = "[TEAM_ID]",
+ teamId = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/get-membership.md b/docs/examples/kotlin/teams/get-membership.md
index 8fbc3f7..b77e813 100644
--- a/docs/examples/kotlin/teams/get-membership.md
+++ b/docs/examples/kotlin/teams/get-membership.md
@@ -9,6 +9,6 @@ val client = Client(context)
val teams = Teams(client)
val response = teams.getMembership(
- teamId = "[TEAM_ID]",
- membershipId = "[MEMBERSHIP_ID]",
+ teamId = "",
+ membershipId = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/get-prefs.md b/docs/examples/kotlin/teams/get-prefs.md
index 7738575..11ecc61 100644
--- a/docs/examples/kotlin/teams/get-prefs.md
+++ b/docs/examples/kotlin/teams/get-prefs.md
@@ -9,5 +9,5 @@ val client = Client(context)
val teams = Teams(client)
val response = teams.getPrefs(
- teamId = "[TEAM_ID]",
+ teamId = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/get.md b/docs/examples/kotlin/teams/get.md
index 16a1b43..ff885e8 100644
--- a/docs/examples/kotlin/teams/get.md
+++ b/docs/examples/kotlin/teams/get.md
@@ -9,5 +9,5 @@ val client = Client(context)
val teams = Teams(client)
val response = teams.get(
- teamId = "[TEAM_ID]",
+ teamId = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/list-memberships.md b/docs/examples/kotlin/teams/list-memberships.md
index 44c9638..f143426 100644
--- a/docs/examples/kotlin/teams/list-memberships.md
+++ b/docs/examples/kotlin/teams/list-memberships.md
@@ -9,7 +9,7 @@ val client = Client(context)
val teams = Teams(client)
val response = teams.listMemberships(
- teamId = "[TEAM_ID]",
+ teamId = "",
queries = listOf(), // (optional)
- search = "[SEARCH]", // (optional)
+ search = "", // (optional)
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/list.md b/docs/examples/kotlin/teams/list.md
index 38ac1d9..91475e2 100644
--- a/docs/examples/kotlin/teams/list.md
+++ b/docs/examples/kotlin/teams/list.md
@@ -10,5 +10,5 @@ val teams = Teams(client)
val response = teams.list(
queries = listOf(), // (optional)
- search = "[SEARCH]", // (optional)
+ search = "", // (optional)
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/update-membership-status.md b/docs/examples/kotlin/teams/update-membership-status.md
index 53fbe20..22b1c81 100644
--- a/docs/examples/kotlin/teams/update-membership-status.md
+++ b/docs/examples/kotlin/teams/update-membership-status.md
@@ -9,8 +9,8 @@ val client = Client(context)
val teams = Teams(client)
val response = teams.updateMembershipStatus(
- teamId = "[TEAM_ID]",
- membershipId = "[MEMBERSHIP_ID]",
- userId = "[USER_ID]",
- secret = "[SECRET]",
+ teamId = "",
+ membershipId = "",
+ userId = "",
+ secret = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/update-membership.md b/docs/examples/kotlin/teams/update-membership.md
index 4e47025..035bdff 100644
--- a/docs/examples/kotlin/teams/update-membership.md
+++ b/docs/examples/kotlin/teams/update-membership.md
@@ -9,7 +9,7 @@ val client = Client(context)
val teams = Teams(client)
val response = teams.updateMembership(
- teamId = "[TEAM_ID]",
- membershipId = "[MEMBERSHIP_ID]",
+ teamId = "",
+ membershipId = "",
roles = listOf(),
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/update-name.md b/docs/examples/kotlin/teams/update-name.md
index f92b302..77ccd47 100644
--- a/docs/examples/kotlin/teams/update-name.md
+++ b/docs/examples/kotlin/teams/update-name.md
@@ -9,6 +9,6 @@ val client = Client(context)
val teams = Teams(client)
val response = teams.updateName(
- teamId = "[TEAM_ID]",
- name = "[NAME]",
+ teamId = "",
+ name = "",
)
\ No newline at end of file
diff --git a/docs/examples/kotlin/teams/update-prefs.md b/docs/examples/kotlin/teams/update-prefs.md
index dc12687..702bc9c 100644
--- a/docs/examples/kotlin/teams/update-prefs.md
+++ b/docs/examples/kotlin/teams/update-prefs.md
@@ -9,6 +9,6 @@ val client = Client(context)
val teams = Teams(client)
val response = teams.updatePrefs(
- teamId = "[TEAM_ID]",
+ teamId = "",
prefs = mapOf( "a" to "b" ),
)
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/Client.kt b/library/src/main/java/io/appwrite/Client.kt
index 2877f9f..a191ff0 100644
--- a/library/src/main/java/io/appwrite/Client.kt
+++ b/library/src/main/java/io/appwrite/Client.kt
@@ -83,7 +83,7 @@ class Client @JvmOverloads constructor(
"x-sdk-name" to "Android",
"x-sdk-platform" to "client",
"x-sdk-language" to "android",
- "x-sdk-version" to "5.0.0-rc.4",
+ "x-sdk-version" to "5.0.0-rc.5",
"x-appwrite-response-format" to "1.5.0"
)
config = mutableMapOf()
diff --git a/library/src/main/java/io/appwrite/OS.kt b/library/src/main/java/io/appwrite/OS.kt
deleted file mode 100644
index 7828f02..0000000
--- a/library/src/main/java/io/appwrite/OS.kt
+++ /dev/null
@@ -1,52 +0,0 @@
-package io.appwrite
-
-import android.Manifest
-import android.content.pm.PackageManager
-import android.os.Build
-import androidx.activity.result.contract.ActivityResultContracts
-import androidx.appcompat.app.AppCompatActivity
-import androidx.core.content.ContextCompat
-
-object OS {
- fun requestPermission(
- activity: AppCompatActivity,
- permission: String,
- onGranted: () -> Unit = {},
- onDenied: () -> Unit = {},
- onShowRationale: () -> Unit = {},
- ) {
- if (
- Build.VERSION.SDK_INT < Build.VERSION_CODES.M ||
- (permission == Manifest.permission.POST_NOTIFICATIONS && Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU)
- ) {
- onGranted()
- return
- }
-
- if (ContextCompat.checkSelfPermission(
- activity,
- permission
- ) == PackageManager.PERMISSION_GRANTED
- ) {
- onGranted()
- } else if (activity.shouldShowRequestPermissionRationale(Manifest.permission.POST_NOTIFICATIONS)) {
- onShowRationale()
- } else {
- requestPermissionLauncher(activity, onGranted, onDenied).launch(permission)
- }
- }
-
- private fun requestPermissionLauncher(
- activity: AppCompatActivity,
- onGranted: () -> Unit,
- onDenied: () -> Unit,
- ) = activity.registerForActivityResult(
- ActivityResultContracts.RequestPermission(),
- ) { isGranted: Boolean ->
- if (isGranted) {
- onGranted()
- } else {
- onDenied()
- }
- }
-}
\ No newline at end of file
diff --git a/library/src/main/java/io/appwrite/enums/AuthenticationFactor.kt b/library/src/main/java/io/appwrite/enums/AuthenticationFactor.kt
index 3303e0b..7aca6e5 100644
--- a/library/src/main/java/io/appwrite/enums/AuthenticationFactor.kt
+++ b/library/src/main/java/io/appwrite/enums/AuthenticationFactor.kt
@@ -1,8 +1,13 @@
package io.appwrite.enums
+import com.google.gson.annotations.SerializedName
+
enum class AuthenticationFactor(val value: String) {
+ @SerializedName("totp")
TOTP("totp"),
+ @SerializedName("phone")
PHONE("phone"),
+ @SerializedName("email")
EMAIL("email");
override fun toString() = value
diff --git a/library/src/main/java/io/appwrite/enums/AuthenticatorType.kt b/library/src/main/java/io/appwrite/enums/AuthenticatorType.kt
index 27e1635..a7d37ae 100644
--- a/library/src/main/java/io/appwrite/enums/AuthenticatorType.kt
+++ b/library/src/main/java/io/appwrite/enums/AuthenticatorType.kt
@@ -1,6 +1,9 @@
package io.appwrite.enums
+import com.google.gson.annotations.SerializedName
+
enum class AuthenticatorType(val value: String) {
+ @SerializedName("totp")
TOTP("totp");
override fun toString() = value
diff --git a/library/src/main/java/io/appwrite/enums/Browser.kt b/library/src/main/java/io/appwrite/enums/Browser.kt
index 99f598e..f71024a 100644
--- a/library/src/main/java/io/appwrite/enums/Browser.kt
+++ b/library/src/main/java/io/appwrite/enums/Browser.kt
@@ -1,19 +1,35 @@
package io.appwrite.enums
+import com.google.gson.annotations.SerializedName
+
enum class Browser(val value: String) {
+ @SerializedName("aa")
AVANT_BROWSER("aa"),
+ @SerializedName("an")
ANDROID_WEB_VIEW_BETA("an"),
+ @SerializedName("ch")
GOOGLE_CHROME("ch"),
+ @SerializedName("ci")
GOOGLE_CHROMEI_OS("ci"),
+ @SerializedName("cm")
GOOGLE_CHROME_MOBILE("cm"),
+ @SerializedName("cr")
CHROMIUM("cr"),
+ @SerializedName("ff")
MOZILLA_FIREFOX("ff"),
+ @SerializedName("sf")
SAFARI("sf"),
+ @SerializedName("mf")
MOBILE_SAFARI("mf"),
+ @SerializedName("ps")
MICROSOFT_EDGE("ps"),
+ @SerializedName("oi")
MICROSOFT_EDGEI_OS("oi"),
+ @SerializedName("om")
OPERA_MINI("om"),
+ @SerializedName("op")
OPERA("op"),
+ @SerializedName("on")
OPERA_NEXT("on");
override fun toString() = value
diff --git a/library/src/main/java/io/appwrite/enums/CreditCard.kt b/library/src/main/java/io/appwrite/enums/CreditCard.kt
index e99519b..7224778 100644
--- a/library/src/main/java/io/appwrite/enums/CreditCard.kt
+++ b/library/src/main/java/io/appwrite/enums/CreditCard.kt
@@ -1,21 +1,39 @@
package io.appwrite.enums
+import com.google.gson.annotations.SerializedName
+
enum class CreditCard(val value: String) {
+ @SerializedName("amex")
AMERICAN_EXPRESS("amex"),
+ @SerializedName("argencard")
ARGENCARD("argencard"),
+ @SerializedName("cabal")
CABAL("cabal"),
+ @SerializedName("censosud")
CONSOSUD("censosud"),
+ @SerializedName("diners")
DINERS_CLUB("diners"),
+ @SerializedName("discover")
DISCOVER("discover"),
+ @SerializedName("elo")
ELO("elo"),
+ @SerializedName("hipercard")
HIPERCARD("hipercard"),
+ @SerializedName("jcb")
JCB("jcb"),
+ @SerializedName("mastercard")
MASTERCARD("mastercard"),
+ @SerializedName("naranja")
NARANJA("naranja"),
+ @SerializedName("targeta-shopping")
TARJETA_SHOPPING("targeta-shopping"),
+ @SerializedName("union-china-pay")
UNION_CHINA_PAY("union-china-pay"),
+ @SerializedName("visa")
VISA("visa"),
+ @SerializedName("mir")
MIR("mir"),
+ @SerializedName("maestro")
MAESTRO("maestro");
override fun toString() = value
diff --git a/library/src/main/java/io/appwrite/enums/ExecutionMethod.kt b/library/src/main/java/io/appwrite/enums/ExecutionMethod.kt
index edeb66b..946fdb3 100644
--- a/library/src/main/java/io/appwrite/enums/ExecutionMethod.kt
+++ b/library/src/main/java/io/appwrite/enums/ExecutionMethod.kt
@@ -1,11 +1,19 @@
package io.appwrite.enums
+import com.google.gson.annotations.SerializedName
+
enum class ExecutionMethod(val value: String) {
+ @SerializedName("GET")
GET("GET"),
+ @SerializedName("POST")
POST("POST"),
+ @SerializedName("PUT")
PUT("PUT"),
+ @SerializedName("PATCH")
PATCH("PATCH"),
+ @SerializedName("DELETE")
DELETE("DELETE"),
+ @SerializedName("OPTIONS")
OPTIONS("OPTIONS");
override fun toString() = value
diff --git a/library/src/main/java/io/appwrite/enums/Flag.kt b/library/src/main/java/io/appwrite/enums/Flag.kt
index 4fcdd88..af5889a 100644
--- a/library/src/main/java/io/appwrite/enums/Flag.kt
+++ b/library/src/main/java/io/appwrite/enums/Flag.kt
@@ -1,199 +1,395 @@
package io.appwrite.enums
+import com.google.gson.annotations.SerializedName
+
enum class Flag(val value: String) {
+ @SerializedName("af")
AFGHANISTAN("af"),
+ @SerializedName("ao")
ANGOLA("ao"),
+ @SerializedName("al")
ALBANIA("al"),
+ @SerializedName("ad")
ANDORRA("ad"),
+ @SerializedName("ae")
UNITED_ARAB_EMIRATES("ae"),
+ @SerializedName("ar")
ARGENTINA("ar"),
+ @SerializedName("am")
ARMENIA("am"),
+ @SerializedName("ag")
ANTIGUAAND_BARBUDA("ag"),
+ @SerializedName("au")
AUSTRALIA("au"),
+ @SerializedName("at")
AUSTRIA("at"),
+ @SerializedName("az")
AZERBAIJAN("az"),
+ @SerializedName("bi")
BURUNDI("bi"),
+ @SerializedName("be")
BELGIUM("be"),
+ @SerializedName("bj")
BENIN("bj"),
+ @SerializedName("bf")
BURKINA_FASO("bf"),
+ @SerializedName("bd")
BANGLADESH("bd"),
+ @SerializedName("bg")
BULGARIA("bg"),
+ @SerializedName("bh")
BAHRAIN("bh"),
+ @SerializedName("bs")
BAHAMAS("bs"),
+ @SerializedName("ba")
BOSNIAAND_HERZEGOVINA("ba"),
+ @SerializedName("by")
BELARUS("by"),
+ @SerializedName("bz")
BELIZE("bz"),
+ @SerializedName("bo")
BOLIVIA("bo"),
+ @SerializedName("br")
BRAZIL("br"),
+ @SerializedName("bb")
BARBADOS("bb"),
+ @SerializedName("bn")
BRUNEI_DARUSSALAM("bn"),
+ @SerializedName("bt")
BHUTAN("bt"),
+ @SerializedName("bw")
BOTSWANA("bw"),
+ @SerializedName("cf")
CENTRAL_AFRICAN_REPUBLIC("cf"),
+ @SerializedName("ca")
CANADA("ca"),
+ @SerializedName("ch")
SWITZERLAND("ch"),
+ @SerializedName("cl")
CHILE("cl"),
+ @SerializedName("cn")
CHINA("cn"),
+ @SerializedName("ci")
CTED_IVOIRE("ci"),
+ @SerializedName("cm")
CAMEROON("cm"),
+ @SerializedName("cd")
DEMOCRATIC_REPUBLICOFTHE_CONGO("cd"),
+ @SerializedName("cg")
REPUBLICOFTHE_CONGO("cg"),
+ @SerializedName("co")
COLOMBIA("co"),
+ @SerializedName("km")
COMOROS("km"),
+ @SerializedName("cv")
CAPE_VERDE("cv"),
+ @SerializedName("cr")
COSTA_RICA("cr"),
+ @SerializedName("cu")
CUBA("cu"),
+ @SerializedName("cy")
CYPRUS("cy"),
+ @SerializedName("cz")
CZECH_REPUBLIC("cz"),
+ @SerializedName("de")
GERMANY("de"),
+ @SerializedName("dj")
DJIBOUTI("dj"),
+ @SerializedName("dm")
DOMINICA("dm"),
+ @SerializedName("dk")
DENMARK("dk"),
+ @SerializedName("do")
DOMINICAN_REPUBLIC("do"),
+ @SerializedName("dz")
ALGERIA("dz"),
+ @SerializedName("ec")
ECUADOR("ec"),
+ @SerializedName("eg")
EGYPT("eg"),
+ @SerializedName("er")
ERITREA("er"),
+ @SerializedName("es")
SPAIN("es"),
+ @SerializedName("ee")
ESTONIA("ee"),
+ @SerializedName("et")
ETHIOPIA("et"),
+ @SerializedName("fi")
FINLAND("fi"),
+ @SerializedName("fj")
FIJI("fj"),
+ @SerializedName("fr")
FRANCE("fr"),
+ @SerializedName("fm")
MICRONESIA_FEDERATED_STATESOF("fm"),
+ @SerializedName("ga")
GABON("ga"),
+ @SerializedName("gb")
UNITED_KINGDOM("gb"),
+ @SerializedName("ge")
GEORGIA("ge"),
+ @SerializedName("gh")
GHANA("gh"),
+ @SerializedName("gn")
GUINEA("gn"),
+ @SerializedName("gm")
GAMBIA("gm"),
+ @SerializedName("gw")
GUINEA_BISSAU("gw"),
+ @SerializedName("gq")
EQUATORIAL_GUINEA("gq"),
+ @SerializedName("gr")
GREECE("gr"),
+ @SerializedName("gd")
GRENADA("gd"),
+ @SerializedName("gt")
GUATEMALA("gt"),
+ @SerializedName("gy")
GUYANA("gy"),
+ @SerializedName("hn")
HONDURAS("hn"),
+ @SerializedName("hr")
CROATIA("hr"),
+ @SerializedName("ht")
HAITI("ht"),
+ @SerializedName("hu")
HUNGARY("hu"),
+ @SerializedName("id")
INDONESIA("id"),
+ @SerializedName("in")
INDIA("in"),
+ @SerializedName("ie")
IRELAND("ie"),
+ @SerializedName("ir")
IRAN_ISLAMIC_REPUBLICOF("ir"),
+ @SerializedName("iq")
IRAQ("iq"),
+ @SerializedName("is")
ICELAND("is"),
+ @SerializedName("il")
ISRAEL("il"),
+ @SerializedName("it")
ITALY("it"),
+ @SerializedName("jm")
JAMAICA("jm"),
+ @SerializedName("jo")
JORDAN("jo"),
+ @SerializedName("jp")
JAPAN("jp"),
+ @SerializedName("kz")
KAZAKHSTAN("kz"),
+ @SerializedName("ke")
KENYA("ke"),
+ @SerializedName("kg")
KYRGYZSTAN("kg"),
+ @SerializedName("kh")
CAMBODIA("kh"),
+ @SerializedName("ki")
KIRIBATI("ki"),
+ @SerializedName("kn")
SAINT_KITTSAND_NEVIS("kn"),
+ @SerializedName("kr")
SOUTH_KOREA("kr"),
+ @SerializedName("kw")
KUWAIT("kw"),
+ @SerializedName("la")
LAO_PEOPLES_DEMOCRATIC_REPUBLIC("la"),
+ @SerializedName("lb")
LEBANON("lb"),
+ @SerializedName("lr")
LIBERIA("lr"),
+ @SerializedName("ly")
LIBYA("ly"),
+ @SerializedName("lc")
SAINT_LUCIA("lc"),
+ @SerializedName("li")
LIECHTENSTEIN("li"),
+ @SerializedName("lk")
SRI_LANKA("lk"),
+ @SerializedName("ls")
LESOTHO("ls"),
+ @SerializedName("lt")
LITHUANIA("lt"),
+ @SerializedName("lu")
LUXEMBOURG("lu"),
+ @SerializedName("lv")
LATVIA("lv"),
+ @SerializedName("ma")
MOROCCO("ma"),
+ @SerializedName("mc")
MONACO("mc"),
+ @SerializedName("md")
MOLDOVA("md"),
+ @SerializedName("mg")
MADAGASCAR("mg"),
+ @SerializedName("mv")
MALDIVES("mv"),
+ @SerializedName("mx")
MEXICO("mx"),
+ @SerializedName("mh")
MARSHALL_ISLANDS("mh"),
+ @SerializedName("mk")
NORTH_MACEDONIA("mk"),
+ @SerializedName("ml")
MALI("ml"),
+ @SerializedName("mt")
MALTA("mt"),
+ @SerializedName("mm")
MYANMAR("mm"),
+ @SerializedName("me")
MONTENEGRO("me"),
+ @SerializedName("mn")
MONGOLIA("mn"),
+ @SerializedName("mz")
MOZAMBIQUE("mz"),
+ @SerializedName("mr")
MAURITANIA("mr"),
+ @SerializedName("mu")
MAURITIUS("mu"),
+ @SerializedName("mw")
MALAWI("mw"),
+ @SerializedName("my")
MALAYSIA("my"),
+ @SerializedName("na")
NAMIBIA("na"),
+ @SerializedName("ne")
NIGER("ne"),
+ @SerializedName("ng")
NIGERIA("ng"),
+ @SerializedName("ni")
NICARAGUA("ni"),
+ @SerializedName("nl")
NETHERLANDS("nl"),
+ @SerializedName("no")
NORWAY("no"),
+ @SerializedName("np")
NEPAL("np"),
+ @SerializedName("nr")
NAURU("nr"),
+ @SerializedName("nz")
NEW_ZEALAND("nz"),
+ @SerializedName("om")
OMAN("om"),
+ @SerializedName("pk")
PAKISTAN("pk"),
+ @SerializedName("pa")
PANAMA("pa"),
+ @SerializedName("pe")
PERU("pe"),
+ @SerializedName("ph")
PHILIPPINES("ph"),
+ @SerializedName("pw")
PALAU("pw"),
+ @SerializedName("pg")
PAPUA_NEW_GUINEA("pg"),
+ @SerializedName("pl")
POLAND("pl"),
+ @SerializedName("kp")
NORTH_KOREA("kp"),
+ @SerializedName("pt")
PORTUGAL("pt"),
+ @SerializedName("py")
PARAGUAY("py"),
+ @SerializedName("qa")
QATAR("qa"),
+ @SerializedName("ro")
ROMANIA("ro"),
+ @SerializedName("ru")
RUSSIA("ru"),
+ @SerializedName("rw")
RWANDA("rw"),
+ @SerializedName("sa")
SAUDI_ARABIA("sa"),
+ @SerializedName("sd")
SUDAN("sd"),
+ @SerializedName("sn")
SENEGAL("sn"),
+ @SerializedName("sg")
SINGAPORE("sg"),
+ @SerializedName("sb")
SOLOMON_ISLANDS("sb"),
+ @SerializedName("sl")
SIERRA_LEONE("sl"),
+ @SerializedName("sv")
EL_SALVADOR("sv"),
+ @SerializedName("sm")
SAN_MARINO("sm"),
+ @SerializedName("so")
SOMALIA("so"),
+ @SerializedName("rs")
SERBIA("rs"),
+ @SerializedName("ss")
SOUTH_SUDAN("ss"),
+ @SerializedName("st")
SAO_TOMEAND_PRINCIPE("st"),
+ @SerializedName("sr")
SURINAME("sr"),
+ @SerializedName("sk")
SLOVAKIA("sk"),
+ @SerializedName("si")
SLOVENIA("si"),
+ @SerializedName("se")
SWEDEN("se"),
+ @SerializedName("sz")
ESWATINI("sz"),
+ @SerializedName("sc")
SEYCHELLES("sc"),
+ @SerializedName("sy")
SYRIA("sy"),
+ @SerializedName("td")
CHAD("td"),
+ @SerializedName("tg")
TOGO("tg"),
+ @SerializedName("th")
THAILAND("th"),
+ @SerializedName("tj")
TAJIKISTAN("tj"),
+ @SerializedName("tm")
TURKMENISTAN("tm"),
+ @SerializedName("tl")
TIMOR_LESTE("tl"),
+ @SerializedName("to")
TONGA("to"),
+ @SerializedName("tt")
TRINIDADAND_TOBAGO("tt"),
+ @SerializedName("tn")
TUNISIA("tn"),
+ @SerializedName("tr")
TURKEY("tr"),
+ @SerializedName("tv")
TUVALU("tv"),
+ @SerializedName("tz")
TANZANIA("tz"),
+ @SerializedName("ug")
UGANDA("ug"),
+ @SerializedName("ua")
UKRAINE("ua"),
+ @SerializedName("uy")
URUGUAY("uy"),
+ @SerializedName("us")
UNITED_STATES("us"),
+ @SerializedName("uz")
UZBEKISTAN("uz"),
+ @SerializedName("va")
VATICAN_CITY("va"),
+ @SerializedName("vc")
SAINT_VINCENTANDTHE_GRENADINES("vc"),
+ @SerializedName("ve")
VENEZUELA("ve"),
+ @SerializedName("vn")
VIETNAM("vn"),
+ @SerializedName("vu")
VANUATU("vu"),
+ @SerializedName("ws")
SAMOA("ws"),
+ @SerializedName("ye")
YEMEN("ye"),
+ @SerializedName("za")
SOUTH_AFRICA("za"),
+ @SerializedName("zm")
ZAMBIA("zm"),
+ @SerializedName("zw")
ZIMBABWE("zw");
override fun toString() = value
diff --git a/library/src/main/java/io/appwrite/enums/ImageFormat.kt b/library/src/main/java/io/appwrite/enums/ImageFormat.kt
index 6a4c422..c6a3b0f 100644
--- a/library/src/main/java/io/appwrite/enums/ImageFormat.kt
+++ b/library/src/main/java/io/appwrite/enums/ImageFormat.kt
@@ -1,10 +1,17 @@
package io.appwrite.enums
+import com.google.gson.annotations.SerializedName
+
enum class ImageFormat(val value: String) {
+ @SerializedName("jpg")
JPG("jpg"),
+ @SerializedName("jpeg")
JPEG("jpeg"),
+ @SerializedName("gif")
GIF("gif"),
+ @SerializedName("png")
PNG("png"),
+ @SerializedName("webp")
WEBP("webp");
override fun toString() = value
diff --git a/library/src/main/java/io/appwrite/enums/ImageGravity.kt b/library/src/main/java/io/appwrite/enums/ImageGravity.kt
index a8fa441..0e8325d 100644
--- a/library/src/main/java/io/appwrite/enums/ImageGravity.kt
+++ b/library/src/main/java/io/appwrite/enums/ImageGravity.kt
@@ -1,14 +1,25 @@
package io.appwrite.enums
+import com.google.gson.annotations.SerializedName
+
enum class ImageGravity(val value: String) {
+ @SerializedName("center")
CENTER("center"),
+ @SerializedName("top-left")
TOPLEFT("top-left"),
+ @SerializedName("top")
TOP("top"),
+ @SerializedName("top-right")
TOPRIGHT("top-right"),
+ @SerializedName("left")
LEFT("left"),
+ @SerializedName("right")
RIGHT("right"),
+ @SerializedName("bottom-left")
BOTTOMLEFT("bottom-left"),
+ @SerializedName("bottom")
BOTTOM("bottom"),
+ @SerializedName("bottom-right")
BOTTOMRIGHT("bottom-right");
override fun toString() = value
diff --git a/library/src/main/java/io/appwrite/enums/OAuthProvider.kt b/library/src/main/java/io/appwrite/enums/OAuthProvider.kt
index 4a38a2e..2b96d63 100644
--- a/library/src/main/java/io/appwrite/enums/OAuthProvider.kt
+++ b/library/src/main/java/io/appwrite/enums/OAuthProvider.kt
@@ -1,44 +1,85 @@
package io.appwrite.enums
+import com.google.gson.annotations.SerializedName
+
enum class OAuthProvider(val value: String) {
+ @SerializedName("amazon")
AMAZON("amazon"),
+ @SerializedName("apple")
APPLE("apple"),
+ @SerializedName("auth0")
AUTH0("auth0"),
+ @SerializedName("authentik")
AUTHENTIK("authentik"),
+ @SerializedName("autodesk")
AUTODESK("autodesk"),
+ @SerializedName("bitbucket")
BITBUCKET("bitbucket"),
+ @SerializedName("bitly")
BITLY("bitly"),
+ @SerializedName("box")
BOX("box"),
+ @SerializedName("dailymotion")
DAILYMOTION("dailymotion"),
+ @SerializedName("discord")
DISCORD("discord"),
+ @SerializedName("disqus")
DISQUS("disqus"),
+ @SerializedName("dropbox")
DROPBOX("dropbox"),
+ @SerializedName("etsy")
ETSY("etsy"),
+ @SerializedName("facebook")
FACEBOOK("facebook"),
+ @SerializedName("github")
GITHUB("github"),
+ @SerializedName("gitlab")
GITLAB("gitlab"),
+ @SerializedName("google")
GOOGLE("google"),
+ @SerializedName("linkedin")
LINKEDIN("linkedin"),
+ @SerializedName("microsoft")
MICROSOFT("microsoft"),
+ @SerializedName("notion")
NOTION("notion"),
+ @SerializedName("oidc")
OIDC("oidc"),
+ @SerializedName("okta")
OKTA("okta"),
+ @SerializedName("paypal")
PAYPAL("paypal"),
+ @SerializedName("paypalSandbox")
PAYPAL_SANDBOX("paypalSandbox"),
+ @SerializedName("podio")
PODIO("podio"),
+ @SerializedName("salesforce")
SALESFORCE("salesforce"),
+ @SerializedName("slack")
SLACK("slack"),
+ @SerializedName("spotify")
SPOTIFY("spotify"),
+ @SerializedName("stripe")
STRIPE("stripe"),
+ @SerializedName("tradeshift")
TRADESHIFT("tradeshift"),
+ @SerializedName("tradeshiftBox")
TRADESHIFT_BOX("tradeshiftBox"),
+ @SerializedName("twitch")
TWITCH("twitch"),
+ @SerializedName("wordpress")
WORDPRESS("wordpress"),
+ @SerializedName("yahoo")
YAHOO("yahoo"),
+ @SerializedName("yammer")
YAMMER("yammer"),
+ @SerializedName("yandex")
YANDEX("yandex"),
+ @SerializedName("zoho")
ZOHO("zoho"),
+ @SerializedName("zoom")
ZOOM("zoom"),
+ @SerializedName("mock")
MOCK("mock");
override fun toString() = value
diff --git a/library/src/main/java/io/appwrite/services/Account.kt b/library/src/main/java/io/appwrite/services/Account.kt
index ccc2c29..ac37eb1 100644
--- a/library/src/main/java/io/appwrite/services/Account.kt
+++ b/library/src/main/java/io/appwrite/services/Account.kt
@@ -377,7 +377,7 @@ class Account(client: Client) : Service(client) {
* @param factor Factor used for verification.
* @return [io.appwrite.models.MfaChallenge]
*/
- suspend fun create2FAChallenge(
+ suspend fun createChallenge(
factor: AuthenticationFactor,
): io.appwrite.models.MfaChallenge {
val apiPath = "/account/mfa/challenge"
@@ -1117,7 +1117,6 @@ class Account(client: Client) : Service(client) {
* @param provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
* @param success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
* @param failure URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
- * @param token Include token credentials in the final redirect, useful for server-side integrations, or when cookies are not available.
* @param scopes A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
*/
@JvmOverloads
@@ -1126,7 +1125,6 @@ class Account(client: Client) : Service(client) {
provider: OAuthProvider,
success: String? = null,
failure: String? = null,
- token: Boolean? = null,
scopes: List? = null,
) {
val apiPath = "/account/sessions/oauth2/{provider}"
@@ -1135,7 +1133,6 @@ class Account(client: Client) : Service(client) {
val apiParams = mutableMapOf(
"success" to success,
"failure" to failure,
- "token" to token,
"scopes" to scopes,
"project" to client.config["project"],
)
@@ -1554,6 +1551,78 @@ class Account(client: Client) : Service(client) {
}
+ /**
+ * Create OAuth2 token
+ *
+ * Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed. If authentication succeeds, `userId` and `secret` of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint.A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
+ *
+ * @param provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
+ * @param success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
+ * @param failure URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
+ * @param scopes A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
+ */
+ @JvmOverloads
+ suspend fun createOAuth2Token(
+ activity: ComponentActivity,
+ provider: OAuthProvider,
+ success: String? = null,
+ failure: String? = null,
+ scopes: List? = null,
+ ) {
+ val apiPath = "/account/tokens/oauth2/{provider}"
+ .replace("{provider}", provider.value)
+
+ val apiParams = mutableMapOf(
+ "success" to success,
+ "failure" to failure,
+ "scopes" to scopes,
+ "project" to client.config["project"],
+ )
+ val apiQuery = mutableListOf()
+ apiParams.forEach {
+ when (it.value) {
+ null -> {
+ return@forEach
+ }
+ is List<*> -> {
+ apiQuery.add("${it.key}[]=${it.value.toString()}")
+ }
+ else -> {
+ apiQuery.add("${it.key}=${it.value.toString()}")
+ }
+ }
+ }
+
+ val apiUrl = Uri.parse("${client.endpoint}${apiPath}?${apiQuery.joinToString("&")}")
+ val callbackUrlScheme = "appwrite-callback-${client.config["project"]}"
+
+ WebAuthComponent.authenticate(activity, apiUrl, callbackUrlScheme) {
+ if (it.isFailure) {
+ throw it.exceptionOrNull()!!
+ }
+
+ val resultUrl = it.getOrNull()!!
+ val uri = Uri.parse(resultUrl)
+ val key = uri.getQueryParameter("key")
+ val secret = uri.getQueryParameter("secret")
+ if (key == null || secret == null) {
+ throw AppwriteException("Authentication cookie missing!")
+ }
+ val cookie = Cookie.Builder()
+ .name(key)
+ .value(secret)
+ .domain(Uri.parse(client.endpoint).host!!)
+ .httpOnly()
+ .build()
+
+ client.http.cookieJar.saveFromResponse(
+ client.endpoint.toHttpUrl(),
+ listOf(cookie)
+ )
+ }
+ }
+
+
/**
* Create phone token
*