Skip to content

Commit e276e04

Browse files
Merge pull request #52 from appwrite/dev
update maven deployment
2 parents 01db552 + 5404196 commit e276e04

File tree

6 files changed

+64
-21
lines changed

6 files changed

+64
-21
lines changed

README.md

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ repositories {
3939
Next, add the dependency to your project's `build.gradle(.kts)` file:
4040

4141
```groovy
42-
implementation("io.appwrite:sdk-for-kotlin:9.1.0")
42+
implementation("io.appwrite:sdk-for-kotlin:9.1.2")
4343
```
4444

4545
### Maven
@@ -50,7 +50,7 @@ Add this to your project's `pom.xml` file:
5050
<dependency>
5151
<groupId>io.appwrite</groupId>
5252
<artifactId>sdk-for-kotlin</artifactId>
53-
<version>9.1.0</version>
53+
<version>9.1.2</version>
5454
</dependency>
5555
</dependencies>
5656
```
@@ -119,6 +119,7 @@ suspend fun main() {
119119

120120
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.
121121

122+
**Kotlin:**
122123
```kotlin
123124
data class Book(
124125
val name: String,
@@ -146,6 +147,60 @@ try {
146147
}
147148
```
148149

150+
**Java:**
151+
```java
152+
public class Book {
153+
private String name;
154+
private String author;
155+
private String releaseYear;
156+
private String category;
157+
private List<String> genre;
158+
private boolean isCheckedOut;
159+
160+
// Constructor
161+
public Book(String name, String author, boolean isCheckedOut) {
162+
this.name = name;
163+
this.author = author;
164+
this.isCheckedOut = isCheckedOut;
165+
}
166+
167+
// Getters and setters
168+
public String getName() { return name; }
169+
public void setName(String name) { this.name = name; }
170+
171+
public String getAuthor() { return author; }
172+
public void setAuthor(String author) { this.author = author; }
173+
174+
public String getReleaseYear() { return releaseYear; }
175+
public void setReleaseYear(String releaseYear) { this.releaseYear = releaseYear; }
176+
177+
public String getCategory() { return category; }
178+
public void setCategory(String category) { this.category = category; }
179+
180+
public List<String> getGenre() { return genre; }
181+
public void setGenre(List<String> genre) { this.genre = genre; }
182+
183+
public boolean isCheckedOut() { return isCheckedOut; }
184+
public void setCheckedOut(boolean checkedOut) { isCheckedOut = checkedOut; }
185+
}
186+
187+
Databases databases = new Databases(client);
188+
189+
try {
190+
DocumentList<Book> documents = databases.listDocuments(
191+
"your-database-id",
192+
"your-collection-id",
193+
Book.class // Pass in your custom model type
194+
);
195+
196+
for (Book book : documents.getDocuments()) {
197+
Log.d("Appwrite", "Book: " + book.getName() + " by " + book.getAuthor()); // Now you have full type safety
198+
}
199+
} catch (AppwriteException e) {
200+
Log.e("Appwrite", e.getMessage() != null ? e.getMessage() : "Unknown error");
201+
}
202+
```
203+
149204
**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).
150205

151206
### Working with Model Methods

docs/examples/java/functions/create-execution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ functions.createExecution(
1616
"<PATH>", // path (optional)
1717
ExecutionMethod.GET, // method (optional)
1818
mapOf( "a" to "b" ), // headers (optional)
19-
"", // scheduledAt (optional)
19+
"<SCHEDULED_AT>", // scheduledAt (optional)
2020
new CoroutineCallback<>((result, error) -> {
2121
if (error != null) {
2222
error.printStackTrace();

docs/examples/kotlin/functions/create-execution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ val response = functions.createExecution(
1616
path = "<PATH>", // optional
1717
method = "GET", // optional
1818
headers = mapOf( "a" to "b" ), // optional
19-
scheduledAt = "" // optional
19+
scheduledAt = "<SCHEDULED_AT>" // optional
2020
)

scripts/publish.gradle

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,6 @@ java {
1010
}
1111

1212
publishing {
13-
repositories {
14-
maven {
15-
name = "sonatype"
16-
def releaseUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
17-
def snapshotUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
18-
url = version.endsWith('-SNAPSHOT') ? snapshotUrl : releaseUrl
19-
credentials {
20-
username = rootProject.ext["ossrhUsername"]
21-
password = rootProject.ext["ossrhPassword"]
22-
}
23-
}
24-
}
2513
publications {
2614
mavenJava(MavenPublication) {
2715
from components.java

scripts/setup.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') ?: ext["signing.keyId"]
2222
ext["signing.password"] = System.getenv('SIGNING_PASSWORD') ?: ext["signing.password"]
2323
ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE') ?: ext["signing.secretKeyRingFile"]
2424

25-
// Set up Sonatype repository
25+
// Set up Sonatype repository using OSSRH Staging API
2626
nexusPublishing {
2727
repositories {
2828
sonatype {
2929
stagingProfileId = sonatypeStagingProfileId
3030
username = ossrhUsername
3131
password = ossrhPassword
32-
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
33-
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
32+
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
33+
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
3434
}
3535
}
3636
}

src/main/kotlin/io/appwrite/Client.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ class Client @JvmOverloads constructor(
5858
init {
5959
headers = mutableMapOf(
6060
"content-type" to "application/json",
61-
"user-agent" to "AppwriteKotlinSDK/9.1.0 ${System.getProperty("http.agent")}",
61+
"user-agent" to "AppwriteKotlinSDK/9.1.2 ${System.getProperty("http.agent")}",
6262
"x-sdk-name" to "Kotlin",
6363
"x-sdk-platform" to "server",
6464
"x-sdk-language" to "kotlin",
65-
"x-sdk-version" to "9.1.0",
65+
"x-sdk-version" to "9.1.2",
6666
"x-appwrite-response-format" to "1.7.0",
6767
)
6868

0 commit comments

Comments
 (0)