Add array-based enum parameters

This commit is contained in:
root
2026-02-02 12:08:30 +00:00
parent 2c21d8d117
commit 19bed88494
96 changed files with 607 additions and 164 deletions
+4
View File
@@ -1,5 +1,9 @@
# Change Log # Change Log
## 14.0.0
* Add array-based enum parameters (e.g., `permissions: List<BrowserPermission>`).
## 13.1.0 ## 13.1.0
* Added ability to create columns and indexes synchronously while creating a table * Added ability to create columns and indexes synchronously while creating a table
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors. Copyright (c) 2026 Appwrite (https://appwrite.io) and individual contributors.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+4 -4
View File
@@ -2,7 +2,7 @@
![Maven Central](https://img.shields.io/maven-central/v/io.appwrite/sdk-for-kotlin.svg?color=green&style=flat-square) ![Maven Central](https://img.shields.io/maven-central/v/io.appwrite/sdk-for-kotlin.svg?color=green&style=flat-square)
![License](https://img.shields.io/github/license/appwrite/sdk-for-kotlin.svg?style=flat-square) ![License](https://img.shields.io/github/license/appwrite/sdk-for-kotlin.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.8.0-blue.svg?style=flat-square) ![Version](https://img.shields.io/badge/api%20version-1.8.1-blue.svg?style=flat-square)
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
@@ -10,7 +10,7 @@
> 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) > 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)
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Kotlin SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Kotlin SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
![Appwrite](https://github.com/appwrite/appwrite/raw/main/public/images/github.png) ![Appwrite](https://github.com/appwrite/appwrite/raw/main/public/images/github.png)
@@ -39,7 +39,7 @@ repositories {
Next, add the dependency to your project's `build.gradle(.kts)` file: Next, add the dependency to your project's `build.gradle(.kts)` file:
```groovy ```groovy
implementation("io.appwrite:sdk-for-kotlin:13.1.0") implementation("io.appwrite:sdk-for-kotlin:14.0.0")
``` ```
### Maven ### Maven
@@ -50,7 +50,7 @@ Add this to your project's `pom.xml` file:
<dependency> <dependency>
<groupId>io.appwrite</groupId> <groupId>io.appwrite</groupId>
<artifactId>sdk-for-kotlin</artifactId> <artifactId>sdk-for-kotlin</artifactId>
<version>13.1.0</version> <version>14.0.0</version>
</dependency> </dependency>
</dependencies> </dependencies>
``` ```
+1 -1
View File
@@ -13,7 +13,7 @@ ext {
POM_URL = 'https://github.com/appwrite/sdk-for-kotlin' POM_URL = 'https://github.com/appwrite/sdk-for-kotlin'
POM_SCM_URL = 'https://github.com/appwrite/sdk-for-kotlin' POM_SCM_URL = 'https://github.com/appwrite/sdk-for-kotlin'
POM_ISSUE_URL = 'https://github.com/appwrite/sdk-for-kotlin/issues' POM_ISSUE_URL = 'https://github.com/appwrite/sdk-for-kotlin/issues'
POM_DESCRIPTION = 'Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Kotlin SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)' POM_DESCRIPTION = 'Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Kotlin SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)'
POM_LICENSE_URL = 'https://opensource.org/licenses/GPL-3.0' POM_LICENSE_URL = 'https://opensource.org/licenses/GPL-3.0'
POM_LICENSE_NAME = "GPL-3.0" POM_LICENSE_NAME = "GPL-3.0"
POM_DEVELOPER_ID = 'appwrite' POM_DEVELOPER_ID = 'appwrite'
+11 -7
View File
@@ -9,11 +9,15 @@ Client client = new Client()
Account account = new Account(client); Account account = new Account(client);
account.createJWT(new CoroutineCallback<>((result, error) -> { account.createJWT(
if (error != null) { 0, // duration (optional)
error.printStackTrace(); new CoroutineCallback<>((result, error) -> {
return; if (error != null) {
} error.printStackTrace();
return;
}
System.out.println(result);
})
);
System.out.println(result);
}));
+6 -5
View File
@@ -3,7 +3,8 @@ import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Avatars; import io.appwrite.services.Avatars;
import io.appwrite.enums.Theme; import io.appwrite.enums.Theme;
import io.appwrite.enums.Timezone; import io.appwrite.enums.Timezone;
import io.appwrite.enums.Output; import io.appwrite.enums.BrowserPermission;
import io.appwrite.enums.ImageFormat;
Client client = new Client() Client client = new Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
@@ -21,21 +22,21 @@ avatars.getScreenshot(
1920, // viewportWidth (optional) 1920, // viewportWidth (optional)
1080, // viewportHeight (optional) 1080, // viewportHeight (optional)
2, // scale (optional) 2, // scale (optional)
Theme.LIGHT, // theme (optional) Theme.DARK, // theme (optional)
"Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15", // userAgent (optional) "Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15", // userAgent (optional)
true, // fullpage (optional) true, // fullpage (optional)
"en-US", // locale (optional) "en-US", // locale (optional)
Timezone.AFRICA_ABIDJAN, // timezone (optional) Timezone.AMERICA_NEW_YORK, // timezone (optional)
37.7749, // latitude (optional) 37.7749, // latitude (optional)
-122.4194, // longitude (optional) -122.4194, // longitude (optional)
100, // accuracy (optional) 100, // accuracy (optional)
true, // touch (optional) true, // touch (optional)
List.of("geolocation", "notifications"), // permissions (optional) List.of(BrowserPermission.GEOLOCATION, BrowserPermission.NOTIFICATIONS), // permissions (optional)
3, // sleep (optional) 3, // sleep (optional)
800, // width (optional) 800, // width (optional)
600, // height (optional) 600, // height (optional)
85, // quality (optional) 85, // quality (optional)
Output.JPG, // output (optional) ImageFormat.JPEG, // output (optional)
new CoroutineCallback<>((result, error) -> { new CoroutineCallback<>((result, error) -> {
if (error != null) { if (error != null) {
error.printStackTrace(); error.printStackTrace();
+2 -1
View File
@@ -2,6 +2,7 @@ import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Databases; import io.appwrite.services.Databases;
import io.appwrite.enums.IndexType; import io.appwrite.enums.IndexType;
import io.appwrite.enums.OrderBy;
Client client = new Client() Client client = new Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
@@ -16,7 +17,7 @@ databases.createIndex(
"", // key "", // key
IndexType.KEY, // type IndexType.KEY, // type
List.of(), // attributes List.of(), // attributes
List.of(), // orders (optional) List.of(OrderBy.ASC), // orders (optional)
List.of(), // lengths (optional) List.of(), // lengths (optional)
new CoroutineCallback<>((result, error) -> { new CoroutineCallback<>((result, error) -> {
if (error != null) { if (error != null) {
@@ -14,7 +14,7 @@ Databases databases = new Databases(client);
databases.updateCollection( databases.updateCollection(
"<DATABASE_ID>", // databaseId "<DATABASE_ID>", // databaseId
"<COLLECTION_ID>", // collectionId "<COLLECTION_ID>", // collectionId
"<NAME>", // name "<NAME>", // name (optional)
List.of(Permission.read(Role.any())), // permissions (optional) List.of(Permission.read(Role.any())), // permissions (optional)
false, // documentSecurity (optional) false, // documentSecurity (optional)
false, // enabled (optional) false, // enabled (optional)
@@ -15,7 +15,13 @@ databases.updateDocument(
"<DATABASE_ID>", // databaseId "<DATABASE_ID>", // databaseId
"<COLLECTION_ID>", // collectionId "<COLLECTION_ID>", // collectionId
"<DOCUMENT_ID>", // documentId "<DOCUMENT_ID>", // documentId
Map.of("a", "b"), // data (optional) Map.of(
"username", "walter.obrien",
"email", "walter.obrien@example.com",
"fullName", "Walter O'Brien",
"age", 33,
"isAdmin", false
), // data (optional)
List.of(Permission.read(Role.any())), // permissions (optional) List.of(Permission.read(Role.any())), // permissions (optional)
"<TRANSACTION_ID>", // transactionId (optional) "<TRANSACTION_ID>", // transactionId (optional)
new CoroutineCallback<>((result, error) -> { new CoroutineCallback<>((result, error) -> {
@@ -12,7 +12,13 @@ Databases databases = new Databases(client);
databases.updateDocuments( databases.updateDocuments(
"<DATABASE_ID>", // databaseId "<DATABASE_ID>", // databaseId
"<COLLECTION_ID>", // collectionId "<COLLECTION_ID>", // collectionId
Map.of("a", "b"), // data (optional) Map.of(
"username", "walter.obrien",
"email", "walter.obrien@example.com",
"fullName", "Walter O'Brien",
"age", 33,
"isAdmin", false
), // data (optional)
List.of(), // queries (optional) List.of(), // queries (optional)
"<TRANSACTION_ID>", // transactionId (optional) "<TRANSACTION_ID>", // transactionId (optional)
new CoroutineCallback<>((result, error) -> { new CoroutineCallback<>((result, error) -> {
+1 -1
View File
@@ -11,7 +11,7 @@ Databases databases = new Databases(client);
databases.update( databases.update(
"<DATABASE_ID>", // databaseId "<DATABASE_ID>", // databaseId
"<NAME>", // name "<NAME>", // name (optional)
false, // enabled (optional) false, // enabled (optional)
new CoroutineCallback<>((result, error) -> { new CoroutineCallback<>((result, error) -> {
if (error != null) { if (error != null) {
@@ -15,7 +15,13 @@ databases.upsertDocument(
"<DATABASE_ID>", // databaseId "<DATABASE_ID>", // databaseId
"<COLLECTION_ID>", // collectionId "<COLLECTION_ID>", // collectionId
"<DOCUMENT_ID>", // documentId "<DOCUMENT_ID>", // documentId
Map.of("a", "b"), // data Map.of(
"username", "walter.obrien",
"email", "walter.obrien@example.com",
"fullName", "Walter O'Brien",
"age", 30,
"isAdmin", false
), // data (optional)
List.of(Permission.read(Role.any())), // permissions (optional) List.of(Permission.read(Role.any())), // permissions (optional)
"<TRANSACTION_ID>", // transactionId (optional) "<TRANSACTION_ID>", // transactionId (optional)
new CoroutineCallback<>((result, error) -> { new CoroutineCallback<>((result, error) -> {
+2 -1
View File
@@ -2,6 +2,7 @@ import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Functions; import io.appwrite.services.Functions;
import io.appwrite.enums.Runtime; import io.appwrite.enums.Runtime;
import io.appwrite.enums.Scopes;
Client client = new Client() Client client = new Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
@@ -22,7 +23,7 @@ functions.create(
false, // logging (optional) false, // logging (optional)
"<ENTRYPOINT>", // entrypoint (optional) "<ENTRYPOINT>", // entrypoint (optional)
"<COMMANDS>", // commands (optional) "<COMMANDS>", // commands (optional)
List.of(), // scopes (optional) List.of(Scopes.SESSIONS_WRITE), // scopes (optional)
"<INSTALLATION_ID>", // installationId (optional) "<INSTALLATION_ID>", // installationId (optional)
"<PROVIDER_REPOSITORY_ID>", // providerRepositoryId (optional) "<PROVIDER_REPOSITORY_ID>", // providerRepositoryId (optional)
"<PROVIDER_BRANCH>", // providerBranch (optional) "<PROVIDER_BRANCH>", // providerBranch (optional)
+2 -1
View File
@@ -2,6 +2,7 @@ import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Functions; import io.appwrite.services.Functions;
import io.appwrite.enums.Runtime; import io.appwrite.enums.Runtime;
import io.appwrite.enums.Scopes;
Client client = new Client() Client client = new Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
@@ -22,7 +23,7 @@ functions.update(
false, // logging (optional) false, // logging (optional)
"<ENTRYPOINT>", // entrypoint (optional) "<ENTRYPOINT>", // entrypoint (optional)
"<COMMANDS>", // commands (optional) "<COMMANDS>", // commands (optional)
List.of(), // scopes (optional) List.of(Scopes.SESSIONS_WRITE), // scopes (optional)
"<INSTALLATION_ID>", // installationId (optional) "<INSTALLATION_ID>", // installationId (optional)
"<PROVIDER_REPOSITORY_ID>", // providerRepositoryId (optional) "<PROVIDER_REPOSITORY_ID>", // providerRepositoryId (optional)
"<PROVIDER_BRANCH>", // providerBranch (optional) "<PROVIDER_BRANCH>", // providerBranch (optional)
@@ -0,0 +1,23 @@
import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Health;
Client client = new Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
.setKey("<YOUR_API_KEY>"); // Your secret API key
Health health = new Health(client);
health.getQueueAudits(
0, // threshold (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
return;
}
System.out.println(result);
})
);
+2 -1
View File
@@ -2,6 +2,7 @@ import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.TablesDB; import io.appwrite.services.TablesDB;
import io.appwrite.enums.IndexType; import io.appwrite.enums.IndexType;
import io.appwrite.enums.OrderBy;
Client client = new Client() Client client = new Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
@@ -16,7 +17,7 @@ tablesDB.createIndex(
"", // key "", // key
IndexType.KEY, // type IndexType.KEY, // type
List.of(), // columns List.of(), // columns
List.of(), // orders (optional) List.of(OrderBy.ASC), // orders (optional)
List.of(), // lengths (optional) List.of(), // lengths (optional)
new CoroutineCallback<>((result, error) -> { new CoroutineCallback<>((result, error) -> {
if (error != null) { if (error != null) {
+7 -1
View File
@@ -15,7 +15,13 @@ tablesDB.updateRow(
"<DATABASE_ID>", // databaseId "<DATABASE_ID>", // databaseId
"<TABLE_ID>", // tableId "<TABLE_ID>", // tableId
"<ROW_ID>", // rowId "<ROW_ID>", // rowId
Map.of("a", "b"), // data (optional) Map.of(
"username", "walter.obrien",
"email", "walter.obrien@example.com",
"fullName", "Walter O'Brien",
"age", 33,
"isAdmin", false
), // data (optional)
List.of(Permission.read(Role.any())), // permissions (optional) List.of(Permission.read(Role.any())), // permissions (optional)
"<TRANSACTION_ID>", // transactionId (optional) "<TRANSACTION_ID>", // transactionId (optional)
new CoroutineCallback<>((result, error) -> { new CoroutineCallback<>((result, error) -> {
+7 -1
View File
@@ -12,7 +12,13 @@ TablesDB tablesDB = new TablesDB(client);
tablesDB.updateRows( tablesDB.updateRows(
"<DATABASE_ID>", // databaseId "<DATABASE_ID>", // databaseId
"<TABLE_ID>", // tableId "<TABLE_ID>", // tableId
Map.of("a", "b"), // data (optional) Map.of(
"username", "walter.obrien",
"email", "walter.obrien@example.com",
"fullName", "Walter O'Brien",
"age", 33,
"isAdmin", false
), // data (optional)
List.of(), // queries (optional) List.of(), // queries (optional)
"<TRANSACTION_ID>", // transactionId (optional) "<TRANSACTION_ID>", // transactionId (optional)
new CoroutineCallback<>((result, error) -> { new CoroutineCallback<>((result, error) -> {
+1 -1
View File
@@ -14,7 +14,7 @@ TablesDB tablesDB = new TablesDB(client);
tablesDB.updateTable( tablesDB.updateTable(
"<DATABASE_ID>", // databaseId "<DATABASE_ID>", // databaseId
"<TABLE_ID>", // tableId "<TABLE_ID>", // tableId
"<NAME>", // name "<NAME>", // name (optional)
List.of(Permission.read(Role.any())), // permissions (optional) List.of(Permission.read(Role.any())), // permissions (optional)
false, // rowSecurity (optional) false, // rowSecurity (optional)
false, // enabled (optional) false, // enabled (optional)
+1 -1
View File
@@ -11,7 +11,7 @@ TablesDB tablesDB = new TablesDB(client);
tablesDB.update( tablesDB.update(
"<DATABASE_ID>", // databaseId "<DATABASE_ID>", // databaseId
"<NAME>", // name "<NAME>", // name (optional)
false, // enabled (optional) false, // enabled (optional)
new CoroutineCallback<>((result, error) -> { new CoroutineCallback<>((result, error) -> {
if (error != null) { if (error != null) {
+7 -1
View File
@@ -15,7 +15,13 @@ tablesDB.upsertRow(
"<DATABASE_ID>", // databaseId "<DATABASE_ID>", // databaseId
"<TABLE_ID>", // tableId "<TABLE_ID>", // tableId
"<ROW_ID>", // rowId "<ROW_ID>", // rowId
Map.of("a", "b"), // data (optional) Map.of(
"username", "walter.obrien",
"email", "walter.obrien@example.com",
"fullName", "Walter O'Brien",
"age", 33,
"isAdmin", false
), // data (optional)
List.of(Permission.read(Role.any())), // permissions (optional) List.of(Permission.read(Role.any())), // permissions (optional)
"<TRANSACTION_ID>", // transactionId (optional) "<TRANSACTION_ID>", // transactionId (optional)
new CoroutineCallback<>((result, error) -> { new CoroutineCallback<>((result, error) -> {
@@ -1,6 +1,7 @@
import io.appwrite.Client; import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Teams; import io.appwrite.services.Teams;
import io.appwrite.enums.Roles;
Client client = new Client() Client client = new Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
@@ -11,7 +12,7 @@ Teams teams = new Teams(client);
teams.createMembership( teams.createMembership(
"<TEAM_ID>", // teamId "<TEAM_ID>", // teamId
List.of(), // roles List.of(Roles.ADMIN), // roles
"email@example.com", // email (optional) "email@example.com", // email (optional)
"<USER_ID>", // userId (optional) "<USER_ID>", // userId (optional)
"+12065550100", // phone (optional) "+12065550100", // phone (optional)
@@ -1,6 +1,7 @@
import io.appwrite.Client; import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Teams; import io.appwrite.services.Teams;
import io.appwrite.enums.Roles;
Client client = new Client() Client client = new Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
@@ -12,7 +13,7 @@ Teams teams = new Teams(client);
teams.updateMembership( teams.updateMembership(
"<TEAM_ID>", // teamId "<TEAM_ID>", // teamId
"<MEMBERSHIP_ID>", // membershipId "<MEMBERSHIP_ID>", // membershipId
List.of(), // roles List.of(Roles.ADMIN), // roles
new CoroutineCallback<>((result, error) -> { new CoroutineCallback<>((result, error) -> {
if (error != null) { if (error != null) {
error.printStackTrace(); error.printStackTrace();
+3 -1
View File
@@ -9,4 +9,6 @@ val client = Client()
val account = Account(client) val account = Account(client)
val response = account.createJWT() val response = account.createJWT(
duration = 0 // optional
)
@@ -11,5 +11,5 @@ val client = Client()
val account = Account(client) val account = Account(client)
val response = account.createMFAAuthenticator( val response = account.createMFAAuthenticator(
type = AuthenticatorType.TOTP type = AuthenticatorType.TOTP
) )
@@ -11,5 +11,5 @@ val client = Client()
val account = Account(client) val account = Account(client)
val response = account.createMFAChallenge( val response = account.createMFAChallenge(
factor = AuthenticationFactor.EMAIL factor = AuthenticationFactor.EMAIL
) )
@@ -11,7 +11,7 @@ val client = Client()
val account = Account(client) val account = Account(client)
account.createOAuth2Token( account.createOAuth2Token(
provider = OAuthProvider.AMAZON, provider = OAuthProvider.AMAZON,
success = "https://example.com", // optional success = "https://example.com", // optional
failure = "https://example.com", // optional failure = "https://example.com", // optional
scopes = listOf() // optional scopes = listOf() // optional
@@ -11,5 +11,5 @@ val client = Client()
val account = Account(client) val account = Account(client)
val response = account.deleteMFAAuthenticator( val response = account.deleteMFAAuthenticator(
type = AuthenticatorType.TOTP type = AuthenticatorType.TOTP
) )
@@ -11,6 +11,6 @@ val client = Client()
val account = Account(client) val account = Account(client)
val response = account.updateMFAAuthenticator( val response = account.updateMFAAuthenticator(
type = AuthenticatorType.TOTP, type = AuthenticatorType.TOTP,
otp = "<OTP>" otp = "<OTP>"
) )
+1 -1
View File
@@ -11,7 +11,7 @@ val client = Client()
val avatars = Avatars(client) val avatars = Avatars(client)
val result = avatars.getBrowser( val result = avatars.getBrowser(
code = Browser.AVANT_BROWSER, code = Browser.AVANT_BROWSER,
width = 0, // optional width = 0, // optional
height = 0, // optional height = 0, // optional
quality = -1 // optional quality = -1 // optional
@@ -11,7 +11,7 @@ val client = Client()
val avatars = Avatars(client) val avatars = Avatars(client)
val result = avatars.getCreditCard( val result = avatars.getCreditCard(
code = CreditCard.AMERICAN_EXPRESS, code = CreditCard.AMERICAN_EXPRESS,
width = 0, // optional width = 0, // optional
height = 0, // optional height = 0, // optional
quality = -1 // optional quality = -1 // optional
+1 -1
View File
@@ -11,7 +11,7 @@ val client = Client()
val avatars = Avatars(client) val avatars = Avatars(client)
val result = avatars.getFlag( val result = avatars.getFlag(
code = Flag.AFGHANISTAN, code = Flag.AFGHANISTAN,
width = 0, // optional width = 0, // optional
height = 0, // optional height = 0, // optional
quality = -1 // optional quality = -1 // optional
@@ -3,7 +3,8 @@ import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Avatars import io.appwrite.services.Avatars
import io.appwrite.enums.Theme import io.appwrite.enums.Theme
import io.appwrite.enums.Timezone import io.appwrite.enums.Timezone
import io.appwrite.enums.Output import io.appwrite.enums.BrowserPermission
import io.appwrite.enums.ImageFormat
val client = Client() val client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
@@ -21,19 +22,19 @@ val result = avatars.getScreenshot(
viewportWidth = 1920, // optional viewportWidth = 1920, // optional
viewportHeight = 1080, // optional viewportHeight = 1080, // optional
scale = 2, // optional scale = 2, // optional
theme = "dark", // optional theme = Theme.DARK, // optional
userAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15", // optional userAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15", // optional
fullpage = true, // optional fullpage = true, // optional
locale = "en-US", // optional locale = "en-US", // optional
timezone = "america/new_york", // optional timezone = Timezone.AMERICA_NEW_YORK, // optional
latitude = 37.7749, // optional latitude = 37.7749, // optional
longitude = -122.4194, // optional longitude = -122.4194, // optional
accuracy = 100, // optional accuracy = 100, // optional
touch = true, // optional touch = true, // optional
permissions = listOf("geolocation", "notifications"), // optional permissions = listOf(BrowserPermission.GEOLOCATION, BrowserPermission.NOTIFICATIONS), // optional
sleep = 3, // optional sleep = 3, // optional
width = 800, // optional width = 800, // optional
height = 600, // optional height = 600, // optional
quality = 85, // optional quality = 85, // optional
output = "jpeg" // optional output = ImageFormat.JPEG // optional
) )
@@ -2,6 +2,7 @@ import io.appwrite.Client
import io.appwrite.coroutines.CoroutineCallback import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Databases import io.appwrite.services.Databases
import io.appwrite.enums.IndexType import io.appwrite.enums.IndexType
import io.appwrite.enums.OrderBy
val client = Client() val client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
@@ -14,8 +15,8 @@ val response = databases.createIndex(
databaseId = "<DATABASE_ID>", databaseId = "<DATABASE_ID>",
collectionId = "<COLLECTION_ID>", collectionId = "<COLLECTION_ID>",
key = "", key = "",
type = IndexType.KEY, type = IndexType.KEY,
attributes = listOf(), attributes = listOf(),
orders = listOf(), // optional orders = listOf(OrderBy.ASC), // optional
lengths = listOf() // optional lengths = listOf() // optional
) )
@@ -15,9 +15,9 @@ val response = databases.createRelationshipAttribute(
databaseId = "<DATABASE_ID>", databaseId = "<DATABASE_ID>",
collectionId = "<COLLECTION_ID>", collectionId = "<COLLECTION_ID>",
relatedCollectionId = "<RELATED_COLLECTION_ID>", relatedCollectionId = "<RELATED_COLLECTION_ID>",
type = RelationshipType.ONETOONE, type = RelationshipType.ONETOONE,
twoWay = false, // optional twoWay = false, // optional
key = "", // optional key = "", // optional
twoWayKey = "", // optional twoWayKey = "", // optional
onDelete = "cascade" // optional onDelete = RelationMutate.CASCADE // optional
) )
@@ -14,7 +14,7 @@ val databases = Databases(client)
val response = databases.updateCollection( val response = databases.updateCollection(
databaseId = "<DATABASE_ID>", databaseId = "<DATABASE_ID>",
collectionId = "<COLLECTION_ID>", collectionId = "<COLLECTION_ID>",
name = "<NAME>", name = "<NAME>", // optional
permissions = listOf(Permission.read(Role.any())), // optional permissions = listOf(Permission.read(Role.any())), // optional
documentSecurity = false, // optional documentSecurity = false, // optional
enabled = false // optional enabled = false // optional
@@ -15,7 +15,13 @@ val response = databases.updateDocument(
databaseId = "<DATABASE_ID>", databaseId = "<DATABASE_ID>",
collectionId = "<COLLECTION_ID>", collectionId = "<COLLECTION_ID>",
documentId = "<DOCUMENT_ID>", documentId = "<DOCUMENT_ID>",
data = mapOf( "a" to "b" ), // optional data = mapOf(
"username" to "walter.obrien",
"email" to "walter.obrien@example.com",
"fullName" to "Walter O'Brien",
"age" to 33,
"isAdmin" to false
), // optional
permissions = listOf(Permission.read(Role.any())), // optional permissions = listOf(Permission.read(Role.any())), // optional
transactionId = "<TRANSACTION_ID>" // optional transactionId = "<TRANSACTION_ID>" // optional
) )
@@ -12,7 +12,13 @@ val databases = Databases(client)
val response = databases.updateDocuments( val response = databases.updateDocuments(
databaseId = "<DATABASE_ID>", databaseId = "<DATABASE_ID>",
collectionId = "<COLLECTION_ID>", collectionId = "<COLLECTION_ID>",
data = mapOf( "a" to "b" ), // optional data = mapOf(
"username" to "walter.obrien",
"email" to "walter.obrien@example.com",
"fullName" to "Walter O'Brien",
"age" to 33,
"isAdmin" to false
), // optional
queries = listOf(), // optional queries = listOf(), // optional
transactionId = "<TRANSACTION_ID>" // optional transactionId = "<TRANSACTION_ID>" // optional
) )
@@ -14,6 +14,6 @@ val response = databases.updateRelationshipAttribute(
databaseId = "<DATABASE_ID>", databaseId = "<DATABASE_ID>",
collectionId = "<COLLECTION_ID>", collectionId = "<COLLECTION_ID>",
key = "", key = "",
onDelete = "cascade", // optional onDelete = RelationMutate.CASCADE, // optional
newKey = "" // optional newKey = "" // optional
) )
+1 -1
View File
@@ -11,6 +11,6 @@ val databases = Databases(client)
val response = databases.update( val response = databases.update(
databaseId = "<DATABASE_ID>", databaseId = "<DATABASE_ID>",
name = "<NAME>", name = "<NAME>", // optional
enabled = false // optional enabled = false // optional
) )
@@ -15,7 +15,13 @@ val response = databases.upsertDocument(
databaseId = "<DATABASE_ID>", databaseId = "<DATABASE_ID>",
collectionId = "<COLLECTION_ID>", collectionId = "<COLLECTION_ID>",
documentId = "<DOCUMENT_ID>", documentId = "<DOCUMENT_ID>",
data = mapOf( "a" to "b" ), data = mapOf(
"username" to "walter.obrien",
"email" to "walter.obrien@example.com",
"fullName" to "Walter O'Brien",
"age" to 30,
"isAdmin" to false
), // optional
permissions = listOf(Permission.read(Role.any())), // optional permissions = listOf(Permission.read(Role.any())), // optional
transactionId = "<TRANSACTION_ID>" // optional transactionId = "<TRANSACTION_ID>" // optional
) )
@@ -15,7 +15,7 @@ val response = functions.createExecution(
body = "<BODY>", // optional body = "<BODY>", // optional
async = false, // optional async = false, // optional
path = "<PATH>", // optional path = "<PATH>", // optional
method = "GET", // optional method = ExecutionMethod.GET, // optional
headers = mapOf( "a" to "b" ), // optional headers = mapOf( "a" to "b" ), // optional
scheduledAt = "<SCHEDULED_AT>" // optional scheduledAt = "<SCHEDULED_AT>" // optional
) )
@@ -15,7 +15,7 @@ val response = functions.createTemplateDeployment(
repository = "<REPOSITORY>", repository = "<REPOSITORY>",
owner = "<OWNER>", owner = "<OWNER>",
rootDirectory = "<ROOT_DIRECTORY>", rootDirectory = "<ROOT_DIRECTORY>",
type = TemplateReferenceType.COMMIT, type = TemplateReferenceType.COMMIT,
reference = "<REFERENCE>", reference = "<REFERENCE>",
activate = false // optional activate = false // optional
) )
@@ -12,7 +12,7 @@ val functions = Functions(client)
val response = functions.createVcsDeployment( val response = functions.createVcsDeployment(
functionId = "<FUNCTION_ID>", functionId = "<FUNCTION_ID>",
type = VCSReferenceType.BRANCH, type = VCSReferenceType.BRANCH,
reference = "<REFERENCE>", reference = "<REFERENCE>",
activate = false // optional activate = false // optional
) )
+3 -2
View File
@@ -2,6 +2,7 @@ import io.appwrite.Client
import io.appwrite.coroutines.CoroutineCallback import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Functions import io.appwrite.services.Functions
import io.appwrite.enums.Runtime import io.appwrite.enums.Runtime
import io.appwrite.enums.Scopes
val client = Client() val client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
@@ -13,7 +14,7 @@ val functions = Functions(client)
val response = functions.create( val response = functions.create(
functionId = "<FUNCTION_ID>", functionId = "<FUNCTION_ID>",
name = "<NAME>", name = "<NAME>",
runtime = Runtime.NODE_14_5, runtime = Runtime.NODE_14_5,
execute = listOf("any"), // optional execute = listOf("any"), // optional
events = listOf(), // optional events = listOf(), // optional
schedule = "", // optional schedule = "", // optional
@@ -22,7 +23,7 @@ val response = functions.create(
logging = false, // optional logging = false, // optional
entrypoint = "<ENTRYPOINT>", // optional entrypoint = "<ENTRYPOINT>", // optional
commands = "<COMMANDS>", // optional commands = "<COMMANDS>", // optional
scopes = listOf(), // optional scopes = listOf(Scopes.SESSIONS_WRITE), // optional
installationId = "<INSTALLATION_ID>", // optional installationId = "<INSTALLATION_ID>", // optional
providerRepositoryId = "<PROVIDER_REPOSITORY_ID>", // optional providerRepositoryId = "<PROVIDER_REPOSITORY_ID>", // optional
providerBranch = "<PROVIDER_BRANCH>", // optional providerBranch = "<PROVIDER_BRANCH>", // optional
@@ -13,5 +13,5 @@ val functions = Functions(client)
val result = functions.getDeploymentDownload( val result = functions.getDeploymentDownload(
functionId = "<FUNCTION_ID>", functionId = "<FUNCTION_ID>",
deploymentId = "<DEPLOYMENT_ID>", deploymentId = "<DEPLOYMENT_ID>",
type = "source" // optional type = DeploymentDownloadType.SOURCE // optional
) )
+3 -2
View File
@@ -2,6 +2,7 @@ import io.appwrite.Client
import io.appwrite.coroutines.CoroutineCallback import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Functions import io.appwrite.services.Functions
import io.appwrite.enums.Runtime import io.appwrite.enums.Runtime
import io.appwrite.enums.Scopes
val client = Client() val client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
@@ -13,7 +14,7 @@ val functions = Functions(client)
val response = functions.update( val response = functions.update(
functionId = "<FUNCTION_ID>", functionId = "<FUNCTION_ID>",
name = "<NAME>", name = "<NAME>",
runtime = "node-14.5", // optional runtime = Runtime.NODE_14_5, // optional
execute = listOf("any"), // optional execute = listOf("any"), // optional
events = listOf(), // optional events = listOf(), // optional
schedule = "", // optional schedule = "", // optional
@@ -22,7 +23,7 @@ val response = functions.update(
logging = false, // optional logging = false, // optional
entrypoint = "<ENTRYPOINT>", // optional entrypoint = "<ENTRYPOINT>", // optional
commands = "<COMMANDS>", // optional commands = "<COMMANDS>", // optional
scopes = listOf(), // optional scopes = listOf(Scopes.SESSIONS_WRITE), // optional
installationId = "<INSTALLATION_ID>", // optional installationId = "<INSTALLATION_ID>", // optional
providerRepositoryId = "<PROVIDER_REPOSITORY_ID>", // optional providerRepositoryId = "<PROVIDER_REPOSITORY_ID>", // optional
providerBranch = "<PROVIDER_BRANCH>", // optional providerBranch = "<PROVIDER_BRANCH>", // optional
@@ -11,6 +11,6 @@ val client = Client()
val health = Health(client) val health = Health(client)
val response = health.getFailedJobs( val response = health.getFailedJobs(
name = Name.V1_DATABASE, name = Name.V1_DATABASE,
threshold = 0 // optional threshold = 0 // optional
) )
@@ -0,0 +1,14 @@
import io.appwrite.Client
import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Health
val client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
.setKey("<YOUR_API_KEY>") // Your secret API key
val health = Health(client)
val response = health.getQueueAudits(
threshold = 0 // optional
)
@@ -29,5 +29,5 @@ val response = messaging.createPush(
scheduledAt = "", // optional scheduledAt = "", // optional
contentAvailable = false, // optional contentAvailable = false, // optional
critical = false, // optional critical = false, // optional
priority = "normal" // optional priority = MessagePriority.NORMAL // optional
) )
@@ -17,7 +17,7 @@ val response = messaging.createSMTPProvider(
port = 1, // optional port = 1, // optional
username = "<USERNAME>", // optional username = "<USERNAME>", // optional
password = "<PASSWORD>", // optional password = "<PASSWORD>", // optional
encryption = "none", // optional encryption = SmtpEncryption.NONE, // optional
autoTLS = false, // optional autoTLS = false, // optional
mailer = "<MAILER>", // optional mailer = "<MAILER>", // optional
fromName = "<FROM_NAME>", // optional fromName = "<FROM_NAME>", // optional
@@ -29,5 +29,5 @@ val response = messaging.updatePush(
scheduledAt = "", // optional scheduledAt = "", // optional
contentAvailable = false, // optional contentAvailable = false, // optional
critical = false, // optional critical = false, // optional
priority = "normal" // optional priority = MessagePriority.NORMAL // optional
) )
@@ -17,7 +17,7 @@ val response = messaging.updateSMTPProvider(
port = 1, // optional port = 1, // optional
username = "<USERNAME>", // optional username = "<USERNAME>", // optional
password = "<PASSWORD>", // optional password = "<PASSWORD>", // optional
encryption = "none", // optional encryption = SmtpEncryption.NONE, // optional
autoTLS = false, // optional autoTLS = false, // optional
mailer = "<MAILER>", // optional mailer = "<MAILER>", // optional
fromName = "<FROM_NAME>", // optional fromName = "<FROM_NAME>", // optional
@@ -15,7 +15,7 @@ val response = sites.createTemplateDeployment(
repository = "<REPOSITORY>", repository = "<REPOSITORY>",
owner = "<OWNER>", owner = "<OWNER>",
rootDirectory = "<ROOT_DIRECTORY>", rootDirectory = "<ROOT_DIRECTORY>",
type = TemplateReferenceType.BRANCH, type = TemplateReferenceType.BRANCH,
reference = "<REFERENCE>", reference = "<REFERENCE>",
activate = false // optional activate = false // optional
) )
@@ -12,7 +12,7 @@ val sites = Sites(client)
val response = sites.createVcsDeployment( val response = sites.createVcsDeployment(
siteId = "<SITE_ID>", siteId = "<SITE_ID>",
type = VCSReferenceType.BRANCH, type = VCSReferenceType.BRANCH,
reference = "<REFERENCE>", reference = "<REFERENCE>",
activate = false // optional activate = false // optional
) )
+3 -3
View File
@@ -15,15 +15,15 @@ val sites = Sites(client)
val response = sites.create( val response = sites.create(
siteId = "<SITE_ID>", siteId = "<SITE_ID>",
name = "<NAME>", name = "<NAME>",
framework = Framework.ANALOG, framework = Framework.ANALOG,
buildRuntime = BuildRuntime.NODE_14_5, buildRuntime = BuildRuntime.NODE_14_5,
enabled = false, // optional enabled = false, // optional
logging = false, // optional logging = false, // optional
timeout = 1, // optional timeout = 1, // optional
installCommand = "<INSTALL_COMMAND>", // optional installCommand = "<INSTALL_COMMAND>", // optional
buildCommand = "<BUILD_COMMAND>", // optional buildCommand = "<BUILD_COMMAND>", // optional
outputDirectory = "<OUTPUT_DIRECTORY>", // optional outputDirectory = "<OUTPUT_DIRECTORY>", // optional
adapter = "static", // optional adapter = Adapter.STATIC, // optional
installationId = "<INSTALLATION_ID>", // optional installationId = "<INSTALLATION_ID>", // optional
fallbackFile = "<FALLBACK_FILE>", // optional fallbackFile = "<FALLBACK_FILE>", // optional
providerRepositoryId = "<PROVIDER_REPOSITORY_ID>", // optional providerRepositoryId = "<PROVIDER_REPOSITORY_ID>", // optional
@@ -13,5 +13,5 @@ val sites = Sites(client)
val result = sites.getDeploymentDownload( val result = sites.getDeploymentDownload(
siteId = "<SITE_ID>", siteId = "<SITE_ID>",
deploymentId = "<DEPLOYMENT_ID>", deploymentId = "<DEPLOYMENT_ID>",
type = "source" // optional type = DeploymentDownloadType.SOURCE // optional
) )
+3 -3
View File
@@ -15,15 +15,15 @@ val sites = Sites(client)
val response = sites.update( val response = sites.update(
siteId = "<SITE_ID>", siteId = "<SITE_ID>",
name = "<NAME>", name = "<NAME>",
framework = Framework.ANALOG, framework = Framework.ANALOG,
enabled = false, // optional enabled = false, // optional
logging = false, // optional logging = false, // optional
timeout = 1, // optional timeout = 1, // optional
installCommand = "<INSTALL_COMMAND>", // optional installCommand = "<INSTALL_COMMAND>", // optional
buildCommand = "<BUILD_COMMAND>", // optional buildCommand = "<BUILD_COMMAND>", // optional
outputDirectory = "<OUTPUT_DIRECTORY>", // optional outputDirectory = "<OUTPUT_DIRECTORY>", // optional
buildRuntime = "node-14.5", // optional buildRuntime = BuildRuntime.NODE_14_5, // optional
adapter = "static", // optional adapter = Adapter.STATIC, // optional
fallbackFile = "<FALLBACK_FILE>", // optional fallbackFile = "<FALLBACK_FILE>", // optional
installationId = "<INSTALLATION_ID>", // optional installationId = "<INSTALLATION_ID>", // optional
providerRepositoryId = "<PROVIDER_REPOSITORY_ID>", // optional providerRepositoryId = "<PROVIDER_REPOSITORY_ID>", // optional
@@ -20,7 +20,7 @@ val response = storage.createBucket(
enabled = false, // optional enabled = false, // optional
maximumFileSize = 1, // optional maximumFileSize = 1, // optional
allowedFileExtensions = listOf(), // optional allowedFileExtensions = listOf(), // optional
compression = "none", // optional compression = Compression.NONE, // optional
encryption = false, // optional encryption = false, // optional
antivirus = false, // optional antivirus = false, // optional
transformations = false // optional transformations = false // optional
@@ -16,7 +16,7 @@ val result = storage.getFilePreview(
fileId = "<FILE_ID>", fileId = "<FILE_ID>",
width = 0, // optional width = 0, // optional
height = 0, // optional height = 0, // optional
gravity = "center", // optional gravity = ImageGravity.CENTER, // optional
quality = -1, // optional quality = -1, // optional
borderWidth = 0, // optional borderWidth = 0, // optional
borderColor = "", // optional borderColor = "", // optional
@@ -24,6 +24,6 @@ val result = storage.getFilePreview(
opacity = 0, // optional opacity = 0, // optional
rotation = -360, // optional rotation = -360, // optional
background = "", // optional background = "", // optional
output = "jpg", // optional output = ImageFormat.JPG, // optional
token = "<TOKEN>" // optional token = "<TOKEN>" // optional
) )
@@ -20,7 +20,7 @@ val response = storage.updateBucket(
enabled = false, // optional enabled = false, // optional
maximumFileSize = 1, // optional maximumFileSize = 1, // optional
allowedFileExtensions = listOf(), // optional allowedFileExtensions = listOf(), // optional
compression = "none", // optional compression = Compression.NONE, // optional
encryption = false, // optional encryption = false, // optional
antivirus = false, // optional antivirus = false, // optional
transformations = false // optional transformations = false // optional
@@ -2,6 +2,7 @@ import io.appwrite.Client
import io.appwrite.coroutines.CoroutineCallback import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.TablesDB import io.appwrite.services.TablesDB
import io.appwrite.enums.IndexType import io.appwrite.enums.IndexType
import io.appwrite.enums.OrderBy
val client = Client() val client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
@@ -14,8 +15,8 @@ val response = tablesDB.createIndex(
databaseId = "<DATABASE_ID>", databaseId = "<DATABASE_ID>",
tableId = "<TABLE_ID>", tableId = "<TABLE_ID>",
key = "", key = "",
type = IndexType.KEY, type = IndexType.KEY,
columns = listOf(), columns = listOf(),
orders = listOf(), // optional orders = listOf(OrderBy.ASC), // optional
lengths = listOf() // optional lengths = listOf() // optional
) )
@@ -15,9 +15,9 @@ val response = tablesDB.createRelationshipColumn(
databaseId = "<DATABASE_ID>", databaseId = "<DATABASE_ID>",
tableId = "<TABLE_ID>", tableId = "<TABLE_ID>",
relatedTableId = "<RELATED_TABLE_ID>", relatedTableId = "<RELATED_TABLE_ID>",
type = RelationshipType.ONETOONE, type = RelationshipType.ONETOONE,
twoWay = false, // optional twoWay = false, // optional
key = "", // optional key = "", // optional
twoWayKey = "", // optional twoWayKey = "", // optional
onDelete = "cascade" // optional onDelete = RelationMutate.CASCADE // optional
) )
@@ -14,6 +14,6 @@ val response = tablesDB.updateRelationshipColumn(
databaseId = "<DATABASE_ID>", databaseId = "<DATABASE_ID>",
tableId = "<TABLE_ID>", tableId = "<TABLE_ID>",
key = "", key = "",
onDelete = "cascade", // optional onDelete = RelationMutate.CASCADE, // optional
newKey = "" // optional newKey = "" // optional
) )
+7 -1
View File
@@ -15,7 +15,13 @@ val response = tablesDB.updateRow(
databaseId = "<DATABASE_ID>", databaseId = "<DATABASE_ID>",
tableId = "<TABLE_ID>", tableId = "<TABLE_ID>",
rowId = "<ROW_ID>", rowId = "<ROW_ID>",
data = mapOf( "a" to "b" ), // optional data = mapOf(
"username" to "walter.obrien",
"email" to "walter.obrien@example.com",
"fullName" to "Walter O'Brien",
"age" to 33,
"isAdmin" to false
), // optional
permissions = listOf(Permission.read(Role.any())), // optional permissions = listOf(Permission.read(Role.any())), // optional
transactionId = "<TRANSACTION_ID>" // optional transactionId = "<TRANSACTION_ID>" // optional
) )
+7 -1
View File
@@ -12,7 +12,13 @@ val tablesDB = TablesDB(client)
val response = tablesDB.updateRows( val response = tablesDB.updateRows(
databaseId = "<DATABASE_ID>", databaseId = "<DATABASE_ID>",
tableId = "<TABLE_ID>", tableId = "<TABLE_ID>",
data = mapOf( "a" to "b" ), // optional data = mapOf(
"username" to "walter.obrien",
"email" to "walter.obrien@example.com",
"fullName" to "Walter O'Brien",
"age" to 33,
"isAdmin" to false
), // optional
queries = listOf(), // optional queries = listOf(), // optional
transactionId = "<TRANSACTION_ID>" // optional transactionId = "<TRANSACTION_ID>" // optional
) )
@@ -14,7 +14,7 @@ val tablesDB = TablesDB(client)
val response = tablesDB.updateTable( val response = tablesDB.updateTable(
databaseId = "<DATABASE_ID>", databaseId = "<DATABASE_ID>",
tableId = "<TABLE_ID>", tableId = "<TABLE_ID>",
name = "<NAME>", name = "<NAME>", // optional
permissions = listOf(Permission.read(Role.any())), // optional permissions = listOf(Permission.read(Role.any())), // optional
rowSecurity = false, // optional rowSecurity = false, // optional
enabled = false // optional enabled = false // optional
+1 -1
View File
@@ -11,6 +11,6 @@ val tablesDB = TablesDB(client)
val response = tablesDB.update( val response = tablesDB.update(
databaseId = "<DATABASE_ID>", databaseId = "<DATABASE_ID>",
name = "<NAME>", name = "<NAME>", // optional
enabled = false // optional enabled = false // optional
) )
+7 -1
View File
@@ -15,7 +15,13 @@ val response = tablesDB.upsertRow(
databaseId = "<DATABASE_ID>", databaseId = "<DATABASE_ID>",
tableId = "<TABLE_ID>", tableId = "<TABLE_ID>",
rowId = "<ROW_ID>", rowId = "<ROW_ID>",
data = mapOf( "a" to "b" ), // optional data = mapOf(
"username" to "walter.obrien",
"email" to "walter.obrien@example.com",
"fullName" to "Walter O'Brien",
"age" to 33,
"isAdmin" to false
), // optional
permissions = listOf(Permission.read(Role.any())), // optional permissions = listOf(Permission.read(Role.any())), // optional
transactionId = "<TRANSACTION_ID>" // optional transactionId = "<TRANSACTION_ID>" // optional
) )
@@ -1,6 +1,7 @@
import io.appwrite.Client import io.appwrite.Client
import io.appwrite.coroutines.CoroutineCallback import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Teams import io.appwrite.services.Teams
import io.appwrite.enums.Roles
val client = Client() val client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
@@ -11,7 +12,7 @@ val teams = Teams(client)
val response = teams.createMembership( val response = teams.createMembership(
teamId = "<TEAM_ID>", teamId = "<TEAM_ID>",
roles = listOf(), roles = listOf(Roles.ADMIN),
email = "email@example.com", // optional email = "email@example.com", // optional
userId = "<USER_ID>", // optional userId = "<USER_ID>", // optional
phone = "+12065550100", // optional phone = "+12065550100", // optional
@@ -1,6 +1,7 @@
import io.appwrite.Client import io.appwrite.Client
import io.appwrite.coroutines.CoroutineCallback import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Teams import io.appwrite.services.Teams
import io.appwrite.enums.Roles
val client = Client() val client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
@@ -12,5 +13,5 @@ val teams = Teams(client)
val response = teams.updateMembership( val response = teams.updateMembership(
teamId = "<TEAM_ID>", teamId = "<TEAM_ID>",
membershipId = "<MEMBERSHIP_ID>", membershipId = "<MEMBERSHIP_ID>",
roles = listOf() roles = listOf(Roles.ADMIN)
) )
@@ -14,6 +14,6 @@ val response = users.createSHAUser(
userId = "<USER_ID>", userId = "<USER_ID>",
email = "email@example.com", email = "email@example.com",
password = "password", password = "password",
passwordVersion = "sha1", // optional passwordVersion = PasswordHash.SHA1, // optional
name = "<NAME>" // optional name = "<NAME>" // optional
) )
+1 -1
View File
@@ -13,7 +13,7 @@ val users = Users(client)
val response = users.createTarget( val response = users.createTarget(
userId = "<USER_ID>", userId = "<USER_ID>",
targetId = "<TARGET_ID>", targetId = "<TARGET_ID>",
providerType = MessagingProviderType.EMAIL, providerType = MessagingProviderType.EMAIL,
identifier = "<IDENTIFIER>", identifier = "<IDENTIFIER>",
providerId = "<PROVIDER_ID>", // optional providerId = "<PROVIDER_ID>", // optional
name = "<NAME>" // optional name = "<NAME>" // optional
@@ -12,5 +12,5 @@ val users = Users(client)
val response = users.deleteMFAAuthenticator( val response = users.deleteMFAAuthenticator(
userId = "<USER_ID>", userId = "<USER_ID>",
type = AuthenticatorType.TOTP type = AuthenticatorType.TOTP
) )
+2 -3
View File
@@ -54,15 +54,14 @@ class Client @JvmOverloads constructor(
val config: MutableMap<String, String> val config: MutableMap<String, String>
init { init {
headers = mutableMapOf( headers = mutableMapOf(
"content-type" to "application/json", "content-type" to "application/json",
"user-agent" to "AppwriteKotlinSDK/13.1.0 ${System.getProperty("http.agent")}", "user-agent" to "AppwriteKotlinSDK/14.0.0 ${System.getProperty("http.agent")}",
"x-sdk-name" to "Kotlin", "x-sdk-name" to "Kotlin",
"x-sdk-platform" to "server", "x-sdk-platform" to "server",
"x-sdk-language" to "kotlin", "x-sdk-language" to "kotlin",
"x-sdk-version" to "13.1.0", "x-sdk-version" to "14.0.0",
"x-appwrite-response-format" to "1.8.0", "x-appwrite-response-format" to "1.8.0",
) )
+34
View File
@@ -15,6 +15,15 @@ class Query(
fun notEqual(attribute: String, value: Any) = Query("notEqual", attribute, parseValue(value)).toJson() fun notEqual(attribute: String, value: Any) = Query("notEqual", attribute, parseValue(value)).toJson()
/**
* Filter resources where attribute matches a regular expression pattern.
*
* @param attribute The attribute to filter on.
* @param pattern The regular expression pattern to match.
* @returns The query string.
*/
fun regex(attribute: String, pattern: String) = Query("regex", attribute, parseValue(pattern)).toJson()
fun lessThan(attribute: String, value: Any) = Query("lessThan", attribute, parseValue(value)).toJson() fun lessThan(attribute: String, value: Any) = Query("lessThan", attribute, parseValue(value)).toJson()
fun lessThanEqual(attribute: String, value: Any) = Query("lessThanEqual", attribute, parseValue(value)).toJson() fun lessThanEqual(attribute: String, value: Any) = Query("lessThanEqual", attribute, parseValue(value)).toJson()
@@ -29,6 +38,22 @@ class Query(
fun isNotNull(attribute: String) = Query("isNotNull", attribute).toJson() fun isNotNull(attribute: String) = Query("isNotNull", attribute).toJson()
/**
* Filter resources where the specified attributes exist.
*
* @param attributes The list of attributes that must exist.
* @returns The query string.
*/
fun exists(attributes: List<String>) = Query("exists", null, attributes).toJson()
/**
* Filter resources where the specified attributes do not exist.
*
* @param attributes The list of attributes that must not exist.
* @returns The query string.
*/
fun notExists(attributes: List<String>) = Query("notExists", null, attributes).toJson()
fun between(attribute: String, start: Any, end: Any) = Query("between", attribute, listOf(start, end)).toJson() fun between(attribute: String, start: Any, end: Any) = Query("between", attribute, listOf(start, end)).toJson()
fun startsWith(attribute: String, value: String) = Query("startsWith", attribute, listOf(value)).toJson() fun startsWith(attribute: String, value: String) = Query("startsWith", attribute, listOf(value)).toJson()
@@ -79,6 +104,15 @@ class Query(
fun and(queries: List<String>) = Query("and", null, queries.map { it.fromJson<Query>() }).toJson() fun and(queries: List<String>) = Query("and", null, queries.map { it.fromJson<Query>() }).toJson()
/**
* Filter array elements where at least one element matches all the specified queries.
*
* @param attribute The attribute containing the array to filter on.
* @param queries The list of query strings to match against array elements.
* @returns The query string.
*/
fun elemMatch(attribute: String, queries: List<String>) = Query("elemMatch", attribute, queries.map { it.fromJson<Query>() }).toJson()
/** /**
* Filter resources where attribute is at a specific distance from the given coordinates. * Filter resources where attribute is at a specific distance from the given coordinates.
* *
@@ -0,0 +1,48 @@
package io.appwrite.enums
import com.google.gson.annotations.SerializedName
enum class BrowserPermission(val value: String) {
@SerializedName("geolocation")
GEOLOCATION("geolocation"),
@SerializedName("camera")
CAMERA("camera"),
@SerializedName("microphone")
MICROPHONE("microphone"),
@SerializedName("notifications")
NOTIFICATIONS("notifications"),
@SerializedName("midi")
MIDI("midi"),
@SerializedName("push")
PUSH("push"),
@SerializedName("clipboard-read")
CLIPBOARD_READ("clipboard-read"),
@SerializedName("clipboard-write")
CLIPBOARD_WRITE("clipboard-write"),
@SerializedName("payment-handler")
PAYMENT_HANDLER("payment-handler"),
@SerializedName("usb")
USB("usb"),
@SerializedName("bluetooth")
BLUETOOTH("bluetooth"),
@SerializedName("accelerometer")
ACCELEROMETER("accelerometer"),
@SerializedName("gyroscope")
GYROSCOPE("gyroscope"),
@SerializedName("magnetometer")
MAGNETOMETER("magnetometer"),
@SerializedName("ambient-light-sensor")
AMBIENT_LIGHT_SENSOR("ambient-light-sensor"),
@SerializedName("background-sync")
BACKGROUND_SYNC("background-sync"),
@SerializedName("persistent-storage")
PERSISTENT_STORAGE("persistent-storage"),
@SerializedName("screen-wake-lock")
SCREEN_WAKE_LOCK("screen-wake-lock"),
@SerializedName("web-share")
WEB_SHARE("web-share"),
@SerializedName("xr-spatial-tracking")
XR_SPATIAL_TRACKING("xr-spatial-tracking");
override fun toString() = value
}
@@ -11,6 +11,8 @@ enum class DeploymentStatus(val value: String) {
BUILDING("building"), BUILDING("building"),
@SerializedName("ready") @SerializedName("ready")
READY("ready"), READY("ready"),
@SerializedName("canceled")
CANCELED("canceled"),
@SerializedName("failed") @SerializedName("failed")
FAILED("failed"); FAILED("failed");
@@ -23,6 +23,8 @@ enum class Name(val value: String) {
V1_CERTIFICATES("v1-certificates"), V1_CERTIFICATES("v1-certificates"),
@SerializedName("v1-builds") @SerializedName("v1-builds")
V1_BUILDS("v1-builds"), V1_BUILDS("v1-builds"),
@SerializedName("v1-screenshots")
V1_SCREENSHOTS("v1-screenshots"),
@SerializedName("v1-messaging") @SerializedName("v1-messaging")
V1_MESSAGING("v1-messaging"), V1_MESSAGING("v1-messaging"),
@SerializedName("v1-migrations") @SerializedName("v1-migrations")
@@ -80,9 +80,7 @@ enum class OAuthProvider(val value: String) {
@SerializedName("zoho") @SerializedName("zoho")
ZOHO("zoho"), ZOHO("zoho"),
@SerializedName("zoom") @SerializedName("zoom")
ZOOM("zoom"), ZOOM("zoom");
@SerializedName("mock")
MOCK("mock");
override fun toString() = value override fun toString() = value
} }
@@ -0,0 +1,12 @@
package io.appwrite.enums
import com.google.gson.annotations.SerializedName
enum class OrderBy(val value: String) {
@SerializedName("asc")
ASC("asc"),
@SerializedName("desc")
DESC("desc");
override fun toString() = value
}
@@ -1,22 +0,0 @@
package io.appwrite.enums
import com.google.gson.annotations.SerializedName
enum class Output(val value: String) {
@SerializedName("jpg")
JPG("jpg"),
@SerializedName("jpeg")
JPEG("jpeg"),
@SerializedName("png")
PNG("png"),
@SerializedName("webp")
WEBP("webp"),
@SerializedName("heic")
HEIC("heic"),
@SerializedName("avif")
AVIF("avif"),
@SerializedName("gif")
GIF("gif");
override fun toString() = value
}
@@ -0,0 +1,14 @@
package io.appwrite.enums
import com.google.gson.annotations.SerializedName
enum class Roles(val value: String) {
@SerializedName("admin")
ADMIN("admin"),
@SerializedName("developer")
DEVELOPER("developer"),
@SerializedName("owner")
OWNER("owner");
override fun toString() = value
}
+118
View File
@@ -0,0 +1,118 @@
package io.appwrite.enums
import com.google.gson.annotations.SerializedName
enum class Scopes(val value: String) {
@SerializedName("sessions.write")
SESSIONS_WRITE("sessions.write"),
@SerializedName("users.read")
USERS_READ("users.read"),
@SerializedName("users.write")
USERS_WRITE("users.write"),
@SerializedName("teams.read")
TEAMS_READ("teams.read"),
@SerializedName("teams.write")
TEAMS_WRITE("teams.write"),
@SerializedName("databases.read")
DATABASES_READ("databases.read"),
@SerializedName("databases.write")
DATABASES_WRITE("databases.write"),
@SerializedName("collections.read")
COLLECTIONS_READ("collections.read"),
@SerializedName("collections.write")
COLLECTIONS_WRITE("collections.write"),
@SerializedName("tables.read")
TABLES_READ("tables.read"),
@SerializedName("tables.write")
TABLES_WRITE("tables.write"),
@SerializedName("attributes.read")
ATTRIBUTES_READ("attributes.read"),
@SerializedName("attributes.write")
ATTRIBUTES_WRITE("attributes.write"),
@SerializedName("columns.read")
COLUMNS_READ("columns.read"),
@SerializedName("columns.write")
COLUMNS_WRITE("columns.write"),
@SerializedName("indexes.read")
INDEXES_READ("indexes.read"),
@SerializedName("indexes.write")
INDEXES_WRITE("indexes.write"),
@SerializedName("documents.read")
DOCUMENTS_READ("documents.read"),
@SerializedName("documents.write")
DOCUMENTS_WRITE("documents.write"),
@SerializedName("rows.read")
ROWS_READ("rows.read"),
@SerializedName("rows.write")
ROWS_WRITE("rows.write"),
@SerializedName("files.read")
FILES_READ("files.read"),
@SerializedName("files.write")
FILES_WRITE("files.write"),
@SerializedName("buckets.read")
BUCKETS_READ("buckets.read"),
@SerializedName("buckets.write")
BUCKETS_WRITE("buckets.write"),
@SerializedName("functions.read")
FUNCTIONS_READ("functions.read"),
@SerializedName("functions.write")
FUNCTIONS_WRITE("functions.write"),
@SerializedName("sites.read")
SITES_READ("sites.read"),
@SerializedName("sites.write")
SITES_WRITE("sites.write"),
@SerializedName("log.read")
LOG_READ("log.read"),
@SerializedName("log.write")
LOG_WRITE("log.write"),
@SerializedName("execution.read")
EXECUTION_READ("execution.read"),
@SerializedName("execution.write")
EXECUTION_WRITE("execution.write"),
@SerializedName("locale.read")
LOCALE_READ("locale.read"),
@SerializedName("avatars.read")
AVATARS_READ("avatars.read"),
@SerializedName("health.read")
HEALTH_READ("health.read"),
@SerializedName("providers.read")
PROVIDERS_READ("providers.read"),
@SerializedName("providers.write")
PROVIDERS_WRITE("providers.write"),
@SerializedName("messages.read")
MESSAGES_READ("messages.read"),
@SerializedName("messages.write")
MESSAGES_WRITE("messages.write"),
@SerializedName("topics.read")
TOPICS_READ("topics.read"),
@SerializedName("topics.write")
TOPICS_WRITE("topics.write"),
@SerializedName("subscribers.read")
SUBSCRIBERS_READ("subscribers.read"),
@SerializedName("subscribers.write")
SUBSCRIBERS_WRITE("subscribers.write"),
@SerializedName("targets.read")
TARGETS_READ("targets.read"),
@SerializedName("targets.write")
TARGETS_WRITE("targets.write"),
@SerializedName("rules.read")
RULES_READ("rules.read"),
@SerializedName("rules.write")
RULES_WRITE("rules.write"),
@SerializedName("migrations.read")
MIGRATIONS_READ("migrations.read"),
@SerializedName("migrations.write")
MIGRATIONS_WRITE("migrations.write"),
@SerializedName("vcs.read")
VCS_READ("vcs.read"),
@SerializedName("vcs.write")
VCS_WRITE("vcs.write"),
@SerializedName("assistant.read")
ASSISTANT_READ("assistant.read"),
@SerializedName("tokens.read")
TOKENS_READ("tokens.read"),
@SerializedName("tokens.write")
TOKENS_WRITE("tokens.write");
override fun toString() = value
}
+9 -1
View File
@@ -62,7 +62,7 @@ data class Bucket(
val allowedFileExtensions: List<String>, val allowedFileExtensions: List<String>,
/** /**
* Compression algorithm choosen for compression. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). * Compression algorithm chosen for compression. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd).
*/ */
@SerializedName("compression") @SerializedName("compression")
val compression: String, val compression: String,
@@ -85,6 +85,12 @@ data class Bucket(
@SerializedName("transformations") @SerializedName("transformations")
val transformations: Boolean, val transformations: Boolean,
/**
* Total size of this bucket in bytes.
*/
@SerializedName("totalSize")
val totalSize: Long,
) { ) {
fun toMap(): Map<String, Any> = mapOf( fun toMap(): Map<String, Any> = mapOf(
"\$id" to id as Any, "\$id" to id as Any,
@@ -100,6 +106,7 @@ data class Bucket(
"encryption" to encryption as Any, "encryption" to encryption as Any,
"antivirus" to antivirus as Any, "antivirus" to antivirus as Any,
"transformations" to transformations as Any, "transformations" to transformations as Any,
"totalSize" to totalSize as Any,
) )
companion object { companion object {
@@ -121,6 +128,7 @@ data class Bucket(
encryption = map["encryption"] as Boolean, encryption = map["encryption"] as Boolean,
antivirus = map["antivirus"] as Boolean, antivirus = map["antivirus"] as Boolean,
transformations = map["transformations"] as Boolean, transformations = map["transformations"] as Boolean,
totalSize = (map["totalSize"] as Number).toLong(),
) )
} }
} }
@@ -93,7 +93,7 @@ data class Deployment(
val screenshotDark: String, val screenshotDark: String,
/** /**
* The deployment status. Possible values are "waiting", "processing", "building", "ready", and "failed". * The deployment status. Possible values are "waiting", "processing", "building", "ready", "canceled" and "failed".
*/ */
@SerializedName("status") @SerializedName("status")
val status: DeploymentStatus, val status: DeploymentStatus,
@@ -73,6 +73,18 @@ data class File(
@SerializedName("chunksUploaded") @SerializedName("chunksUploaded")
val chunksUploaded: Long, val chunksUploaded: Long,
/**
* Whether file contents are encrypted at rest.
*/
@SerializedName("encryption")
val encryption: Boolean,
/**
* Compression algorithm used for the file. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd).
*/
@SerializedName("compression")
val compression: String,
) { ) {
fun toMap(): Map<String, Any> = mapOf( fun toMap(): Map<String, Any> = mapOf(
"\$id" to id as Any, "\$id" to id as Any,
@@ -86,6 +98,8 @@ data class File(
"sizeOriginal" to sizeOriginal as Any, "sizeOriginal" to sizeOriginal as Any,
"chunksTotal" to chunksTotal as Any, "chunksTotal" to chunksTotal as Any,
"chunksUploaded" to chunksUploaded as Any, "chunksUploaded" to chunksUploaded as Any,
"encryption" to encryption as Any,
"compression" to compression as Any,
) )
companion object { companion object {
@@ -105,6 +119,8 @@ data class File(
sizeOriginal = (map["sizeOriginal"] as Number).toLong(), sizeOriginal = (map["sizeOriginal"] as Number).toLong(),
chunksTotal = (map["chunksTotal"] as Number).toLong(), chunksTotal = (map["chunksTotal"] as Number).toLong(),
chunksUploaded = (map["chunksUploaded"] as Number).toLong(), chunksUploaded = (map["chunksUploaded"] as Number).toLong(),
encryption = map["encryption"] as Boolean,
compression = map["compression"] as String,
) )
} }
} }
@@ -0,0 +1,38 @@
package io.appwrite.models
import com.google.gson.annotations.SerializedName
import io.appwrite.extensions.jsonCast
/**
* Status List
*/
data class HealthStatusList(
/**
* Total number of statuses that matched your query.
*/
@SerializedName("total")
val total: Long,
/**
* List of statuses.
*/
@SerializedName("statuses")
val statuses: List<HealthStatus>,
) {
fun toMap(): Map<String, Any> = mapOf(
"total" to total as Any,
"statuses" to statuses.map { it.toMap() } as Any,
)
companion object {
@Suppress("UNCHECKED_CAST")
fun from(
map: Map<String, Any>,
) = HealthStatusList(
total = (map["total"] as Number).toLong(),
statuses = (map["statuses"] as List<Map<String, Any>>).map { HealthStatus.from(map = it) },
)
}
}
@@ -238,14 +238,18 @@ class Account(client: Client) : Service(client) {
/** /**
* Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame. * Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.
* *
* @param duration Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.
* @return [io.appwrite.models.Jwt] * @return [io.appwrite.models.Jwt]
*/ */
@JvmOverloads
@Throws(AppwriteException::class) @Throws(AppwriteException::class)
suspend fun createJWT( suspend fun createJWT(
duration: Long? = null,
): io.appwrite.models.Jwt { ): io.appwrite.models.Jwt {
val apiPath = "/account/jwts" val apiPath = "/account/jwts"
val apiParams = mutableMapOf<String, Any?>( val apiParams = mutableMapOf<String, Any?>(
"duration" to duration,
) )
val apiHeaders = mutableMapOf<String, String>( val apiHeaders = mutableMapOf<String, String>(
"content-type" to "application/json", "content-type" to "application/json",
@@ -313,12 +313,12 @@ class Avatars(client: Client) : Service(client) {
longitude: Double? = null, longitude: Double? = null,
accuracy: Double? = null, accuracy: Double? = null,
touch: Boolean? = null, touch: Boolean? = null,
permissions: List<String>? = null, permissions: List<io.appwrite.enums.BrowserPermission>? = null,
sleep: Long? = null, sleep: Long? = null,
width: Long? = null, width: Long? = null,
height: Long? = null, height: Long? = null,
quality: Long? = null, quality: Long? = null,
output: io.appwrite.enums.Output? = null, output: io.appwrite.enums.ImageFormat? = null,
): ByteArray { ): ByteArray {
val apiPath = "/avatars/screenshots" val apiPath = "/avatars/screenshots"
@@ -340,7 +340,7 @@ class Databases(client: Client) : Service(client) {
@Throws(AppwriteException::class) @Throws(AppwriteException::class)
suspend fun update( suspend fun update(
databaseId: String, databaseId: String,
name: String, name: String? = null,
enabled: Boolean? = null, enabled: Boolean? = null,
): io.appwrite.models.Database { ): io.appwrite.models.Database {
val apiPath = "/databases/{databaseId}" val apiPath = "/databases/{databaseId}"
@@ -555,7 +555,7 @@ class Databases(client: Client) : Service(client) {
suspend fun updateCollection( suspend fun updateCollection(
databaseId: String, databaseId: String,
collectionId: String, collectionId: String,
name: String, name: String? = null,
permissions: List<String>? = null, permissions: List<String>? = null,
documentSecurity: Boolean? = null, documentSecurity: Boolean? = null,
enabled: Boolean? = null, enabled: Boolean? = null,
@@ -2018,12 +2018,16 @@ class Databases(client: Client) : Service(client) {
) )
val apiHeaders = mutableMapOf<String, String>( val apiHeaders = mutableMapOf<String, String>(
) )
val converter: (Any) -> Any = {
io.appwrite.models.AttributeBoolean.from(map = it as Map<String, Any>)
}
return client.call( return client.call(
"GET", "GET",
apiPath, apiPath,
apiHeaders, apiHeaders,
apiParams, apiParams,
responseType = Any::class.java, responseType = Any::class.java,
converter,
) )
} }
@@ -2682,7 +2686,7 @@ class Databases(client: Client) : Service(client) {
databaseId: String, databaseId: String,
collectionId: String, collectionId: String,
documentId: String, documentId: String,
data: Any, data: Any? = null,
permissions: List<String>? = null, permissions: List<String>? = null,
transactionId: String? = null, transactionId: String? = null,
nestedType: Class<T>, nestedType: Class<T>,
@@ -2734,7 +2738,7 @@ class Databases(client: Client) : Service(client) {
databaseId: String, databaseId: String,
collectionId: String, collectionId: String,
documentId: String, documentId: String,
data: Any, data: Any? = null,
permissions: List<String>? = null, permissions: List<String>? = null,
transactionId: String? = null, transactionId: String? = null,
): io.appwrite.models.Document<Map<String, Any>> = upsertDocument( ): io.appwrite.models.Document<Map<String, Any>> = upsertDocument(
@@ -3127,7 +3131,7 @@ class Databases(client: Client) : Service(client) {
key: String, key: String,
type: io.appwrite.enums.IndexType, type: io.appwrite.enums.IndexType,
attributes: List<String>, attributes: List<String>,
orders: List<String>? = null, orders: List<io.appwrite.enums.OrderBy>? = null,
lengths: List<Long>? = null, lengths: List<Long>? = null,
): io.appwrite.models.Index { ): io.appwrite.models.Index {
val apiPath = "/databases/{databaseId}/collections/{collectionId}/indexes" val apiPath = "/databases/{databaseId}/collections/{collectionId}/indexes"
@@ -89,7 +89,7 @@ class Functions(client: Client) : Service(client) {
logging: Boolean? = null, logging: Boolean? = null,
entrypoint: String? = null, entrypoint: String? = null,
commands: String? = null, commands: String? = null,
scopes: List<String>? = null, scopes: List<io.appwrite.enums.Scopes>? = null,
installationId: String? = null, installationId: String? = null,
providerRepositoryId: String? = null, providerRepositoryId: String? = null,
providerBranch: String? = null, providerBranch: String? = null,
@@ -256,7 +256,7 @@ class Functions(client: Client) : Service(client) {
logging: Boolean? = null, logging: Boolean? = null,
entrypoint: String? = null, entrypoint: String? = null,
commands: String? = null, commands: String? = null,
scopes: List<String>? = null, scopes: List<io.appwrite.enums.Scopes>? = null,
installationId: String? = null, installationId: String? = null,
providerRepositoryId: String? = null, providerRepositoryId: String? = null,
providerBranch: String? = null, providerBranch: String? = null,
+46 -15
View File
@@ -70,26 +70,26 @@ class Health(client: Client) : Service(client) {
/** /**
* Check the Appwrite in-memory cache servers are up and connection is successful. * Check the Appwrite in-memory cache servers are up and connection is successful.
* *
* @return [io.appwrite.models.HealthStatus] * @return [io.appwrite.models.HealthStatusList]
*/ */
@Throws(AppwriteException::class) @Throws(AppwriteException::class)
suspend fun getCache( suspend fun getCache(
): io.appwrite.models.HealthStatus { ): io.appwrite.models.HealthStatusList {
val apiPath = "/health/cache" val apiPath = "/health/cache"
val apiParams = mutableMapOf<String, Any?>( val apiParams = mutableMapOf<String, Any?>(
) )
val apiHeaders = mutableMapOf<String, String>( val apiHeaders = mutableMapOf<String, String>(
) )
val converter: (Any) -> io.appwrite.models.HealthStatus = { val converter: (Any) -> io.appwrite.models.HealthStatusList = {
io.appwrite.models.HealthStatus.from(map = it as Map<String, Any>) io.appwrite.models.HealthStatusList.from(map = it as Map<String, Any>)
} }
return client.call( return client.call(
"GET", "GET",
apiPath, apiPath,
apiHeaders, apiHeaders,
apiParams, apiParams,
responseType = io.appwrite.models.HealthStatus::class.java, responseType = io.appwrite.models.HealthStatusList::class.java,
converter, converter,
) )
} }
@@ -128,26 +128,26 @@ class Health(client: Client) : Service(client) {
/** /**
* Check the Appwrite database servers are up and connection is successful. * Check the Appwrite database servers are up and connection is successful.
* *
* @return [io.appwrite.models.HealthStatus] * @return [io.appwrite.models.HealthStatusList]
*/ */
@Throws(AppwriteException::class) @Throws(AppwriteException::class)
suspend fun getDB( suspend fun getDB(
): io.appwrite.models.HealthStatus { ): io.appwrite.models.HealthStatusList {
val apiPath = "/health/db" val apiPath = "/health/db"
val apiParams = mutableMapOf<String, Any?>( val apiParams = mutableMapOf<String, Any?>(
) )
val apiHeaders = mutableMapOf<String, String>( val apiHeaders = mutableMapOf<String, String>(
) )
val converter: (Any) -> io.appwrite.models.HealthStatus = { val converter: (Any) -> io.appwrite.models.HealthStatusList = {
io.appwrite.models.HealthStatus.from(map = it as Map<String, Any>) io.appwrite.models.HealthStatusList.from(map = it as Map<String, Any>)
} }
return client.call( return client.call(
"GET", "GET",
apiPath, apiPath,
apiHeaders, apiHeaders,
apiParams, apiParams,
responseType = io.appwrite.models.HealthStatus::class.java, responseType = io.appwrite.models.HealthStatusList::class.java,
converter, converter,
) )
} }
@@ -155,26 +155,57 @@ class Health(client: Client) : Service(client) {
/** /**
* Check the Appwrite pub-sub servers are up and connection is successful. * Check the Appwrite pub-sub servers are up and connection is successful.
* *
* @return [io.appwrite.models.HealthStatus] * @return [io.appwrite.models.HealthStatusList]
*/ */
@Throws(AppwriteException::class) @Throws(AppwriteException::class)
suspend fun getPubSub( suspend fun getPubSub(
): io.appwrite.models.HealthStatus { ): io.appwrite.models.HealthStatusList {
val apiPath = "/health/pubsub" val apiPath = "/health/pubsub"
val apiParams = mutableMapOf<String, Any?>( val apiParams = mutableMapOf<String, Any?>(
) )
val apiHeaders = mutableMapOf<String, String>( val apiHeaders = mutableMapOf<String, String>(
) )
val converter: (Any) -> io.appwrite.models.HealthStatus = { val converter: (Any) -> io.appwrite.models.HealthStatusList = {
io.appwrite.models.HealthStatus.from(map = it as Map<String, Any>) io.appwrite.models.HealthStatusList.from(map = it as Map<String, Any>)
} }
return client.call( return client.call(
"GET", "GET",
apiPath, apiPath,
apiHeaders, apiHeaders,
apiParams, apiParams,
responseType = io.appwrite.models.HealthStatus::class.java, responseType = io.appwrite.models.HealthStatusList::class.java,
converter,
)
}
/**
* Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server.
*
* @param threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @return [io.appwrite.models.HealthQueue]
*/
@JvmOverloads
@Throws(AppwriteException::class)
suspend fun getQueueAudits(
threshold: Long? = null,
): io.appwrite.models.HealthQueue {
val apiPath = "/health/queue/audits"
val apiParams = mutableMapOf<String, Any?>(
"threshold" to threshold,
)
val apiHeaders = mutableMapOf<String, String>(
)
val converter: (Any) -> io.appwrite.models.HealthQueue = {
io.appwrite.models.HealthQueue.from(map = it as Map<String, Any>)
}
return client.call(
"GET",
apiPath,
apiHeaders,
apiParams,
responseType = io.appwrite.models.HealthQueue::class.java,
converter, converter,
) )
} }
@@ -62,7 +62,7 @@ class Storage(client: Client) : Service(client) {
* @param enabled Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. * @param enabled Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.
* @param maximumFileSize Maximum file size allowed in bytes. Maximum allowed value is 30MB. * @param maximumFileSize Maximum file size allowed in bytes. Maximum allowed value is 30MB.
* @param allowedFileExtensions Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. * @param allowedFileExtensions Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
* @param compression Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled * @param compression Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
* @param encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled * @param encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
* @param antivirus Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled * @param antivirus Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
* @param transformations Are image transformations enabled? * @param transformations Are image transformations enabled?
@@ -154,7 +154,7 @@ class Storage(client: Client) : Service(client) {
* @param enabled Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. * @param enabled Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.
* @param maximumFileSize Maximum file size allowed in bytes. Maximum allowed value is 30MB. * @param maximumFileSize Maximum file size allowed in bytes. Maximum allowed value is 30MB.
* @param allowedFileExtensions Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. * @param allowedFileExtensions Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
* @param compression Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled * @param compression Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
* @param encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled * @param encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
* @param antivirus Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled * @param antivirus Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
* @param transformations Are image transformations enabled? * @param transformations Are image transformations enabled?
@@ -362,10 +362,10 @@ class Storage(client: Client) : Service(client) {
/** /**
* Update a file by its unique ID. Only users with write permissions have access to update this resource. * Update a file by its unique ID. Only users with write permissions have access to update this resource.
* *
* @param bucketId Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). * @param bucketId Bucket unique ID.
* @param fileId File unique ID. * @param fileId File ID.
* @param name Name of the file * @param name File name.
* @param permissions An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). * @param permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @return [io.appwrite.models.File] * @return [io.appwrite.models.File]
*/ */
@JvmOverloads @JvmOverloads
@@ -324,7 +324,7 @@ class TablesDB(client: Client) : Service(client) {
@Throws(AppwriteException::class) @Throws(AppwriteException::class)
suspend fun update( suspend fun update(
databaseId: String, databaseId: String,
name: String, name: String? = null,
enabled: Boolean? = null, enabled: Boolean? = null,
): io.appwrite.models.Database { ): io.appwrite.models.Database {
val apiPath = "/tablesdb/{databaseId}" val apiPath = "/tablesdb/{databaseId}"
@@ -519,7 +519,7 @@ class TablesDB(client: Client) : Service(client) {
suspend fun updateTable( suspend fun updateTable(
databaseId: String, databaseId: String,
tableId: String, tableId: String,
name: String, name: String? = null,
permissions: List<String>? = null, permissions: List<String>? = null,
rowSecurity: Boolean? = null, rowSecurity: Boolean? = null,
enabled: Boolean? = null, enabled: Boolean? = null,
@@ -1869,12 +1869,16 @@ class TablesDB(client: Client) : Service(client) {
) )
val apiHeaders = mutableMapOf<String, String>( val apiHeaders = mutableMapOf<String, String>(
) )
val converter: (Any) -> Any = {
io.appwrite.models.ColumnBoolean.from(map = it as Map<String, Any>)
}
return client.call( return client.call(
"GET", "GET",
apiPath, apiPath,
apiHeaders, apiHeaders,
apiParams, apiParams,
responseType = Any::class.java, responseType = Any::class.java,
converter,
) )
} }
@@ -2017,7 +2021,7 @@ class TablesDB(client: Client) : Service(client) {
key: String, key: String,
type: io.appwrite.enums.IndexType, type: io.appwrite.enums.IndexType,
columns: List<String>, columns: List<String>,
orders: List<String>? = null, orders: List<io.appwrite.enums.OrderBy>? = null,
lengths: List<Long>? = null, lengths: List<Long>? = null,
): io.appwrite.models.ColumnIndex { ): io.appwrite.models.ColumnIndex {
val apiPath = "/tablesdb/{databaseId}/tables/{tableId}/indexes" val apiPath = "/tablesdb/{databaseId}/tables/{tableId}/indexes"
@@ -319,7 +319,7 @@ class Teams(client: Client) : Service(client) {
@Throws(AppwriteException::class) @Throws(AppwriteException::class)
suspend fun createMembership( suspend fun createMembership(
teamId: String, teamId: String,
roles: List<String>, roles: List<io.appwrite.enums.Roles>,
email: String? = null, email: String? = null,
userId: String? = null, userId: String? = null,
phone: String? = null, phone: String? = null,
@@ -399,7 +399,7 @@ class Teams(client: Client) : Service(client) {
suspend fun updateMembership( suspend fun updateMembership(
teamId: String, teamId: String,
membershipId: String, membershipId: String,
roles: List<String>, roles: List<io.appwrite.enums.Roles>,
): io.appwrite.models.Membership { ): io.appwrite.models.Membership {
val apiPath = "/teams/{teamId}/memberships/{membershipId}" val apiPath = "/teams/{teamId}/memberships/{membershipId}"
.replace("{teamId}", teamId) .replace("{teamId}", teamId)