diff --git a/README.md b/README.md
index f3824c3..9ddec57 100644
--- a/README.md
+++ b/README.md
@@ -39,7 +39,7 @@ repositories {
Next, add the dependency to your project's `build.gradle(.kts)` file:
```groovy
-implementation("io.appwrite:sdk-for-kotlin:9.1.0")
+implementation("io.appwrite:sdk-for-kotlin:9.1.2")
```
### Maven
@@ -50,7 +50,7 @@ Add this to your project's `pom.xml` file:
io.appwrite
sdk-for-kotlin
- 9.1.0
+ 9.1.2
```
@@ -119,6 +119,7 @@ suspend fun main() {
The Appwrite Kotlin 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,
@@ -146,6 +147,60 @@ try {
}
```
+**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
diff --git a/docs/examples/java/functions/create-execution.md b/docs/examples/java/functions/create-execution.md
index 82d48fa..93efa0a 100644
--- a/docs/examples/java/functions/create-execution.md
+++ b/docs/examples/java/functions/create-execution.md
@@ -16,7 +16,7 @@ functions.createExecution(
"", // path (optional)
ExecutionMethod.GET, // method (optional)
mapOf( "a" to "b" ), // headers (optional)
- "", // scheduledAt (optional)
+ "", // scheduledAt (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/kotlin/functions/create-execution.md b/docs/examples/kotlin/functions/create-execution.md
index 94bfa23..2734412 100644
--- a/docs/examples/kotlin/functions/create-execution.md
+++ b/docs/examples/kotlin/functions/create-execution.md
@@ -16,5 +16,5 @@ val response = functions.createExecution(
path = "", // optional
method = "GET", // optional
headers = mapOf( "a" to "b" ), // optional
- scheduledAt = "" // optional
+ scheduledAt = "" // optional
)
diff --git a/scripts/publish.gradle b/scripts/publish.gradle
index cee6ff0..c8c5110 100644
--- a/scripts/publish.gradle
+++ b/scripts/publish.gradle
@@ -10,18 +10,6 @@ java {
}
publishing {
- repositories {
- maven {
- name = "sonatype"
- def releaseUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
- def snapshotUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
- url = version.endsWith('-SNAPSHOT') ? snapshotUrl : releaseUrl
- credentials {
- username = rootProject.ext["ossrhUsername"]
- password = rootProject.ext["ossrhPassword"]
- }
- }
- }
publications {
mavenJava(MavenPublication) {
from components.java
diff --git a/scripts/setup.gradle b/scripts/setup.gradle
index 6591e1f..cd94c1d 100644
--- a/scripts/setup.gradle
+++ b/scripts/setup.gradle
@@ -22,15 +22,15 @@ ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') ?: ext["signing.keyId"]
ext["signing.password"] = System.getenv('SIGNING_PASSWORD') ?: ext["signing.password"]
ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE') ?: ext["signing.secretKeyRingFile"]
-// Set up Sonatype repository
+// Set up Sonatype repository using OSSRH Staging API
nexusPublishing {
repositories {
sonatype {
stagingProfileId = sonatypeStagingProfileId
username = ossrhUsername
password = ossrhPassword
- nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
- snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
+ nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
+ snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
}
}
}
\ No newline at end of file
diff --git a/src/main/kotlin/io/appwrite/Client.kt b/src/main/kotlin/io/appwrite/Client.kt
index 429131e..68a45cb 100644
--- a/src/main/kotlin/io/appwrite/Client.kt
+++ b/src/main/kotlin/io/appwrite/Client.kt
@@ -58,11 +58,11 @@ class Client @JvmOverloads constructor(
init {
headers = mutableMapOf(
"content-type" to "application/json",
- "user-agent" to "AppwriteKotlinSDK/9.1.0 ${System.getProperty("http.agent")}",
+ "user-agent" to "AppwriteKotlinSDK/9.1.2 ${System.getProperty("http.agent")}",
"x-sdk-name" to "Kotlin",
"x-sdk-platform" to "server",
"x-sdk-language" to "kotlin",
- "x-sdk-version" to "9.1.0",
+ "x-sdk-version" to "9.1.2",
"x-appwrite-response-format" to "1.7.0",
)