Skip to content

Commit 928d9ce

Browse files
committed
Add inc/dec
1 parent 3ea72af commit 928d9ce

20 files changed

+419
-24
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
![Maven Central](https://img.shields.io/maven-central/v/io.appwrite/sdk-for-kotlin.svg?color=green&style=flat-square)
44
![License](https://img.shields.io/github/license/appwrite/sdk-for-kotlin.svg?style=flat-square)
5-
![Version](https://img.shields.io/badge/api%20version-1.7.0-blue.svg?style=flat-square)
5+
![Version](https://img.shields.io/badge/api%20version-1.7.4-blue.svg?style=flat-square)
66
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
77
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
88

@@ -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.0.0")
42+
implementation("io.appwrite:sdk-for-kotlin:9.1.0")
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.0.0</version>
53+
<version>9.1.0</version>
5454
</dependency>
5555
</dependencies>
5656
```

docs/examples/java/databases/create-document.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import io.appwrite.services.Databases;
44

55
Client client = new Client()
66
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
7+
.setAdmin("") //
78
.setSession("") // The user session to authenticate with
89
.setKey("<YOUR_API_KEY>") // Your secret API key
910
.setJWT("<YOUR_JWT>"); // Your secret JSON Web Token
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import io.appwrite.Client;
2+
import io.appwrite.coroutines.CoroutineCallback;
3+
import io.appwrite.services.Databases;
4+
5+
Client client = new Client()
6+
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
7+
.setProject("<YOUR_PROJECT_ID>") // Your project ID
8+
.setKey("<YOUR_API_KEY>"); // Your secret API key
9+
10+
Databases databases = new Databases(client);
11+
12+
databases.decrementDocumentAttribute(
13+
"<DATABASE_ID>", // databaseId
14+
"<COLLECTION_ID>", // collectionId
15+
"<DOCUMENT_ID>", // documentId
16+
"", // attribute
17+
0, // value (optional)
18+
0, // min (optional)
19+
new CoroutineCallback<>((result, error) -> {
20+
if (error != null) {
21+
error.printStackTrace();
22+
return;
23+
}
24+
25+
System.out.println(result);
26+
})
27+
);
28+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import io.appwrite.Client;
2+
import io.appwrite.coroutines.CoroutineCallback;
3+
import io.appwrite.services.Databases;
4+
5+
Client client = new Client()
6+
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
7+
.setProject("<YOUR_PROJECT_ID>") // Your project ID
8+
.setKey("<YOUR_API_KEY>"); // Your secret API key
9+
10+
Databases databases = new Databases(client);
11+
12+
databases.incrementDocumentAttribute(
13+
"<DATABASE_ID>", // databaseId
14+
"<COLLECTION_ID>", // collectionId
15+
"<DOCUMENT_ID>", // documentId
16+
"", // attribute
17+
0, // value (optional)
18+
0, // max (optional)
19+
new CoroutineCallback<>((result, error) -> {
20+
if (error != null) {
21+
error.printStackTrace();
22+
return;
23+
}
24+
25+
System.out.println(result);
26+
})
27+
);
28+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import io.appwrite.Client;
2+
import io.appwrite.coroutines.CoroutineCallback;
3+
import io.appwrite.services.Databases;
4+
5+
Client client = new Client()
6+
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
7+
.setProject("<YOUR_PROJECT_ID>") // Your project ID
8+
.setSession(""); // The user session to authenticate with
9+
10+
Databases databases = new Databases(client);
11+
12+
databases.upsertDocument(
13+
"<DATABASE_ID>", // databaseId
14+
"<COLLECTION_ID>", // collectionId
15+
"<DOCUMENT_ID>", // documentId
16+
mapOf( "a" to "b" ), // data
17+
listOf("read("any")"), // permissions (optional)
18+
new CoroutineCallback<>((result, error) -> {
19+
if (error != null) {
20+
error.printStackTrace();
21+
return;
22+
}
23+
24+
System.out.println(result);
25+
})
26+
);
27+

docs/examples/java/databases/upsert-documents.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Databases databases = new Databases(client);
1212
databases.upsertDocuments(
1313
"<DATABASE_ID>", // databaseId
1414
"<COLLECTION_ID>", // collectionId
15-
listOf(), // documents (optional)
15+
listOf(), // documents
1616
new CoroutineCallback<>((result, error) -> {
1717
if (error != null) {
1818
error.printStackTrace();

docs/examples/kotlin/databases/create-document.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import io.appwrite.services.Databases
44

55
val client = Client()
66
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
7+
.setAdmin("") //
78
.setSession("") // The user session to authenticate with
89
.setKey("<YOUR_API_KEY>") // Your secret API key
910
.setJWT("<YOUR_JWT>") // Your secret JSON Web Token
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import io.appwrite.Client
2+
import io.appwrite.coroutines.CoroutineCallback
3+
import io.appwrite.services.Databases
4+
5+
val client = Client()
6+
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
7+
.setProject("<YOUR_PROJECT_ID>") // Your project ID
8+
.setKey("<YOUR_API_KEY>") // Your secret API key
9+
10+
val databases = Databases(client)
11+
12+
val response = databases.decrementDocumentAttribute(
13+
databaseId = "<DATABASE_ID>",
14+
collectionId = "<COLLECTION_ID>",
15+
documentId = "<DOCUMENT_ID>",
16+
attribute = "",
17+
value = 0, // optional
18+
min = 0 // optional
19+
)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import io.appwrite.Client
2+
import io.appwrite.coroutines.CoroutineCallback
3+
import io.appwrite.services.Databases
4+
5+
val client = Client()
6+
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
7+
.setProject("<YOUR_PROJECT_ID>") // Your project ID
8+
.setKey("<YOUR_API_KEY>") // Your secret API key
9+
10+
val databases = Databases(client)
11+
12+
val response = databases.incrementDocumentAttribute(
13+
databaseId = "<DATABASE_ID>",
14+
collectionId = "<COLLECTION_ID>",
15+
documentId = "<DOCUMENT_ID>",
16+
attribute = "",
17+
value = 0, // optional
18+
max = 0 // optional
19+
)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import io.appwrite.Client
2+
import io.appwrite.coroutines.CoroutineCallback
3+
import io.appwrite.services.Databases
4+
5+
val client = Client()
6+
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
7+
.setProject("<YOUR_PROJECT_ID>") // Your project ID
8+
.setSession("") // The user session to authenticate with
9+
10+
val databases = Databases(client)
11+
12+
val response = databases.upsertDocument(
13+
databaseId = "<DATABASE_ID>",
14+
collectionId = "<COLLECTION_ID>",
15+
documentId = "<DOCUMENT_ID>",
16+
data = mapOf( "a" to "b" ),
17+
permissions = listOf("read("any")") // optional
18+
)

0 commit comments

Comments
 (0)