diff --git a/CHANGELOG.md b/CHANGELOG.md
index 07e9d96..a850801 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
# Change Log
+## 13.1.0
+
+* Added ability to create columns and indexes synchronously while creating a table
+
## 13.0.0
* Rename `VCSDeploymentType` enum to `VCSReferenceType`
diff --git a/README.md b/README.md
index da881e0..7dfd904 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:13.0.0")
+implementation("io.appwrite:sdk-for-kotlin:13.1.0")
```
### Maven
@@ -50,7 +50,7 @@ Add this to your project's `pom.xml` file:
io.appwrite
sdk-for-kotlin
- 13.0.0
+ 13.1.0
```
diff --git a/docs/examples/java/account/create-anonymous-session.md b/docs/examples/java/account/create-anonymous-session.md
index d65c20a..07e4f38 100644
--- a/docs/examples/java/account/create-anonymous-session.md
+++ b/docs/examples/java/account/create-anonymous-session.md
@@ -4,7 +4,8 @@ import io.appwrite.services.Account;
Client client = new Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
- .setProject(""); // Your project ID
+ .setProject("") // Your project ID
+ .setSession(""); // The user session to authenticate with
Account account = new Account(client);
diff --git a/docs/examples/java/account/create-email-password-session.md b/docs/examples/java/account/create-email-password-session.md
index 6339310..aaf282e 100644
--- a/docs/examples/java/account/create-email-password-session.md
+++ b/docs/examples/java/account/create-email-password-session.md
@@ -4,7 +4,8 @@ import io.appwrite.services.Account;
Client client = new Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
- .setProject(""); // Your project ID
+ .setProject("") // Your project ID
+ .setSession(""); // The user session to authenticate with
Account account = new Account(client);
diff --git a/docs/examples/java/account/create-email-token.md b/docs/examples/java/account/create-email-token.md
index 7a6a0d7..940f8d6 100644
--- a/docs/examples/java/account/create-email-token.md
+++ b/docs/examples/java/account/create-email-token.md
@@ -4,7 +4,8 @@ import io.appwrite.services.Account;
Client client = new Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
- .setProject(""); // Your project ID
+ .setProject("") // Your project ID
+ .setSession(""); // The user session to authenticate with
Account account = new Account(client);
diff --git a/docs/examples/java/account/create-jwt.md b/docs/examples/java/account/create-jwt.md
index 3756ede..5930854 100644
--- a/docs/examples/java/account/create-jwt.md
+++ b/docs/examples/java/account/create-jwt.md
@@ -4,7 +4,8 @@ import io.appwrite.services.Account;
Client client = new Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
- .setProject(""); // Your project ID
+ .setProject("") // Your project ID
+ .setSession(""); // The user session to authenticate with
Account account = new Account(client);
diff --git a/docs/examples/java/account/create-magic-url-token.md b/docs/examples/java/account/create-magic-url-token.md
index df021f9..bb4cc7a 100644
--- a/docs/examples/java/account/create-magic-url-token.md
+++ b/docs/examples/java/account/create-magic-url-token.md
@@ -4,7 +4,8 @@ import io.appwrite.services.Account;
Client client = new Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
- .setProject(""); // Your project ID
+ .setProject("") // Your project ID
+ .setSession(""); // The user session to authenticate with
Account account = new Account(client);
diff --git a/docs/examples/java/account/create-mfa-challenge.md b/docs/examples/java/account/create-mfa-challenge.md
index 5c048cb..0463633 100644
--- a/docs/examples/java/account/create-mfa-challenge.md
+++ b/docs/examples/java/account/create-mfa-challenge.md
@@ -5,7 +5,8 @@ import io.appwrite.enums.AuthenticationFactor;
Client client = new Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
- .setProject(""); // Your project ID
+ .setProject("") // Your project ID
+ .setSession(""); // The user session to authenticate with
Account account = new Account(client);
diff --git a/docs/examples/java/account/create-o-auth-2-token.md b/docs/examples/java/account/create-o-auth-2-token.md
index 376d943..3af15e0 100644
--- a/docs/examples/java/account/create-o-auth-2-token.md
+++ b/docs/examples/java/account/create-o-auth-2-token.md
@@ -5,7 +5,8 @@ import io.appwrite.enums.OAuthProvider;
Client client = new Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
- .setProject(""); // Your project ID
+ .setProject("") // Your project ID
+ .setSession(""); // The user session to authenticate with
Account account = new Account(client);
diff --git a/docs/examples/java/account/create-phone-token.md b/docs/examples/java/account/create-phone-token.md
index 14fb812..cdec5d5 100644
--- a/docs/examples/java/account/create-phone-token.md
+++ b/docs/examples/java/account/create-phone-token.md
@@ -4,7 +4,8 @@ import io.appwrite.services.Account;
Client client = new Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
- .setProject(""); // Your project ID
+ .setProject("") // Your project ID
+ .setSession(""); // The user session to authenticate with
Account account = new Account(client);
diff --git a/docs/examples/java/account/create-session.md b/docs/examples/java/account/create-session.md
index 5bcdf99..2950164 100644
--- a/docs/examples/java/account/create-session.md
+++ b/docs/examples/java/account/create-session.md
@@ -4,7 +4,8 @@ import io.appwrite.services.Account;
Client client = new Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
- .setProject(""); // Your project ID
+ .setProject("") // Your project ID
+ .setSession(""); // The user session to authenticate with
Account account = new Account(client);
diff --git a/docs/examples/java/account/create.md b/docs/examples/java/account/create.md
index d24bfb8..b7bd821 100644
--- a/docs/examples/java/account/create.md
+++ b/docs/examples/java/account/create.md
@@ -4,7 +4,8 @@ import io.appwrite.services.Account;
Client client = new Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
- .setProject(""); // Your project ID
+ .setProject("") // Your project ID
+ .setSession(""); // The user session to authenticate with
Account account = new Account(client);
diff --git a/docs/examples/java/account/update-magic-url-session.md b/docs/examples/java/account/update-magic-url-session.md
index b4735f4..3e23634 100644
--- a/docs/examples/java/account/update-magic-url-session.md
+++ b/docs/examples/java/account/update-magic-url-session.md
@@ -4,7 +4,8 @@ import io.appwrite.services.Account;
Client client = new Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
- .setProject(""); // Your project ID
+ .setProject("") // Your project ID
+ .setSession(""); // The user session to authenticate with
Account account = new Account(client);
diff --git a/docs/examples/java/account/update-phone-session.md b/docs/examples/java/account/update-phone-session.md
index cbfdca5..97d7cd3 100644
--- a/docs/examples/java/account/update-phone-session.md
+++ b/docs/examples/java/account/update-phone-session.md
@@ -4,7 +4,8 @@ import io.appwrite.services.Account;
Client client = new Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
- .setProject(""); // Your project ID
+ .setProject("") // Your project ID
+ .setSession(""); // The user session to authenticate with
Account account = new Account(client);
diff --git a/docs/examples/java/databases/create-collection.md b/docs/examples/java/databases/create-collection.md
index eea5555..083e370 100644
--- a/docs/examples/java/databases/create-collection.md
+++ b/docs/examples/java/databases/create-collection.md
@@ -18,6 +18,8 @@ databases.createCollection(
List.of(Permission.read(Role.any())), // permissions (optional)
false, // documentSecurity (optional)
false, // enabled (optional)
+ List.of(), // attributes (optional)
+ List.of(), // indexes (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/java/tablesdb/create-table.md b/docs/examples/java/tablesdb/create-table.md
index 615278a..80ae1a3 100644
--- a/docs/examples/java/tablesdb/create-table.md
+++ b/docs/examples/java/tablesdb/create-table.md
@@ -18,6 +18,8 @@ tablesDB.createTable(
List.of(Permission.read(Role.any())), // permissions (optional)
false, // rowSecurity (optional)
false, // enabled (optional)
+ List.of(), // columns (optional)
+ List.of(), // indexes (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
diff --git a/docs/examples/kotlin/account/create-anonymous-session.md b/docs/examples/kotlin/account/create-anonymous-session.md
index 0ddc383..8f35c63 100644
--- a/docs/examples/kotlin/account/create-anonymous-session.md
+++ b/docs/examples/kotlin/account/create-anonymous-session.md
@@ -5,6 +5,7 @@ import io.appwrite.services.Account
val client = Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("") // Your project ID
+ .setSession("") // The user session to authenticate with
val account = Account(client)
diff --git a/docs/examples/kotlin/account/create-email-password-session.md b/docs/examples/kotlin/account/create-email-password-session.md
index 9c7af95..55add0b 100644
--- a/docs/examples/kotlin/account/create-email-password-session.md
+++ b/docs/examples/kotlin/account/create-email-password-session.md
@@ -5,6 +5,7 @@ import io.appwrite.services.Account
val client = Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("") // Your project ID
+ .setSession("") // The user session to authenticate with
val account = Account(client)
diff --git a/docs/examples/kotlin/account/create-email-token.md b/docs/examples/kotlin/account/create-email-token.md
index 84acd78..416163a 100644
--- a/docs/examples/kotlin/account/create-email-token.md
+++ b/docs/examples/kotlin/account/create-email-token.md
@@ -5,6 +5,7 @@ import io.appwrite.services.Account
val client = Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("") // Your project ID
+ .setSession("") // The user session to authenticate with
val account = Account(client)
diff --git a/docs/examples/kotlin/account/create-jwt.md b/docs/examples/kotlin/account/create-jwt.md
index 4c04aa1..2691a4c 100644
--- a/docs/examples/kotlin/account/create-jwt.md
+++ b/docs/examples/kotlin/account/create-jwt.md
@@ -5,6 +5,7 @@ import io.appwrite.services.Account
val client = Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("") // Your project ID
+ .setSession("") // The user session to authenticate with
val account = Account(client)
diff --git a/docs/examples/kotlin/account/create-magic-url-token.md b/docs/examples/kotlin/account/create-magic-url-token.md
index c1d8cba..185ee6b 100644
--- a/docs/examples/kotlin/account/create-magic-url-token.md
+++ b/docs/examples/kotlin/account/create-magic-url-token.md
@@ -5,6 +5,7 @@ import io.appwrite.services.Account
val client = Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("") // Your project ID
+ .setSession("") // The user session to authenticate with
val account = Account(client)
diff --git a/docs/examples/kotlin/account/create-mfa-challenge.md b/docs/examples/kotlin/account/create-mfa-challenge.md
index 7213142..3dbe1bf 100644
--- a/docs/examples/kotlin/account/create-mfa-challenge.md
+++ b/docs/examples/kotlin/account/create-mfa-challenge.md
@@ -6,6 +6,7 @@ import io.appwrite.enums.AuthenticationFactor
val client = Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("") // Your project ID
+ .setSession("") // The user session to authenticate with
val account = Account(client)
diff --git a/docs/examples/kotlin/account/create-o-auth-2-token.md b/docs/examples/kotlin/account/create-o-auth-2-token.md
index 1a8c118..e1391db 100644
--- a/docs/examples/kotlin/account/create-o-auth-2-token.md
+++ b/docs/examples/kotlin/account/create-o-auth-2-token.md
@@ -6,6 +6,7 @@ import io.appwrite.enums.OAuthProvider
val client = Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("") // Your project ID
+ .setSession("") // The user session to authenticate with
val account = Account(client)
diff --git a/docs/examples/kotlin/account/create-phone-token.md b/docs/examples/kotlin/account/create-phone-token.md
index be03e06..1d44bfa 100644
--- a/docs/examples/kotlin/account/create-phone-token.md
+++ b/docs/examples/kotlin/account/create-phone-token.md
@@ -5,6 +5,7 @@ import io.appwrite.services.Account
val client = Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("") // Your project ID
+ .setSession("") // The user session to authenticate with
val account = Account(client)
diff --git a/docs/examples/kotlin/account/create-session.md b/docs/examples/kotlin/account/create-session.md
index 5afb219..07a3cd4 100644
--- a/docs/examples/kotlin/account/create-session.md
+++ b/docs/examples/kotlin/account/create-session.md
@@ -5,6 +5,7 @@ import io.appwrite.services.Account
val client = Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("") // Your project ID
+ .setSession("") // The user session to authenticate with
val account = Account(client)
diff --git a/docs/examples/kotlin/account/create.md b/docs/examples/kotlin/account/create.md
index 80640ba..1b5742c 100644
--- a/docs/examples/kotlin/account/create.md
+++ b/docs/examples/kotlin/account/create.md
@@ -5,6 +5,7 @@ import io.appwrite.services.Account
val client = Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("") // Your project ID
+ .setSession("") // The user session to authenticate with
val account = Account(client)
diff --git a/docs/examples/kotlin/account/update-magic-url-session.md b/docs/examples/kotlin/account/update-magic-url-session.md
index d4fe7f4..33a4b4f 100644
--- a/docs/examples/kotlin/account/update-magic-url-session.md
+++ b/docs/examples/kotlin/account/update-magic-url-session.md
@@ -5,6 +5,7 @@ import io.appwrite.services.Account
val client = Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("") // Your project ID
+ .setSession("") // The user session to authenticate with
val account = Account(client)
diff --git a/docs/examples/kotlin/account/update-phone-session.md b/docs/examples/kotlin/account/update-phone-session.md
index 1bcc4c0..346a25b 100644
--- a/docs/examples/kotlin/account/update-phone-session.md
+++ b/docs/examples/kotlin/account/update-phone-session.md
@@ -5,6 +5,7 @@ import io.appwrite.services.Account
val client = Client()
.setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("") // Your project ID
+ .setSession("") // The user session to authenticate with
val account = Account(client)
diff --git a/docs/examples/kotlin/avatars/get-screenshot.md b/docs/examples/kotlin/avatars/get-screenshot.md
index a2de2e5..040964f 100644
--- a/docs/examples/kotlin/avatars/get-screenshot.md
+++ b/docs/examples/kotlin/avatars/get-screenshot.md
@@ -25,7 +25,7 @@ val result = avatars.getScreenshot(
userAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15", // optional
fullpage = true, // optional
locale = "en-US", // optional
- timezone = "America/New_York", // optional
+ timezone = "america/new_york", // optional
latitude = 37.7749, // optional
longitude = -122.4194, // optional
accuracy = 100, // optional
diff --git a/docs/examples/kotlin/databases/create-collection.md b/docs/examples/kotlin/databases/create-collection.md
index 43031b4..1166e73 100644
--- a/docs/examples/kotlin/databases/create-collection.md
+++ b/docs/examples/kotlin/databases/create-collection.md
@@ -17,5 +17,7 @@ val response = databases.createCollection(
name = "",
permissions = listOf(Permission.read(Role.any())), // optional
documentSecurity = false, // optional
- enabled = false // optional
+ enabled = false, // optional
+ attributes = listOf(), // optional
+ indexes = listOf() // optional
)
diff --git a/docs/examples/kotlin/tablesdb/create-table.md b/docs/examples/kotlin/tablesdb/create-table.md
index 5ff2ba4..81e4830 100644
--- a/docs/examples/kotlin/tablesdb/create-table.md
+++ b/docs/examples/kotlin/tablesdb/create-table.md
@@ -17,5 +17,7 @@ val response = tablesDB.createTable(
name = "",
permissions = listOf(Permission.read(Role.any())), // optional
rowSecurity = false, // optional
- enabled = false // optional
+ enabled = false, // optional
+ columns = listOf(), // optional
+ indexes = listOf() // optional
)
diff --git a/src/main/kotlin/io/appwrite/Client.kt b/src/main/kotlin/io/appwrite/Client.kt
index d300554..30b9396 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/13.0.0 ${System.getProperty("http.agent")}",
+ "user-agent" to "AppwriteKotlinSDK/13.1.0 ${System.getProperty("http.agent")}",
"x-sdk-name" to "Kotlin",
"x-sdk-platform" to "server",
"x-sdk-language" to "kotlin",
- "x-sdk-version" to "13.0.0",
+ "x-sdk-version" to "13.1.0",
"x-appwrite-response-format" to "1.8.0",
)
diff --git a/src/main/kotlin/io/appwrite/services/Databases.kt b/src/main/kotlin/io/appwrite/services/Databases.kt
index 097dec7..197b995 100644
--- a/src/main/kotlin/io/appwrite/services/Databases.kt
+++ b/src/main/kotlin/io/appwrite/services/Databases.kt
@@ -450,6 +450,8 @@ class Databases(client: Client) : Service(client) {
* @param permissions An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param documentSecurity Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.
+ * @param attributes Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, integer, float, boolean, datetime), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options.
+ * @param indexes Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional).
* @return [io.appwrite.models.Collection]
*/
@Deprecated(
@@ -465,6 +467,8 @@ class Databases(client: Client) : Service(client) {
permissions: List? = null,
documentSecurity: Boolean? = null,
enabled: Boolean? = null,
+ attributes: List? = null,
+ indexes: List? = null,
): io.appwrite.models.Collection {
val apiPath = "/databases/{databaseId}/collections"
.replace("{databaseId}", databaseId)
@@ -475,6 +479,8 @@ class Databases(client: Client) : Service(client) {
"permissions" to permissions,
"documentSecurity" to documentSecurity,
"enabled" to enabled,
+ "attributes" to attributes,
+ "indexes" to indexes,
)
val apiHeaders = mutableMapOf(
"content-type" to "application/json",
diff --git a/src/main/kotlin/io/appwrite/services/TablesDB.kt b/src/main/kotlin/io/appwrite/services/TablesDB.kt
index 986ac74..0dc896a 100644
--- a/src/main/kotlin/io/appwrite/services/TablesDB.kt
+++ b/src/main/kotlin/io/appwrite/services/TablesDB.kt
@@ -426,6 +426,8 @@ class TablesDB(client: Client) : Service(client) {
* @param permissions An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param rowSecurity Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param enabled Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled.
+ * @param columns Array of column definitions to create. Each column should contain: key (string), type (string: string, integer, float, boolean, datetime, relationship), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options.
+ * @param indexes Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of column keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional).
* @return [io.appwrite.models.Table]
*/
@JvmOverloads
@@ -437,6 +439,8 @@ class TablesDB(client: Client) : Service(client) {
permissions: List? = null,
rowSecurity: Boolean? = null,
enabled: Boolean? = null,
+ columns: List? = null,
+ indexes: List? = null,
): io.appwrite.models.Table {
val apiPath = "/tablesdb/{databaseId}/tables"
.replace("{databaseId}", databaseId)
@@ -447,6 +451,8 @@ class TablesDB(client: Client) : Service(client) {
"permissions" to permissions,
"rowSecurity" to rowSecurity,
"enabled" to enabled,
+ "columns" to columns,
+ "indexes" to indexes,
)
val apiHeaders = mutableMapOf(
"content-type" to "application/json",