diff --git a/.github/workflows/autoclose.yml b/.github/workflows/autoclose.yml
new file mode 100644
index 0000000..3e2b3cb
--- /dev/null
+++ b/.github/workflows/autoclose.yml
@@ -0,0 +1,11 @@
+name: Auto-close External Pull Requests
+
+on:
+ pull_request_target:
+ types: [opened, reopened]
+
+jobs:
+ auto_close:
+ uses: appwrite/.github/.github/workflows/autoclose.yml@main
+ secrets:
+ GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }}
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 20b880d..7145ba6 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -12,11 +12,10 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v2
- - name: Set up JDK 1.8
+ - name: Set up JDK 17
uses: actions/setup-java@v1
with:
- java-version: 1.8
- # Base64 decodes and pipes the GPG key content into the secret file
+ java-version: 17
- name: Prepare environment
env:
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }}
@@ -28,7 +27,7 @@ jobs:
# Builds the release artifacts of the library
- name: Build Release Artifacts
- run: ./gradlew --info library:assembleRelease
+ run: ./gradlew library:assembleRelease
# Generates other artifacts (javadocJar is optional)
- name: Generate Source jar
@@ -37,12 +36,12 @@ jobs:
# Runs upload, and then closes & releases the repository
- name: Publish Release Version to MavenCentral
run: |
- if ${{ endswith(github.event.release.tag_name, '-SNAPSHOT') }}; then
+ if ${{ contains(github.event.release.tag_name, '-rc') }}; then
echo "Publising Snapshot Version ${{ github.event.release.tag_name}} to Snapshot repository"
- ./gradlew publishReleasePublicationToSonatypeRepository
+ ./gradlew publishToSonatype
else
echo "Publising Release Version ${{ github.event.release.tag_name}} to Staging repository"
- ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseSonatypeStagingRepository
+ ./gradlew publishToSonatype --max-workers 1 closeAndReleaseSonatypeStagingRepository
fi
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
@@ -51,4 +50,4 @@ jobs:
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
- SDK_VERSION: ${{ github.event.release.tag_name }}
\ No newline at end of file
+ SDK_VERSION: ${{ github.event.release.tag_name }}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fa4d35e..38d0c4b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1 +1,23 @@
-# Change Log
\ No newline at end of file
+# Change Log
+
+## 8.2.0
+
+* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service
+* Add `gif` support to `ImageFormat` enum
+* Add `sequence` support to `Document` model
+
+## 8.1.0
+
+* Add `devKeys` support to `Client` service
+* Add `upsertDocument` support to `Databases` service
+
+## 8.0.0
+
+* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage
+* Update default `quality` for `getFilePreview` from 0 to -1
+* Remove `Gif` from ImageFormat enum
+* Remove `search` param from `listExecutions` method
+
+## 7.0.1
+
+* Fix requests failing by removing `Content-Type` header from `GET` and `HEAD` requests
diff --git a/LICENSE.md b/LICENSE.md
index d73a6e9..c1602fc 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -1,4 +1,4 @@
-Copyright (c) 2021 Appwrite (https://appwrite.io) and individual contributors.
+Copyright (c) 2025 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:
@@ -7,6 +7,6 @@ Redistribution and use in source and binary forms, with or without modification,
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/README.md b/README.md
index 862d6b8..a0c4c6d 100644
--- a/README.md
+++ b/README.md
@@ -2,16 +2,16 @@


-
+
[](https://travis-ci.com/appwrite/sdk-generator)
-[](https://twitter.com/appwrite_io)
+[](https://twitter.com/appwrite)
[](https://appwrite.io/discord)
-**This SDK is compatible with Appwrite server version 0.11.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.8.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)
-
+
## Installation
@@ -38,7 +38,7 @@ repositories {
Next, add the dependency to your project's `build.gradle(.kts)` file:
```groovy
-implementation("io.appwrite:sdk-for-android:0.2.1")
+implementation("io.appwrite:sdk-for-android:9.0.0")
```
### Maven
@@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file:
io.appwrite
sdk-for-android
- 0.2.1
+ 9.0.0
```
@@ -75,7 +75,7 @@ In order to capture the Appwrite OAuth callback url, the following activity need
-
+
@@ -91,8 +91,8 @@ import io.appwrite.Client
import io.appwrite.services.Account
val client = Client(context)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+ .setEndpoint("https:///v1") // Your API Endpoint
+ .setProject("") // Your project ID
.setSelfSigned(true) // Remove in production
```
@@ -108,8 +108,10 @@ When trying to connect to Appwrite from an emulator or a mobile device, localhos
// Register User
val account = Account(client)
val response = account.create(
- "email@example.com",
- "password"
+ ID.unique(),
+ "email@example.com",
+ "password",
+ "Walter O'Brien"
)
```
@@ -118,28 +120,158 @@ val response = account.create(
```kotlin
import io.appwrite.Client
import io.appwrite.services.Account
+import io.appwrite.ID
val client = Client(context)
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2") // Your project ID
+ .setEndpoint("https:///v1") // Your API Endpoint
+ .setProject("") // Your project ID
.setSelfSigned(true) // Remove in production
val account = Account(client)
-val response = account.create(
- "email@example.com",
- "password"
+val user = account.create(
+ ID.unique(),
+ "email@example.com",
+ "password",
+ "Walter O'Brien"
+)
+```
+
+### Type Safety with Models
+
+The Appwrite Android SDK provides type safety when working with database documents through generic methods. Methods like `listDocuments`, `getDocument`, and others accept a `nestedType` parameter that allows you to specify your custom model type for full type safety.
+
+**Kotlin:**
+```kotlin
+data class Book(
+ val name: String,
+ val author: String,
+ val releaseYear: String? = null,
+ val category: String? = null,
+ val genre: List? = null,
+ val isCheckedOut: Boolean
+)
+
+val databases = Databases(client)
+
+try {
+ val documents = databases.listDocuments(
+ databaseId = "your-database-id",
+ collectionId = "your-collection-id",
+ nestedType = Book::class.java // Pass in your custom model type
+ )
+
+ for (book in documents.documents) {
+ Log.d("Appwrite", "Book: ${book.name} by ${book.author}") // Now you have full type safety
+ }
+} catch (e: AppwriteException) {
+ Log.e("Appwrite", e.message ?: "Unknown error")
+}
+```
+
+**Java:**
+```java
+public class Book {
+ private String name;
+ private String author;
+ private String releaseYear;
+ private String category;
+ private List genre;
+ private boolean isCheckedOut;
+
+ // Constructor
+ public Book(String name, String author, boolean isCheckedOut) {
+ this.name = name;
+ this.author = author;
+ this.isCheckedOut = isCheckedOut;
+ }
+
+ // Getters and setters
+ public String getName() { return name; }
+ public void setName(String name) { this.name = name; }
+
+ public String getAuthor() { return author; }
+ public void setAuthor(String author) { this.author = author; }
+
+ public String getReleaseYear() { return releaseYear; }
+ public void setReleaseYear(String releaseYear) { this.releaseYear = releaseYear; }
+
+ public String getCategory() { return category; }
+ public void setCategory(String category) { this.category = category; }
+
+ public List getGenre() { return genre; }
+ public void setGenre(List genre) { this.genre = genre; }
+
+ public boolean isCheckedOut() { return isCheckedOut; }
+ public void setCheckedOut(boolean checkedOut) { isCheckedOut = checkedOut; }
+}
+
+Databases databases = new Databases(client);
+
+try {
+ DocumentList documents = databases.listDocuments(
+ "your-database-id",
+ "your-collection-id",
+ Book.class // Pass in your custom model type
+ );
+
+ for (Book book : documents.getDocuments()) {
+ Log.d("Appwrite", "Book: " + book.getName() + " by " + book.getAuthor()); // Now you have full type safety
+ }
+} catch (AppwriteException e) {
+ Log.e("Appwrite", e.getMessage() != null ? e.getMessage() : "Unknown error");
+}
+```
+
+**Tip**: You can use the `appwrite types` command to automatically generate model definitions based on your Appwrite database schema. Learn more about [type generation](https://appwrite.io/docs/products/databases/type-generation).
+
+### Working with Model Methods
+
+All Appwrite models come with built-in methods for data conversion and manipulation:
+
+**`toMap()`** - Converts a model instance to a Map format, useful for debugging or manual data manipulation:
+```kotlin
+val account = Account(client)
+val user = account.get()
+val userMap = user.toMap()
+Log.d("Appwrite", userMap.toString()) // Prints all user properties as a Map
+```
+
+**`from(map:, nestedType:)`** - Creates a model instance from a Map, useful when working with raw data:
+```kotlin
+val userData: Map = mapOf(
+ "\$id" to "123",
+ "name" to "John",
+ "email" to "john@example.com"
)
+val user = User.from(userData, User::class.java)
+```
+
+**JSON Serialization** - Models can be easily converted to/from JSON using Gson (which the SDK uses internally):
+```kotlin
+import com.google.gson.Gson
+
+val account = Account(client)
+val user = account.get()
+
+// Convert to JSON
+val gson = Gson()
+val jsonString = gson.toJson(user)
+Log.d("Appwrite", "User JSON: $jsonString")
+
+// Convert from JSON
+val userFromJson = gson.fromJson(jsonString, User::class.java)
```
### Error Handling
+
The Appwrite Android SDK raises an `AppwriteException` object with `message`, `code` and `response` properties. You can handle any errors by catching `AppwriteException` and present the `message` to the user or handle it yourself based on the provided error information. Below is an example.
```kotlin
try {
- var response = account.create("email@example.com", "password")
- Log.d("Appwrite response", response.body?.string())
+ var user = account.create(ID.unique(),"email@example.com","password","Walter O'Brien")
+ Log.d("Appwrite user", user.toMap())
} catch(e : AppwriteException) {
- Log.e("AppwriteException",e.message.toString())
+ e.printStackTrace()
}
```
@@ -150,6 +282,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/build.gradle b/build.gradle
index 4df4d35..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.4.31"
- version '0.2.1'
+ 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.0"
+ 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/create-anonymous-session.md b/docs/examples/java/account/create-anonymous-session.md
index b1a2a25..9d80588 100644
--- a/docs/examples/java/account/create-anonymous-session.md
+++ b/docs/examples/java/account/create-anonymous-session.md
@@ -1,46 +1,18 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Account account = new Account(client);
-
- account.createAnonymousSession(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
+account.createAnonymousSession(new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
}
-}
\ No newline at end of file
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/account/create-email-password-session.md b/docs/examples/java/account/create-email-password-session.md
new file mode 100644
index 0000000..428b6fd
--- /dev/null
+++ b/docs/examples/java/account/create-email-password-session.md
@@ -0,0 +1,23 @@
+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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.createEmailPasswordSession(
+ "email@example.com", // email
+ "password", // password
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/account/create-email-token.md b/docs/examples/java/account/create-email-token.md
new file mode 100644
index 0000000..869f4a8
--- /dev/null
+++ b/docs/examples/java/account/create-email-token.md
@@ -0,0 +1,24 @@
+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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.createEmailToken(
+ "", // userId
+ "email@example.com", // email
+ false, // phrase (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/account/create-j-w-t.md b/docs/examples/java/account/create-j-w-t.md
deleted file mode 100644
index 3a97c33..0000000
--- a/docs/examples/java/account/create-j-w-t.md
+++ /dev/null
@@ -1,46 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Account account = new Account(client);
-
- account.createJWT(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/account/create-jwt.md b/docs/examples/java/account/create-jwt.md
new file mode 100644
index 0000000..9e3bd28
--- /dev/null
+++ b/docs/examples/java/account/create-jwt.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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.createJWT(new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/account/create-magic-u-r-l-session.md b/docs/examples/java/account/create-magic-u-r-l-session.md
deleted file mode 100644
index 36fc58a..0000000
--- a/docs/examples/java/account/create-magic-u-r-l-session.md
+++ /dev/null
@@ -1,48 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Account account = new Account(client);
-
- account.createMagicURLSession(
- "email@example.com",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/account/create-magic-url-token.md b/docs/examples/java/account/create-magic-url-token.md
new file mode 100644
index 0000000..6253e00
--- /dev/null
+++ b/docs/examples/java/account/create-magic-url-token.md
@@ -0,0 +1,25 @@
+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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.createMagicURLToken(
+ "", // userId
+ "email@example.com", // email
+ "https://example.com", // url (optional)
+ false, // phrase (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/account/create-mfa-authenticator.md b/docs/examples/java/account/create-mfa-authenticator.md
new file mode 100644
index 0000000..d236f46
--- /dev/null
+++ b/docs/examples/java/account/create-mfa-authenticator.md
@@ -0,0 +1,23 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
+import io.appwrite.enums.AuthenticatorType;
+
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
+
+Account account = new Account(client);
+
+account.createMFAAuthenticator(
+ AuthenticatorType.TOTP, // type
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/account/create-mfa-challenge.md b/docs/examples/java/account/create-mfa-challenge.md
new file mode 100644
index 0000000..222c0bd
--- /dev/null
+++ b/docs/examples/java/account/create-mfa-challenge.md
@@ -0,0 +1,23 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
+import io.appwrite.enums.AuthenticationFactor;
+
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
+
+Account account = new Account(client);
+
+account.createMFAChallenge(
+ AuthenticationFactor.EMAIL, // factor
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/account/create-mfa-recovery-codes.md b/docs/examples/java/account/create-mfa-recovery-codes.md
new file mode 100644
index 0000000..792e086
--- /dev/null
+++ b/docs/examples/java/account/create-mfa-recovery-codes.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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.createMFARecoveryCodes(new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/account/create-o-auth-2-session.md b/docs/examples/java/account/create-o-auth-2-session.md
new file mode 100644
index 0000000..4420859
--- /dev/null
+++ b/docs/examples/java/account/create-o-auth-2-session.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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.createOAuth2Session(
+ 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-o-auth-2-token.md b/docs/examples/java/account/create-o-auth-2-token.md
new file mode 100644
index 0000000..e5590c8
--- /dev/null
+++ b/docs/examples/java/account/create-o-auth-2-token.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(""); // 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-o-auth2session.md b/docs/examples/java/account/create-o-auth2session.md
deleted file mode 100644
index e4cfb8d..0000000
--- a/docs/examples/java/account/create-o-auth2session.md
+++ /dev/null
@@ -1,46 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Account account = new Account(client);
-
- account.createOAuth2Session(
- this,
- "amazon",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/account/create-phone-token.md b/docs/examples/java/account/create-phone-token.md
new file mode 100644
index 0000000..19d90b3
--- /dev/null
+++ b/docs/examples/java/account/create-phone-token.md
@@ -0,0 +1,23 @@
+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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.createPhoneToken(
+ "", // userId
+ "+12065550100", // phone
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/account/create-phone-verification.md b/docs/examples/java/account/create-phone-verification.md
new file mode 100644
index 0000000..8c16b6c
--- /dev/null
+++ b/docs/examples/java/account/create-phone-verification.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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.createPhoneVerification(new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+}));
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..d434a5c
--- /dev/null
+++ b/docs/examples/java/account/create-push-target.md
@@ -0,0 +1,24 @@
+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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.createPushTarget(
+ "", // targetId
+ "", // identifier
+ "", // providerId (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/account/create-recovery.md b/docs/examples/java/account/create-recovery.md
index 459213b..5592c6e 100644
--- a/docs/examples/java/account/create-recovery.md
+++ b/docs/examples/java/account/create-recovery.md
@@ -1,49 +1,23 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.createRecovery(
+ "email@example.com", // email
+ "https://example.com", // url
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
+ Log.d("Appwrite", result.toString());
+ })
+);
- account.createRecovery(
- "email@example.com",
- "https://example.com"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/account/create-session.md b/docs/examples/java/account/create-session.md
index 34dfca5..0c59a80 100644
--- a/docs/examples/java/account/create-session.md
+++ b/docs/examples/java/account/create-session.md
@@ -1,49 +1,23 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.createSession(
+ "", // userId
+ "", // secret
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
+ Log.d("Appwrite", result.toString());
+ })
+);
- account.createSession(
- "email@example.com",
- "password"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/account/create-verification.md b/docs/examples/java/account/create-verification.md
index b8b1c20..e91acc8 100644
--- a/docs/examples/java/account/create-verification.md
+++ b/docs/examples/java/account/create-verification.md
@@ -1,48 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.createVerification(
+ "https://example.com", // url
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
+ Log.d("Appwrite", result.toString());
+ })
+);
- account.createVerification(
- "https://example.com"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/account/create.md b/docs/examples/java/account/create.md
index 3ff5ab9..ad04805 100644
--- a/docs/examples/java/account/create.md
+++ b/docs/examples/java/account/create.md
@@ -1,49 +1,25 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.create(
+ "", // userId
+ "email@example.com", // email
+ "", // password
+ "", // name (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
+ Log.d("Appwrite", result.toString());
+ })
+);
- account.create(
- "email@example.com",
- "password",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/account/delete-identity.md b/docs/examples/java/account/delete-identity.md
new file mode 100644
index 0000000..d556722
--- /dev/null
+++ b/docs/examples/java/account/delete-identity.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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.deleteIdentity(
+ "", // identityId
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/account/delete-mfa-authenticator.md b/docs/examples/java/account/delete-mfa-authenticator.md
new file mode 100644
index 0000000..b5ff26c
--- /dev/null
+++ b/docs/examples/java/account/delete-mfa-authenticator.md
@@ -0,0 +1,23 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
+import io.appwrite.enums.AuthenticatorType;
+
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
+
+Account account = new Account(client);
+
+account.deleteMFAAuthenticator(
+ AuthenticatorType.TOTP, // type
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
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..00ab902
--- /dev/null
+++ b/docs/examples/java/account/delete-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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.deletePushTarget(
+ "", // targetId
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/account/delete-session.md b/docs/examples/java/account/delete-session.md
index b3549c7..99d2f8e 100644
--- a/docs/examples/java/account/delete-session.md
+++ b/docs/examples/java/account/delete-session.md
@@ -1,48 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.deleteSession(
+ "", // sessionId
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
+ Log.d("Appwrite", result.toString());
+ })
+);
- account.deleteSession(
- "[SESSION_ID]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/account/delete-sessions.md b/docs/examples/java/account/delete-sessions.md
index 153c323..e93f3e3 100644
--- a/docs/examples/java/account/delete-sessions.md
+++ b/docs/examples/java/account/delete-sessions.md
@@ -1,46 +1,18 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Account account = new Account(client);
-
- account.deleteSessions(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
+account.deleteSessions(new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
}
-}
\ No newline at end of file
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/account/delete.md b/docs/examples/java/account/delete.md
deleted file mode 100644
index aec96f1..0000000
--- a/docs/examples/java/account/delete.md
+++ /dev/null
@@ -1,46 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Account account = new Account(client);
-
- account.delete(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/account/get-logs.md b/docs/examples/java/account/get-logs.md
deleted file mode 100644
index f2dea96..0000000
--- a/docs/examples/java/account/get-logs.md
+++ /dev/null
@@ -1,46 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Account account = new Account(client);
-
- account.getLogs(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/account/get-mfa-recovery-codes.md b/docs/examples/java/account/get-mfa-recovery-codes.md
new file mode 100644
index 0000000..22bc1c1
--- /dev/null
+++ b/docs/examples/java/account/get-mfa-recovery-codes.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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.getMFARecoveryCodes(new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/account/get-prefs.md b/docs/examples/java/account/get-prefs.md
index 25ab6c3..5bb11a4 100644
--- a/docs/examples/java/account/get-prefs.md
+++ b/docs/examples/java/account/get-prefs.md
@@ -1,46 +1,18 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Account account = new Account(client);
-
- account.getPrefs(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
+account.getPrefs(new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
}
-}
\ No newline at end of file
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/account/get-session.md b/docs/examples/java/account/get-session.md
index 8d4c95a..288cd3b 100644
--- a/docs/examples/java/account/get-session.md
+++ b/docs/examples/java/account/get-session.md
@@ -1,48 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.getSession(
+ "", // sessionId
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
+ Log.d("Appwrite", result.toString());
+ })
+);
- account.getSession(
- "[SESSION_ID]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/account/get-sessions.md b/docs/examples/java/account/get-sessions.md
deleted file mode 100644
index 7afe852..0000000
--- a/docs/examples/java/account/get-sessions.md
+++ /dev/null
@@ -1,46 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Account account = new Account(client);
-
- account.getSessions(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/account/get.md b/docs/examples/java/account/get.md
index 146a5e5..6b5eb3b 100644
--- a/docs/examples/java/account/get.md
+++ b/docs/examples/java/account/get.md
@@ -1,46 +1,18 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Account account = new Account(client);
-
- account.get(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
+account.get(new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
}
-}
\ No newline at end of file
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/account/list-identities.md b/docs/examples/java/account/list-identities.md
new file mode 100644
index 0000000..d4a6f9f
--- /dev/null
+++ b/docs/examples/java/account/list-identities.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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.listIdentities(
+ listOf(), // queries (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/account/list-logs.md b/docs/examples/java/account/list-logs.md
new file mode 100644
index 0000000..951a479
--- /dev/null
+++ b/docs/examples/java/account/list-logs.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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.listLogs(
+ listOf(), // queries (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/account/list-mfa-factors.md b/docs/examples/java/account/list-mfa-factors.md
new file mode 100644
index 0000000..06f20e1
--- /dev/null
+++ b/docs/examples/java/account/list-mfa-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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.listMFAFactors(new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/account/list-sessions.md b/docs/examples/java/account/list-sessions.md
new file mode 100644
index 0000000..8946d96
--- /dev/null
+++ b/docs/examples/java/account/list-sessions.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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.listSessions(new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/account/update-email.md b/docs/examples/java/account/update-email.md
index 56a1bc0..ac80e45 100644
--- a/docs/examples/java/account/update-email.md
+++ b/docs/examples/java/account/update-email.md
@@ -1,49 +1,23 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.updateEmail(
+ "email@example.com", // email
+ "password", // password
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
+ Log.d("Appwrite", result.toString());
+ })
+);
- account.updateEmail(
- "email@example.com",
- "password"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index d0734e1..0000000
--- a/docs/examples/java/account/update-magic-u-r-l-session.md
+++ /dev/null
@@ -1,49 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Account account = new Account(client);
-
- account.updateMagicURLSession(
- "[USER_ID]",
- "[SECRET]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/account/update-magic-url-session.md b/docs/examples/java/account/update-magic-url-session.md
new file mode 100644
index 0000000..5893aa6
--- /dev/null
+++ b/docs/examples/java/account/update-magic-url-session.md
@@ -0,0 +1,23 @@
+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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.updateMagicURLSession(
+ "", // userId
+ "", // secret
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/account/update-mfa-authenticator.md b/docs/examples/java/account/update-mfa-authenticator.md
new file mode 100644
index 0000000..00ddd46
--- /dev/null
+++ b/docs/examples/java/account/update-mfa-authenticator.md
@@ -0,0 +1,24 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
+import io.appwrite.enums.AuthenticatorType;
+
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
+
+Account account = new Account(client);
+
+account.updateMFAAuthenticator(
+ AuthenticatorType.TOTP, // type
+ "", // otp
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/account/update-mfa-challenge.md b/docs/examples/java/account/update-mfa-challenge.md
new file mode 100644
index 0000000..10b5db4
--- /dev/null
+++ b/docs/examples/java/account/update-mfa-challenge.md
@@ -0,0 +1,23 @@
+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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.updateMFAChallenge(
+ "", // challengeId
+ "", // otp
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/account/update-mfa-recovery-codes.md b/docs/examples/java/account/update-mfa-recovery-codes.md
new file mode 100644
index 0000000..c0d6c69
--- /dev/null
+++ b/docs/examples/java/account/update-mfa-recovery-codes.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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.updateMFARecoveryCodes(new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/account/update-mfa.md b/docs/examples/java/account/update-mfa.md
new file mode 100644
index 0000000..b765cda
--- /dev/null
+++ b/docs/examples/java/account/update-mfa.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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.updateMFA(
+ false, // mfa
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/account/update-name.md b/docs/examples/java/account/update-name.md
index 9842a22..47582c2 100644
--- a/docs/examples/java/account/update-name.md
+++ b/docs/examples/java/account/update-name.md
@@ -1,48 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.updateName(
+ "", // name
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
+ Log.d("Appwrite", result.toString());
+ })
+);
- account.updateName(
- "[NAME]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/account/update-password.md b/docs/examples/java/account/update-password.md
index 468bdc2..09f572e 100644
--- a/docs/examples/java/account/update-password.md
+++ b/docs/examples/java/account/update-password.md
@@ -1,48 +1,23 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.updatePassword(
+ "", // password
+ "password", // oldPassword (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
+ Log.d("Appwrite", result.toString());
+ })
+);
- account.updatePassword(
- "password",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/account/update-phone-session.md b/docs/examples/java/account/update-phone-session.md
new file mode 100644
index 0000000..2e1b880
--- /dev/null
+++ b/docs/examples/java/account/update-phone-session.md
@@ -0,0 +1,23 @@
+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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.updatePhoneSession(
+ "", // userId
+ "", // secret
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/account/update-phone-verification.md b/docs/examples/java/account/update-phone-verification.md
new file mode 100644
index 0000000..f93ae69
--- /dev/null
+++ b/docs/examples/java/account/update-phone-verification.md
@@ -0,0 +1,23 @@
+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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.updatePhoneVerification(
+ "", // userId
+ "", // secret
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/account/update-phone.md b/docs/examples/java/account/update-phone.md
new file mode 100644
index 0000000..fae9bfa
--- /dev/null
+++ b/docs/examples/java/account/update-phone.md
@@ -0,0 +1,23 @@
+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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.updatePhone(
+ "+12065550100", // phone
+ "password", // password
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/account/update-prefs.md b/docs/examples/java/account/update-prefs.md
index 9f94b8f..f1a16c7 100644
--- a/docs/examples/java/account/update-prefs.md
+++ b/docs/examples/java/account/update-prefs.md
@@ -1,48 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.updatePrefs(
+ mapOf( "a" to "b" ), // prefs
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
+ Log.d("Appwrite", result.toString());
+ })
+);
- account.updatePrefs(
- mapOf( "a" to "b" )
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
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..197a909
--- /dev/null
+++ b/docs/examples/java/account/update-push-target.md
@@ -0,0 +1,23 @@
+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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.updatePushTarget(
+ "", // targetId
+ "", // identifier
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/account/update-recovery.md b/docs/examples/java/account/update-recovery.md
index bfcc89e..953bde4 100644
--- a/docs/examples/java/account/update-recovery.md
+++ b/docs/examples/java/account/update-recovery.md
@@ -1,51 +1,24 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.updateRecovery(
+ "", // userId
+ "", // secret
+ "", // password
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
+ Log.d("Appwrite", result.toString());
+ })
+);
- account.updateRecovery(
- "[USER_ID]",
- "[SECRET]",
- "password",
- "password"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/account/update-session.md b/docs/examples/java/account/update-session.md
new file mode 100644
index 0000000..ed82840
--- /dev/null
+++ b/docs/examples/java/account/update-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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.updateSession(
+ "", // sessionId
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/account/update-status.md b/docs/examples/java/account/update-status.md
new file mode 100644
index 0000000..9a283c0
--- /dev/null
+++ b/docs/examples/java/account/update-status.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(""); // Your project ID
+
+Account account = new Account(client);
+
+account.updateStatus(new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/account/update-verification.md b/docs/examples/java/account/update-verification.md
index 8cf8d67..caa3869 100644
--- a/docs/examples/java/account/update-verification.md
+++ b/docs/examples/java/account/update-verification.md
@@ -1,49 +1,23 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Account
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Account;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Account account = new Account(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+account.updateVerification(
+ "", // userId
+ "", // secret
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Account account = new Account(client);
+ Log.d("Appwrite", result.toString());
+ })
+);
- account.updateVerification(
- "[USER_ID]",
- "[SECRET]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/avatars/get-browser.md b/docs/examples/java/avatars/get-browser.md
index fa88749..1b6632f 100644
--- a/docs/examples/java/avatars/get-browser.md
+++ b/docs/examples/java/avatars/get-browser.md
@@ -1,48 +1,26 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Avatars
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Avatars;
+import io.appwrite.enums.Browser;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Avatars avatars = new Avatars(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+avatars.getBrowser(
+ Browser.AVANT_BROWSER, // code
+ 0, // width (optional)
+ 0, // height (optional)
+ -1, // quality (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Avatars avatars = new Avatars(client);
+ Log.d("Appwrite", result.toString());
+ })
+);
- avatars.getBrowser(
- "aa",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/avatars/get-credit-card.md b/docs/examples/java/avatars/get-credit-card.md
index 2ddda86..e2ac2c2 100644
--- a/docs/examples/java/avatars/get-credit-card.md
+++ b/docs/examples/java/avatars/get-credit-card.md
@@ -1,48 +1,26 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Avatars
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Avatars;
+import io.appwrite.enums.CreditCard;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Avatars avatars = new Avatars(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+avatars.getCreditCard(
+ CreditCard.AMERICAN_EXPRESS, // code
+ 0, // width (optional)
+ 0, // height (optional)
+ -1, // quality (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Avatars avatars = new Avatars(client);
+ Log.d("Appwrite", result.toString());
+ })
+);
- avatars.getCreditCard(
- "amex",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/avatars/get-favicon.md b/docs/examples/java/avatars/get-favicon.md
index 39c1432..70373a6 100644
--- a/docs/examples/java/avatars/get-favicon.md
+++ b/docs/examples/java/avatars/get-favicon.md
@@ -1,48 +1,22 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Avatars
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Avatars;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Avatars avatars = new Avatars(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+avatars.getFavicon(
+ "https://example.com", // url
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Avatars avatars = new Avatars(client);
+ Log.d("Appwrite", result.toString());
+ })
+);
- avatars.getFavicon(
- "https://example.com"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/avatars/get-flag.md b/docs/examples/java/avatars/get-flag.md
index 77bf3b1..689e27f 100644
--- a/docs/examples/java/avatars/get-flag.md
+++ b/docs/examples/java/avatars/get-flag.md
@@ -1,48 +1,26 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Avatars
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Avatars;
+import io.appwrite.enums.Flag;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Avatars avatars = new Avatars(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+avatars.getFlag(
+ Flag.AFGHANISTAN, // code
+ 0, // width (optional)
+ 0, // height (optional)
+ -1, // quality (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Avatars avatars = new Avatars(client);
+ Log.d("Appwrite", result.toString());
+ })
+);
- avatars.getFlag(
- "af",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/avatars/get-image.md b/docs/examples/java/avatars/get-image.md
index 69371da..71a90dd 100644
--- a/docs/examples/java/avatars/get-image.md
+++ b/docs/examples/java/avatars/get-image.md
@@ -1,48 +1,24 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Avatars
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Avatars;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Avatars avatars = new Avatars(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+avatars.getImage(
+ "https://example.com", // url
+ 0, // width (optional)
+ 0, // height (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Avatars avatars = new Avatars(client);
+ Log.d("Appwrite", result.toString());
+ })
+);
- avatars.getImage(
- "https://example.com",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/avatars/get-initials.md b/docs/examples/java/avatars/get-initials.md
index eea5669..ca16ee7 100644
--- a/docs/examples/java/avatars/get-initials.md
+++ b/docs/examples/java/avatars/get-initials.md
@@ -1,47 +1,25 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Avatars
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Avatars;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Avatars avatars = new Avatars(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+avatars.getInitials(
+ "", // name (optional)
+ 0, // width (optional)
+ 0, // height (optional)
+ "", // background (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Avatars avatars = new Avatars(client);
+ Log.d("Appwrite", result.toString());
+ })
+);
- avatars.getInitials(
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/avatars/get-q-r.md b/docs/examples/java/avatars/get-q-r.md
deleted file mode 100644
index e2c48cd..0000000
--- a/docs/examples/java/avatars/get-q-r.md
+++ /dev/null
@@ -1,48 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Avatars
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Avatars avatars = new Avatars(client);
-
- avatars.getQR(
- "[TEXT]",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/avatars/get-qr.md b/docs/examples/java/avatars/get-qr.md
new file mode 100644
index 0000000..781acf6
--- /dev/null
+++ b/docs/examples/java/avatars/get-qr.md
@@ -0,0 +1,25 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Avatars;
+
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
+
+Avatars avatars = new Avatars(client);
+
+avatars.getQR(
+ "", // text
+ 1, // size (optional)
+ 0, // margin (optional)
+ false, // download (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/database/create-document.md b/docs/examples/java/database/create-document.md
deleted file mode 100644
index b3a5b28..0000000
--- a/docs/examples/java/database/create-document.md
+++ /dev/null
@@ -1,49 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Database
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Database database = new Database(client);
-
- database.createDocument(
- "[COLLECTION_ID]",
- mapOf( "a" to "b" ),
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/database/delete-document.md b/docs/examples/java/database/delete-document.md
deleted file mode 100644
index 75877c4..0000000
--- a/docs/examples/java/database/delete-document.md
+++ /dev/null
@@ -1,49 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Database
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Database database = new Database(client);
-
- database.deleteDocument(
- "[COLLECTION_ID]",
- "[DOCUMENT_ID]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/database/get-document.md b/docs/examples/java/database/get-document.md
deleted file mode 100644
index 69aff1d..0000000
--- a/docs/examples/java/database/get-document.md
+++ /dev/null
@@ -1,49 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Database
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Database database = new Database(client);
-
- database.getDocument(
- "[COLLECTION_ID]",
- "[DOCUMENT_ID]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/database/list-documents.md b/docs/examples/java/database/list-documents.md
deleted file mode 100644
index 711aa41..0000000
--- a/docs/examples/java/database/list-documents.md
+++ /dev/null
@@ -1,48 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Database
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Database database = new Database(client);
-
- database.listDocuments(
- "[COLLECTION_ID]",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/database/update-document.md b/docs/examples/java/database/update-document.md
deleted file mode 100644
index a14c91f..0000000
--- a/docs/examples/java/database/update-document.md
+++ /dev/null
@@ -1,50 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Database
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Database database = new Database(client);
-
- database.updateDocument(
- "[COLLECTION_ID]",
- "[DOCUMENT_ID]",
- mapOf( "a" to "b" ),
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/databases/create-document.md b/docs/examples/java/databases/create-document.md
new file mode 100644
index 0000000..4804d75
--- /dev/null
+++ b/docs/examples/java/databases/create-document.md
@@ -0,0 +1,26 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
+
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
+
+Databases databases = new Databases(client);
+
+databases.createDocument(
+ "", // databaseId
+ "", // collectionId
+ "", // documentId
+ mapOf( "a" to "b" ), // data
+ listOf("read("any")"), // permissions (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/databases/decrement-document-attribute.md b/docs/examples/java/databases/decrement-document-attribute.md
new file mode 100644
index 0000000..de6a4ab
--- /dev/null
+++ b/docs/examples/java/databases/decrement-document-attribute.md
@@ -0,0 +1,27 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
+
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
+
+Databases databases = new Databases(client);
+
+databases.decrementDocumentAttribute(
+ "", // databaseId
+ "", // collectionId
+ "", // documentId
+ "", // attribute
+ 0, // value (optional)
+ 0, // min (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/databases/delete-document.md b/docs/examples/java/databases/delete-document.md
new file mode 100644
index 0000000..5288e53
--- /dev/null
+++ b/docs/examples/java/databases/delete-document.md
@@ -0,0 +1,24 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
+
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
+
+Databases databases = new Databases(client);
+
+databases.deleteDocument(
+ "", // databaseId
+ "", // collectionId
+ "", // documentId
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/databases/get-document.md b/docs/examples/java/databases/get-document.md
new file mode 100644
index 0000000..e7ae207
--- /dev/null
+++ b/docs/examples/java/databases/get-document.md
@@ -0,0 +1,25 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
+
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
+
+Databases databases = new Databases(client);
+
+databases.getDocument(
+ "", // databaseId
+ "", // collectionId
+ "", // documentId
+ listOf(), // queries (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/databases/increment-document-attribute.md b/docs/examples/java/databases/increment-document-attribute.md
new file mode 100644
index 0000000..94ffa9d
--- /dev/null
+++ b/docs/examples/java/databases/increment-document-attribute.md
@@ -0,0 +1,27 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
+
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
+
+Databases databases = new Databases(client);
+
+databases.incrementDocumentAttribute(
+ "", // databaseId
+ "", // collectionId
+ "", // documentId
+ "", // attribute
+ 0, // value (optional)
+ 0, // max (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/databases/list-documents.md b/docs/examples/java/databases/list-documents.md
new file mode 100644
index 0000000..606d677
--- /dev/null
+++ b/docs/examples/java/databases/list-documents.md
@@ -0,0 +1,24 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
+
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
+
+Databases databases = new Databases(client);
+
+databases.listDocuments(
+ "", // databaseId
+ "", // collectionId
+ listOf(), // queries (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/databases/update-document.md b/docs/examples/java/databases/update-document.md
new file mode 100644
index 0000000..baa827c
--- /dev/null
+++ b/docs/examples/java/databases/update-document.md
@@ -0,0 +1,26 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
+
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
+
+Databases databases = new Databases(client);
+
+databases.updateDocument(
+ "", // databaseId
+ "", // collectionId
+ "", // documentId
+ mapOf( "a" to "b" ), // data (optional)
+ listOf("read("any")"), // permissions (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/databases/upsert-document.md b/docs/examples/java/databases/upsert-document.md
new file mode 100644
index 0000000..868576b
--- /dev/null
+++ b/docs/examples/java/databases/upsert-document.md
@@ -0,0 +1,26 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
+
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
+
+Databases databases = new Databases(client);
+
+databases.upsertDocument(
+ "", // databaseId
+ "", // collectionId
+ "", // documentId
+ mapOf( "a" to "b" ), // data
+ listOf("read("any")"), // permissions (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/functions/create-execution.md b/docs/examples/java/functions/create-execution.md
index ea30fad..06c5027 100644
--- a/docs/examples/java/functions/create-execution.md
+++ b/docs/examples/java/functions/create-execution.md
@@ -1,48 +1,28 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Functions
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Functions;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Functions functions = new Functions(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+functions.createExecution(
+ "", // functionId
+ "", // body (optional)
+ false, // async (optional)
+ "", // path (optional)
+ ExecutionMethod.GET, // method (optional)
+ mapOf( "a" to "b" ), // headers (optional)
+ "", // scheduledAt (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Functions functions = new Functions(client);
+ Log.d("Appwrite", result.toString());
+ })
+);
- functions.createExecution(
- "[FUNCTION_ID]",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/functions/get-execution.md b/docs/examples/java/functions/get-execution.md
index 2f4e57e..f3195fa 100644
--- a/docs/examples/java/functions/get-execution.md
+++ b/docs/examples/java/functions/get-execution.md
@@ -1,49 +1,23 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Functions
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Functions;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Functions functions = new Functions(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+functions.getExecution(
+ "", // functionId
+ "", // executionId
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Functions functions = new Functions(client);
+ Log.d("Appwrite", result.toString());
+ })
+);
- functions.getExecution(
- "[FUNCTION_ID]",
- "[EXECUTION_ID]"
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/functions/list-executions.md b/docs/examples/java/functions/list-executions.md
index 68f767d..0270cf0 100644
--- a/docs/examples/java/functions/list-executions.md
+++ b/docs/examples/java/functions/list-executions.md
@@ -1,48 +1,23 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Functions
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Functions;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Functions functions = new Functions(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
+functions.listExecutions(
+ "", // functionId
+ listOf(), // queries (optional)
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
- Functions functions = new Functions(client);
+ Log.d("Appwrite", result.toString());
+ })
+);
- functions.listExecutions(
- "[FUNCTION_ID]",
- new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/graphql/mutation.md b/docs/examples/java/graphql/mutation.md
new file mode 100644
index 0000000..25f095e
--- /dev/null
+++ b/docs/examples/java/graphql/mutation.md
@@ -0,0 +1,22 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Graphql;
+
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
+
+Graphql graphql = new Graphql(client);
+
+graphql.mutation(
+ mapOf( "a" to "b" ), // query
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/graphql/query.md b/docs/examples/java/graphql/query.md
new file mode 100644
index 0000000..6b2a04d
--- /dev/null
+++ b/docs/examples/java/graphql/query.md
@@ -0,0 +1,22 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Graphql;
+
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
+
+Graphql graphql = new Graphql(client);
+
+graphql.query(
+ mapOf( "a" to "b" ), // query
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ Log.d("Appwrite", result.toString());
+ })
+);
+
diff --git a/docs/examples/java/locale/get-continents.md b/docs/examples/java/locale/get-continents.md
deleted file mode 100644
index e96a9fe..0000000
--- a/docs/examples/java/locale/get-continents.md
+++ /dev/null
@@ -1,46 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Locale locale = new Locale(client);
-
- locale.getContinents(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/locale/get-countries-e-u.md b/docs/examples/java/locale/get-countries-e-u.md
deleted file mode 100644
index ec478bc..0000000
--- a/docs/examples/java/locale/get-countries-e-u.md
+++ /dev/null
@@ -1,46 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Locale locale = new Locale(client);
-
- locale.getCountriesEU(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/locale/get-countries-phones.md b/docs/examples/java/locale/get-countries-phones.md
deleted file mode 100644
index 34368d2..0000000
--- a/docs/examples/java/locale/get-countries-phones.md
+++ /dev/null
@@ -1,46 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Locale locale = new Locale(client);
-
- locale.getCountriesPhones(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/locale/get-countries.md b/docs/examples/java/locale/get-countries.md
deleted file mode 100644
index f1c50fc..0000000
--- a/docs/examples/java/locale/get-countries.md
+++ /dev/null
@@ -1,46 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Locale locale = new Locale(client);
-
- locale.getCountries(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/locale/get-currencies.md b/docs/examples/java/locale/get-currencies.md
deleted file mode 100644
index 63af14b..0000000
--- a/docs/examples/java/locale/get-currencies.md
+++ /dev/null
@@ -1,46 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Locale locale = new Locale(client);
-
- locale.getCurrencies(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/locale/get-languages.md b/docs/examples/java/locale/get-languages.md
deleted file mode 100644
index 5952daa..0000000
--- a/docs/examples/java/locale/get-languages.md
+++ /dev/null
@@ -1,46 +0,0 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
-
-public class MainActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Locale locale = new Locale(client);
-
- locale.getLanguages(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
- }
-}
\ No newline at end of file
diff --git a/docs/examples/java/locale/get.md b/docs/examples/java/locale/get.md
index 417fc16..89e1e88 100644
--- a/docs/examples/java/locale/get.md
+++ b/docs/examples/java/locale/get.md
@@ -1,46 +1,18 @@
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import io.appwrite.Client
-import io.appwrite.services.Locale
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Locale;
-public class MainActivity extends AppCompatActivity {
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject(""); // Your project ID
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+Locale locale = new Locale(client);
- Client client = new Client(getApplicationContext())
- .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
- .setProject("5df5acd0d48c2"); // Your project ID
-
- Locale locale = new Locale(client);
-
- locale.get(new Continuation() {
- @NotNull
- @Override
- public CoroutineContext getContext() {
- return EmptyCoroutineContext.INSTANCE;
- }
-
- @Override
- public void resumeWith(@NotNull Object o) {
- String json = "";
- try {
- if (o instanceof Result.Failure) {
- Result.Failure failure = (Result.Failure) o;
- throw failure.exception;
- } else {
- Response response = (Response) o;
- json = response.body().string();
- }
- }
- } catch (Throwable th) {
- Log.e("ERROR", th.toString());
- }
- }
- });
+locale.get(new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
}
-}
\ No newline at end of file
+
+ Log.d("Appwrite", result.toString());
+}));
diff --git a/docs/examples/java/locale/list-codes.md b/docs/examples/java/locale/list-codes.md
new file mode 100644
index 0000000..85a96fc
--- /dev/null
+++ b/docs/examples/java/locale/list-codes.md
@@ -0,0 +1,18 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Locale;
+
+Client client = new Client(context)
+ .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
+ .setProject("