diff --git a/LICENSE.md b/LICENSE.md
index 90528c4..47cfdfb 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -1,4 +1,4 @@
-Copyright (c) 2022 Appwrite (https://appwrite.io) and individual contributors.
+Copyright (c) 2023 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:
diff --git a/README.md b/README.md
index 277e7d6..a1cb66c 100644
--- a/README.md
+++ b/README.md
@@ -2,11 +2,11 @@


-
+
[](https://twitter.com/appwrite)
[](https://appwrite.io/discord)
-**This SDK is compatible with Appwrite server version 1.2.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-kotlin/releases).**
+**This SDK is compatible with Appwrite server version 1.3.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-kotlin/releases).**
> This is the Kotlin SDK for integrating with Appwrite from your Kotlin server-side code. If you're looking for the Android SDK you should check [appwrite/sdk-for-android](https://github.com/appwrite/sdk-for-android)
@@ -39,7 +39,7 @@ repositories {
Next, add the dependency to your project's `build.gradle(.kts)` file:
```groovy
-implementation("io.appwrite:sdk-for-kotlin:1.2.0")
+implementation("io.appwrite:sdk-for-kotlin:1.3.0")
```
### Maven
@@ -50,7 +50,7 @@ Add this to your project's `pom.xml` file:
io.appwrite
sdk-for-kotlin
- 1.2.0
+ 1.3.0
```
diff --git a/build.gradle b/build.gradle
index 658e8f0..181fbfb 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,5 +1,5 @@
plugins {
- id "org.jetbrains.kotlin.jvm" version '1.6.10'
+ id "org.jetbrains.kotlin.jvm" version '1.8.0'
id "java-library"
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
}
diff --git a/docs/examples/java/account/update-password.md b/docs/examples/java/account/update-password.md
index 03c5feb..d86eef3 100644
--- a/docs/examples/java/account/update-password.md
+++ b/docs/examples/java/account/update-password.md
@@ -10,7 +10,7 @@ Client client = new Client()
Account account = new Account(client);
account.updatePassword(
- "password",
+ "",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/databases/create-relationship-attribute.md b/docs/examples/java/databases/create-relationship-attribute.md
new file mode 100644
index 0000000..190d08a
--- /dev/null
+++ b/docs/examples/java/databases/create-relationship-attribute.md
@@ -0,0 +1,25 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
+
+Client client = new Client()
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
+
+Databases databases = new Databases(client);
+
+databases.createRelationshipAttribute(
+ "[DATABASE_ID]",
+ "[COLLECTION_ID]",
+ "[RELATED_COLLECTION_ID]",
+ "oneToOne",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ System.out.println(result);
+ })
+);
diff --git a/docs/examples/java/databases/get-document.md b/docs/examples/java/databases/get-document.md
index 5461088..ffc747f 100644
--- a/docs/examples/java/databases/get-document.md
+++ b/docs/examples/java/databases/get-document.md
@@ -12,7 +12,7 @@ Databases databases = new Databases(client);
databases.getDocument(
"[DATABASE_ID]",
"[COLLECTION_ID]",
- "[DOCUMENT_ID]"
+ "[DOCUMENT_ID]",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/databases/update-boolean-attribute.md b/docs/examples/java/databases/update-boolean-attribute.md
new file mode 100644
index 0000000..3cdd441
--- /dev/null
+++ b/docs/examples/java/databases/update-boolean-attribute.md
@@ -0,0 +1,26 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
+
+Client client = new Client()
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
+
+Databases databases = new Databases(client);
+
+databases.updateBooleanAttribute(
+ "[DATABASE_ID]",
+ "[COLLECTION_ID]",
+ "",
+ false,
+ false
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ System.out.println(result);
+ })
+);
diff --git a/docs/examples/java/databases/update-datetime-attribute.md b/docs/examples/java/databases/update-datetime-attribute.md
new file mode 100644
index 0000000..60bc7ab
--- /dev/null
+++ b/docs/examples/java/databases/update-datetime-attribute.md
@@ -0,0 +1,26 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
+
+Client client = new Client()
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
+
+Databases databases = new Databases(client);
+
+databases.updateDatetimeAttribute(
+ "[DATABASE_ID]",
+ "[COLLECTION_ID]",
+ "",
+ false,
+ ""
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ System.out.println(result);
+ })
+);
diff --git a/docs/examples/java/databases/update-email-attribute.md b/docs/examples/java/databases/update-email-attribute.md
new file mode 100644
index 0000000..36beb4f
--- /dev/null
+++ b/docs/examples/java/databases/update-email-attribute.md
@@ -0,0 +1,26 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
+
+Client client = new Client()
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
+
+Databases databases = new Databases(client);
+
+databases.updateEmailAttribute(
+ "[DATABASE_ID]",
+ "[COLLECTION_ID]",
+ "",
+ false,
+ "email@example.com"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ System.out.println(result);
+ })
+);
diff --git a/docs/examples/java/databases/update-enum-attribute.md b/docs/examples/java/databases/update-enum-attribute.md
new file mode 100644
index 0000000..230caf0
--- /dev/null
+++ b/docs/examples/java/databases/update-enum-attribute.md
@@ -0,0 +1,27 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
+
+Client client = new Client()
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
+
+Databases databases = new Databases(client);
+
+databases.updateEnumAttribute(
+ "[DATABASE_ID]",
+ "[COLLECTION_ID]",
+ "",
+ listOf(),
+ false,
+ "[DEFAULT]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ System.out.println(result);
+ })
+);
diff --git a/docs/examples/java/databases/update-float-attribute.md b/docs/examples/java/databases/update-float-attribute.md
new file mode 100644
index 0000000..413060f
--- /dev/null
+++ b/docs/examples/java/databases/update-float-attribute.md
@@ -0,0 +1,28 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
+
+Client client = new Client()
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
+
+Databases databases = new Databases(client);
+
+databases.updateFloatAttribute(
+ "[DATABASE_ID]",
+ "[COLLECTION_ID]",
+ "",
+ false,
+ 0,
+ 0,
+ 0
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ System.out.println(result);
+ })
+);
diff --git a/docs/examples/java/databases/update-integer-attribute.md b/docs/examples/java/databases/update-integer-attribute.md
new file mode 100644
index 0000000..986431a
--- /dev/null
+++ b/docs/examples/java/databases/update-integer-attribute.md
@@ -0,0 +1,28 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
+
+Client client = new Client()
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
+
+Databases databases = new Databases(client);
+
+databases.updateIntegerAttribute(
+ "[DATABASE_ID]",
+ "[COLLECTION_ID]",
+ "",
+ false,
+ 0,
+ 0,
+ 0
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ System.out.println(result);
+ })
+);
diff --git a/docs/examples/java/databases/update-ip-attribute.md b/docs/examples/java/databases/update-ip-attribute.md
new file mode 100644
index 0000000..42f7ae0
--- /dev/null
+++ b/docs/examples/java/databases/update-ip-attribute.md
@@ -0,0 +1,26 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
+
+Client client = new Client()
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
+
+Databases databases = new Databases(client);
+
+databases.updateIpAttribute(
+ "[DATABASE_ID]",
+ "[COLLECTION_ID]",
+ "",
+ false,
+ ""
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ System.out.println(result);
+ })
+);
diff --git a/docs/examples/java/databases/update-relationship-attribute.md b/docs/examples/java/databases/update-relationship-attribute.md
new file mode 100644
index 0000000..d2726f3
--- /dev/null
+++ b/docs/examples/java/databases/update-relationship-attribute.md
@@ -0,0 +1,24 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
+
+Client client = new Client()
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
+
+Databases databases = new Databases(client);
+
+databases.updateRelationshipAttribute(
+ "[DATABASE_ID]",
+ "[COLLECTION_ID]",
+ "",
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ System.out.println(result);
+ })
+);
diff --git a/docs/examples/java/databases/update-string-attribute.md b/docs/examples/java/databases/update-string-attribute.md
new file mode 100644
index 0000000..fd18847
--- /dev/null
+++ b/docs/examples/java/databases/update-string-attribute.md
@@ -0,0 +1,26 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
+
+Client client = new Client()
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
+
+Databases databases = new Databases(client);
+
+databases.updateStringAttribute(
+ "[DATABASE_ID]",
+ "[COLLECTION_ID]",
+ "",
+ false,
+ "[DEFAULT]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ System.out.println(result);
+ })
+);
diff --git a/docs/examples/java/databases/update-url-attribute.md b/docs/examples/java/databases/update-url-attribute.md
new file mode 100644
index 0000000..9a74490
--- /dev/null
+++ b/docs/examples/java/databases/update-url-attribute.md
@@ -0,0 +1,26 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Databases;
+
+Client client = new Client()
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
+
+Databases databases = new Databases(client);
+
+databases.updateUrlAttribute(
+ "[DATABASE_ID]",
+ "[COLLECTION_ID]",
+ "",
+ false,
+ "https://example.com"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ System.out.println(result);
+ })
+);
diff --git a/docs/examples/java/functions/create.md b/docs/examples/java/functions/create.md
index aac8c64..f0afd09 100644
--- a/docs/examples/java/functions/create.md
+++ b/docs/examples/java/functions/create.md
@@ -12,7 +12,6 @@ Functions functions = new Functions(client);
functions.create(
"[FUNCTION_ID]",
"[NAME]",
- listOf("any"),
"node-14.5",
new CoroutineCallback<>((result, error) -> {
if (error != null) {
diff --git a/docs/examples/java/functions/update.md b/docs/examples/java/functions/update.md
index 8157cbb..8889212 100644
--- a/docs/examples/java/functions/update.md
+++ b/docs/examples/java/functions/update.md
@@ -12,7 +12,6 @@ Functions functions = new Functions(client);
functions.update(
"[FUNCTION_ID]",
"[NAME]",
- listOf("any"),
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/teams/create-membership.md b/docs/examples/java/teams/create-membership.md
index f4afed4..c05030d 100644
--- a/docs/examples/java/teams/create-membership.md
+++ b/docs/examples/java/teams/create-membership.md
@@ -11,7 +11,6 @@ Teams teams = new Teams(client);
teams.createMembership(
"[TEAM_ID]",
- "email@example.com",
listOf(),
"https://example.com",
new CoroutineCallback<>((result, error) -> {
diff --git a/docs/examples/java/teams/get-prefs.md b/docs/examples/java/teams/get-prefs.md
new file mode 100644
index 0000000..44e28d4
--- /dev/null
+++ b/docs/examples/java/teams/get-prefs.md
@@ -0,0 +1,22 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Teams;
+
+Client client = new Client()
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token
+
+Teams teams = new Teams(client);
+
+teams.getPrefs(
+ "[TEAM_ID]"
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ System.out.println(result);
+ })
+);
diff --git a/docs/examples/java/teams/update.md b/docs/examples/java/teams/update-name.md
similarity index 97%
rename from docs/examples/java/teams/update.md
rename to docs/examples/java/teams/update-name.md
index b8ca109..65f18fc 100644
--- a/docs/examples/java/teams/update.md
+++ b/docs/examples/java/teams/update-name.md
@@ -9,7 +9,7 @@ Client client = new Client()
Teams teams = new Teams(client);
-teams.update(
+teams.updateName(
"[TEAM_ID]",
"[NAME]"
new CoroutineCallback<>((result, error) -> {
diff --git a/docs/examples/java/teams/update-prefs.md b/docs/examples/java/teams/update-prefs.md
new file mode 100644
index 0000000..dbdb11a
--- /dev/null
+++ b/docs/examples/java/teams/update-prefs.md
@@ -0,0 +1,23 @@
+import io.appwrite.Client;
+import io.appwrite.coroutines.CoroutineCallback;
+import io.appwrite.services.Teams;
+
+Client client = new Client()
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token
+
+Teams teams = new Teams(client);
+
+teams.updatePrefs(
+ "[TEAM_ID]",
+ mapOf( "a" to "b" )
+ new CoroutineCallback<>((result, error) -> {
+ if (error != null) {
+ error.printStackTrace();
+ return;
+ }
+
+ System.out.println(result);
+ })
+);
diff --git a/docs/examples/java/users/update-password.md b/docs/examples/java/users/update-password.md
index 6d6a9d3..c5d071f 100644
--- a/docs/examples/java/users/update-password.md
+++ b/docs/examples/java/users/update-password.md
@@ -11,7 +11,7 @@ Users users = new Users(client);
users.updatePassword(
"[USER_ID]",
- "password"
+ ""
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/kotlin/account/update-password.md b/docs/examples/kotlin/account/update-password.md
index 0b22998..ab5b63a 100644
--- a/docs/examples/kotlin/account/update-password.md
+++ b/docs/examples/kotlin/account/update-password.md
@@ -9,5 +9,5 @@ val client = Client(context)
val account = Account(client)
val response = account.updatePassword(
- password = "password",
+ password = "",
)
diff --git a/docs/examples/kotlin/databases/create-relationship-attribute.md b/docs/examples/kotlin/databases/create-relationship-attribute.md
new file mode 100644
index 0000000..a2102ec
--- /dev/null
+++ b/docs/examples/kotlin/databases/create-relationship-attribute.md
@@ -0,0 +1,16 @@
+import io.appwrite.Client
+import io.appwrite.services.Databases
+
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
+
+val databases = Databases(client)
+
+val response = databases.createRelationshipAttribute(
+ databaseId = "[DATABASE_ID]",
+ collectionId = "[COLLECTION_ID]",
+ relatedCollectionId = "[RELATED_COLLECTION_ID]",
+ type = "oneToOne",
+)
diff --git a/docs/examples/kotlin/databases/get-document.md b/docs/examples/kotlin/databases/get-document.md
index 8c3ce7c..05c6106 100644
--- a/docs/examples/kotlin/databases/get-document.md
+++ b/docs/examples/kotlin/databases/get-document.md
@@ -11,5 +11,5 @@ val databases = Databases(client)
val response = databases.getDocument(
databaseId = "[DATABASE_ID]",
collectionId = "[COLLECTION_ID]",
- documentId = "[DOCUMENT_ID]"
+ documentId = "[DOCUMENT_ID]",
)
diff --git a/docs/examples/kotlin/databases/update-boolean-attribute.md b/docs/examples/kotlin/databases/update-boolean-attribute.md
new file mode 100644
index 0000000..a30814a
--- /dev/null
+++ b/docs/examples/kotlin/databases/update-boolean-attribute.md
@@ -0,0 +1,17 @@
+import io.appwrite.Client
+import io.appwrite.services.Databases
+
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
+
+val databases = Databases(client)
+
+val response = databases.updateBooleanAttribute(
+ databaseId = "[DATABASE_ID]",
+ collectionId = "[COLLECTION_ID]",
+ key = "",
+ required = false,
+ default = false
+)
diff --git a/docs/examples/kotlin/databases/update-datetime-attribute.md b/docs/examples/kotlin/databases/update-datetime-attribute.md
new file mode 100644
index 0000000..c907e3c
--- /dev/null
+++ b/docs/examples/kotlin/databases/update-datetime-attribute.md
@@ -0,0 +1,17 @@
+import io.appwrite.Client
+import io.appwrite.services.Databases
+
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
+
+val databases = Databases(client)
+
+val response = databases.updateDatetimeAttribute(
+ databaseId = "[DATABASE_ID]",
+ collectionId = "[COLLECTION_ID]",
+ key = "",
+ required = false,
+ default = ""
+)
diff --git a/docs/examples/kotlin/databases/update-email-attribute.md b/docs/examples/kotlin/databases/update-email-attribute.md
new file mode 100644
index 0000000..6b8976d
--- /dev/null
+++ b/docs/examples/kotlin/databases/update-email-attribute.md
@@ -0,0 +1,17 @@
+import io.appwrite.Client
+import io.appwrite.services.Databases
+
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
+
+val databases = Databases(client)
+
+val response = databases.updateEmailAttribute(
+ databaseId = "[DATABASE_ID]",
+ collectionId = "[COLLECTION_ID]",
+ key = "",
+ required = false,
+ default = "email@example.com"
+)
diff --git a/docs/examples/kotlin/databases/update-enum-attribute.md b/docs/examples/kotlin/databases/update-enum-attribute.md
new file mode 100644
index 0000000..e46fde5
--- /dev/null
+++ b/docs/examples/kotlin/databases/update-enum-attribute.md
@@ -0,0 +1,18 @@
+import io.appwrite.Client
+import io.appwrite.services.Databases
+
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
+
+val databases = Databases(client)
+
+val response = databases.updateEnumAttribute(
+ databaseId = "[DATABASE_ID]",
+ collectionId = "[COLLECTION_ID]",
+ key = "",
+ elements = listOf(),
+ required = false,
+ default = "[DEFAULT]"
+)
diff --git a/docs/examples/kotlin/databases/update-float-attribute.md b/docs/examples/kotlin/databases/update-float-attribute.md
new file mode 100644
index 0000000..bb497f5
--- /dev/null
+++ b/docs/examples/kotlin/databases/update-float-attribute.md
@@ -0,0 +1,19 @@
+import io.appwrite.Client
+import io.appwrite.services.Databases
+
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
+
+val databases = Databases(client)
+
+val response = databases.updateFloatAttribute(
+ databaseId = "[DATABASE_ID]",
+ collectionId = "[COLLECTION_ID]",
+ key = "",
+ required = false,
+ min = 0,
+ max = 0,
+ default = 0
+)
diff --git a/docs/examples/kotlin/databases/update-integer-attribute.md b/docs/examples/kotlin/databases/update-integer-attribute.md
new file mode 100644
index 0000000..a37ab21
--- /dev/null
+++ b/docs/examples/kotlin/databases/update-integer-attribute.md
@@ -0,0 +1,19 @@
+import io.appwrite.Client
+import io.appwrite.services.Databases
+
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
+
+val databases = Databases(client)
+
+val response = databases.updateIntegerAttribute(
+ databaseId = "[DATABASE_ID]",
+ collectionId = "[COLLECTION_ID]",
+ key = "",
+ required = false,
+ min = 0,
+ max = 0,
+ default = 0
+)
diff --git a/docs/examples/kotlin/databases/update-ip-attribute.md b/docs/examples/kotlin/databases/update-ip-attribute.md
new file mode 100644
index 0000000..b54649e
--- /dev/null
+++ b/docs/examples/kotlin/databases/update-ip-attribute.md
@@ -0,0 +1,17 @@
+import io.appwrite.Client
+import io.appwrite.services.Databases
+
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
+
+val databases = Databases(client)
+
+val response = databases.updateIpAttribute(
+ databaseId = "[DATABASE_ID]",
+ collectionId = "[COLLECTION_ID]",
+ key = "",
+ required = false,
+ default = ""
+)
diff --git a/docs/examples/kotlin/databases/update-relationship-attribute.md b/docs/examples/kotlin/databases/update-relationship-attribute.md
new file mode 100644
index 0000000..38e353d
--- /dev/null
+++ b/docs/examples/kotlin/databases/update-relationship-attribute.md
@@ -0,0 +1,15 @@
+import io.appwrite.Client
+import io.appwrite.services.Databases
+
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
+
+val databases = Databases(client)
+
+val response = databases.updateRelationshipAttribute(
+ databaseId = "[DATABASE_ID]",
+ collectionId = "[COLLECTION_ID]",
+ key = "",
+)
diff --git a/docs/examples/kotlin/databases/update-string-attribute.md b/docs/examples/kotlin/databases/update-string-attribute.md
new file mode 100644
index 0000000..73889f8
--- /dev/null
+++ b/docs/examples/kotlin/databases/update-string-attribute.md
@@ -0,0 +1,17 @@
+import io.appwrite.Client
+import io.appwrite.services.Databases
+
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
+
+val databases = Databases(client)
+
+val response = databases.updateStringAttribute(
+ databaseId = "[DATABASE_ID]",
+ collectionId = "[COLLECTION_ID]",
+ key = "",
+ required = false,
+ default = "[DEFAULT]"
+)
diff --git a/docs/examples/kotlin/databases/update-url-attribute.md b/docs/examples/kotlin/databases/update-url-attribute.md
new file mode 100644
index 0000000..c053210
--- /dev/null
+++ b/docs/examples/kotlin/databases/update-url-attribute.md
@@ -0,0 +1,17 @@
+import io.appwrite.Client
+import io.appwrite.services.Databases
+
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
+
+val databases = Databases(client)
+
+val response = databases.updateUrlAttribute(
+ databaseId = "[DATABASE_ID]",
+ collectionId = "[COLLECTION_ID]",
+ key = "",
+ required = false,
+ default = "https://example.com"
+)
diff --git a/docs/examples/kotlin/functions/create.md b/docs/examples/kotlin/functions/create.md
index 9456721..e302dc7 100644
--- a/docs/examples/kotlin/functions/create.md
+++ b/docs/examples/kotlin/functions/create.md
@@ -11,6 +11,5 @@ val functions = Functions(client)
val response = functions.create(
functionId = "[FUNCTION_ID]",
name = "[NAME]",
- execute = listOf("any"),
runtime = "node-14.5",
)
diff --git a/docs/examples/kotlin/functions/update.md b/docs/examples/kotlin/functions/update.md
index ace7b68..3768665 100644
--- a/docs/examples/kotlin/functions/update.md
+++ b/docs/examples/kotlin/functions/update.md
@@ -11,5 +11,4 @@ val functions = Functions(client)
val response = functions.update(
functionId = "[FUNCTION_ID]",
name = "[NAME]",
- execute = listOf("any"),
)
diff --git a/docs/examples/kotlin/teams/create-membership.md b/docs/examples/kotlin/teams/create-membership.md
index 19432de..8cca697 100644
--- a/docs/examples/kotlin/teams/create-membership.md
+++ b/docs/examples/kotlin/teams/create-membership.md
@@ -10,7 +10,6 @@ val teams = Teams(client)
val response = teams.createMembership(
teamId = "[TEAM_ID]",
- email = "email@example.com",
roles = listOf(),
url = "https://example.com",
)
diff --git a/docs/examples/kotlin/teams/get-prefs.md b/docs/examples/kotlin/teams/get-prefs.md
new file mode 100644
index 0000000..0f8164c
--- /dev/null
+++ b/docs/examples/kotlin/teams/get-prefs.md
@@ -0,0 +1,13 @@
+import io.appwrite.Client
+import io.appwrite.services.Teams
+
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
+
+val teams = Teams(client)
+
+val response = teams.getPrefs(
+ teamId = "[TEAM_ID]"
+)
diff --git a/docs/examples/kotlin/teams/update.md b/docs/examples/kotlin/teams/update-name.md
similarity index 91%
rename from docs/examples/kotlin/teams/update.md
rename to docs/examples/kotlin/teams/update-name.md
index 50a315c..f237f38 100644
--- a/docs/examples/kotlin/teams/update.md
+++ b/docs/examples/kotlin/teams/update-name.md
@@ -8,7 +8,7 @@ val client = Client(context)
val teams = Teams(client)
-val response = teams.update(
+val response = teams.updateName(
teamId = "[TEAM_ID]",
name = "[NAME]"
)
diff --git a/docs/examples/kotlin/teams/update-prefs.md b/docs/examples/kotlin/teams/update-prefs.md
new file mode 100644
index 0000000..70b3e0c
--- /dev/null
+++ b/docs/examples/kotlin/teams/update-prefs.md
@@ -0,0 +1,14 @@
+import io.appwrite.Client
+import io.appwrite.services.Teams
+
+val client = Client(context)
+ .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
+ .setProject("5df5acd0d48c2") // Your project ID
+ .setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
+
+val teams = Teams(client)
+
+val response = teams.updatePrefs(
+ teamId = "[TEAM_ID]",
+ prefs = mapOf( "a" to "b" )
+)
diff --git a/docs/examples/kotlin/users/update-password.md b/docs/examples/kotlin/users/update-password.md
index b5e10a8..ba96188 100644
--- a/docs/examples/kotlin/users/update-password.md
+++ b/docs/examples/kotlin/users/update-password.md
@@ -10,5 +10,5 @@ val users = Users(client)
val response = users.updatePassword(
userId = "[USER_ID]",
- password = "password"
+ password = ""
)
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 4605298..60c76b3 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
\ 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 d9b1e33..54c81bd 100644
--- a/src/main/kotlin/io/appwrite/Client.kt
+++ b/src/main/kotlin/io/appwrite/Client.kt
@@ -65,7 +65,7 @@ class Client @JvmOverloads constructor(
"x-sdk-name" to "Kotlin",
"x-sdk-platform" to "server",
"x-sdk-language" to "kotlin",
- "x-sdk-version" to "1.2.0",
+ "x-sdk-version" to "1.3.0",
"x-appwrite-response-format" to "1.0.0"
)
config = mutableMapOf()
diff --git a/src/main/kotlin/io/appwrite/Query.kt b/src/main/kotlin/io/appwrite/Query.kt
index 2d33a02..ad1f3ed 100644
--- a/src/main/kotlin/io/appwrite/Query.kt
+++ b/src/main/kotlin/io/appwrite/Query.kt
@@ -16,6 +16,22 @@ class Query {
fun search(attribute: String, value: String) = Query.addQuery(attribute, "search", value)
+ fun isNull(attribute: String) = "isNull(\"${attribute}\")"
+
+ fun isNotNull(attribute: String) = "isNotNull(\"${attribute}\")"
+
+ fun between(attribute: String, start: Int, end: Int) = Query.addQuery(attribute, "between", listOf(start, end))
+
+ fun between(attribute: String, start: Double, end: Double) = Query.addQuery(attribute, "between", listOf(start, end))
+
+ fun between(attribute: String, start: String, end: String) = Query.addQuery(attribute, "between", listOf(start, end))
+
+ fun startsWith(attribute: String, value: String) = Query.addQuery(attribute, "startsWith", value)
+
+ fun endsWith(attribute: String, value: String) = Query.addQuery(attribute, "endsWith", value)
+
+ fun select(attributes: List) = "select([${attributes.joinToString(",") { "\"$it\"" }}])"
+
fun orderAsc(attribute: String) = "orderAsc(\"${attribute}\")"
fun orderDesc(attribute: String) = "orderDesc(\"${attribute}\")"
diff --git a/src/main/kotlin/io/appwrite/models/Account.kt b/src/main/kotlin/io/appwrite/models/Account.kt
deleted file mode 100644
index 1b87beb..0000000
--- a/src/main/kotlin/io/appwrite/models/Account.kt
+++ /dev/null
@@ -1,146 +0,0 @@
-package io.appwrite.models
-
-import com.google.gson.annotations.SerializedName
-import io.appwrite.extensions.jsonCast
-
-/**
- * Account
- */
-data class Account(
- /**
- * User ID.
- */
- @SerializedName("\$id")
- val id: String,
-
- /**
- * User creation date in ISO 8601 format.
- */
- @SerializedName("\$createdAt")
- val createdAt: String,
-
- /**
- * User update date in ISO 8601 format.
- */
- @SerializedName("\$updatedAt")
- val updatedAt: String,
-
- /**
- * User name.
- */
- @SerializedName("name")
- val name: String,
-
- /**
- * User registration date in ISO 8601 format.
- */
- @SerializedName("registration")
- val registration: String,
-
- /**
- * User status. Pass `true` for enabled and `false` for disabled.
- */
- @SerializedName("status")
- val status: Boolean,
-
- /**
- * Password update time in ISO 8601 format.
- */
- @SerializedName("passwordUpdate")
- val passwordUpdate: String,
-
- /**
- * User email address.
- */
- @SerializedName("email")
- val email: String,
-
- /**
- * User phone number in E.164 format.
- */
- @SerializedName("phone")
- val phone: String,
-
- /**
- * Email verification status.
- */
- @SerializedName("emailVerification")
- val emailVerification: Boolean,
-
- /**
- * Phone verification status.
- */
- @SerializedName("phoneVerification")
- val phoneVerification: Boolean,
-
- /**
- * User preferences as a key-value object
- */
- @SerializedName("prefs")
- val prefs: Preferences,
-
-) {
- fun toMap(): Map = mapOf(
- "\$id" to id as Any,
- "\$createdAt" to createdAt as Any,
- "\$updatedAt" to updatedAt as Any,
- "name" to name as Any,
- "registration" to registration as Any,
- "status" to status as Any,
- "passwordUpdate" to passwordUpdate as Any,
- "email" to email as Any,
- "phone" to phone as Any,
- "emailVerification" to emailVerification as Any,
- "phoneVerification" to phoneVerification as Any,
- "prefs" to prefs.toMap() as Any,
- )
-
- companion object {
- operator fun invoke(
- id: String,
- createdAt: String,
- updatedAt: String,
- name: String,
- registration: String,
- status: Boolean,
- passwordUpdate: String,
- email: String,
- phone: String,
- emailVerification: Boolean,
- phoneVerification: Boolean,
- prefs: Preferences