mirror of
https://github.com/appwrite/sdk-for-kotlin.git
synced 2026-04-07 19:17:44 +00:00
Add array-based enum parameters
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
# Change Log
|
||||
|
||||
## 14.0.0
|
||||
|
||||
* Add array-based enum parameters (e.g., `permissions: List<BrowserPermission>`).
|
||||
|
||||
## 13.1.0
|
||||
|
||||
* Added ability to create columns and indexes synchronously while creating a table
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
[](https://twitter.com/appwrite)
|
||||
[](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)
|
||||
|
||||
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)
|
||||
|
||||

|
||||
|
||||
@@ -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.1.0")
|
||||
implementation("io.appwrite:sdk-for-kotlin:14.0.0")
|
||||
```
|
||||
|
||||
### Maven
|
||||
@@ -50,7 +50,7 @@ Add this to your project's `pom.xml` file:
|
||||
<dependency>
|
||||
<groupId>io.appwrite</groupId>
|
||||
<artifactId>sdk-for-kotlin</artifactId>
|
||||
<version>13.1.0</version>
|
||||
<version>14.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ ext {
|
||||
POM_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_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_NAME = "GPL-3.0"
|
||||
POM_DEVELOPER_ID = 'appwrite'
|
||||
|
||||
@@ -9,11 +9,15 @@ Client client = new Client()
|
||||
|
||||
Account account = new Account(client);
|
||||
|
||||
account.createJWT(new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
error.printStackTrace();
|
||||
return;
|
||||
}
|
||||
account.createJWT(
|
||||
0, // duration (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
error.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println(result);
|
||||
})
|
||||
);
|
||||
|
||||
System.out.println(result);
|
||||
}));
|
||||
|
||||
@@ -3,7 +3,8 @@ import io.appwrite.coroutines.CoroutineCallback;
|
||||
import io.appwrite.services.Avatars;
|
||||
import io.appwrite.enums.Theme;
|
||||
import io.appwrite.enums.Timezone;
|
||||
import io.appwrite.enums.Output;
|
||||
import io.appwrite.enums.BrowserPermission;
|
||||
import io.appwrite.enums.ImageFormat;
|
||||
|
||||
Client client = new Client()
|
||||
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
|
||||
@@ -21,21 +22,21 @@ avatars.getScreenshot(
|
||||
1920, // viewportWidth (optional)
|
||||
1080, // viewportHeight (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)
|
||||
true, // fullpage (optional)
|
||||
"en-US", // locale (optional)
|
||||
Timezone.AFRICA_ABIDJAN, // timezone (optional)
|
||||
Timezone.AMERICA_NEW_YORK, // timezone (optional)
|
||||
37.7749, // latitude (optional)
|
||||
-122.4194, // longitude (optional)
|
||||
100, // accuracy (optional)
|
||||
true, // touch (optional)
|
||||
List.of("geolocation", "notifications"), // permissions (optional)
|
||||
List.of(BrowserPermission.GEOLOCATION, BrowserPermission.NOTIFICATIONS), // permissions (optional)
|
||||
3, // sleep (optional)
|
||||
800, // width (optional)
|
||||
600, // height (optional)
|
||||
85, // quality (optional)
|
||||
Output.JPG, // output (optional)
|
||||
ImageFormat.JPEG, // output (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
error.printStackTrace();
|
||||
|
||||
@@ -2,6 +2,7 @@ import io.appwrite.Client;
|
||||
import io.appwrite.coroutines.CoroutineCallback;
|
||||
import io.appwrite.services.Databases;
|
||||
import io.appwrite.enums.IndexType;
|
||||
import io.appwrite.enums.OrderBy;
|
||||
|
||||
Client client = new Client()
|
||||
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
|
||||
@@ -16,7 +17,7 @@ databases.createIndex(
|
||||
"", // key
|
||||
IndexType.KEY, // type
|
||||
List.of(), // attributes
|
||||
List.of(), // orders (optional)
|
||||
List.of(OrderBy.ASC), // orders (optional)
|
||||
List.of(), // lengths (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
|
||||
@@ -14,7 +14,7 @@ Databases databases = new Databases(client);
|
||||
databases.updateCollection(
|
||||
"<DATABASE_ID>", // databaseId
|
||||
"<COLLECTION_ID>", // collectionId
|
||||
"<NAME>", // name
|
||||
"<NAME>", // name (optional)
|
||||
List.of(Permission.read(Role.any())), // permissions (optional)
|
||||
false, // documentSecurity (optional)
|
||||
false, // enabled (optional)
|
||||
|
||||
@@ -15,7 +15,13 @@ databases.updateDocument(
|
||||
"<DATABASE_ID>", // databaseId
|
||||
"<COLLECTION_ID>", // collectionId
|
||||
"<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)
|
||||
"<TRANSACTION_ID>", // transactionId (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
|
||||
@@ -12,7 +12,13 @@ Databases databases = new Databases(client);
|
||||
databases.updateDocuments(
|
||||
"<DATABASE_ID>", // databaseId
|
||||
"<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)
|
||||
"<TRANSACTION_ID>", // transactionId (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
|
||||
@@ -11,7 +11,7 @@ Databases databases = new Databases(client);
|
||||
|
||||
databases.update(
|
||||
"<DATABASE_ID>", // databaseId
|
||||
"<NAME>", // name
|
||||
"<NAME>", // name (optional)
|
||||
false, // enabled (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
|
||||
@@ -15,7 +15,13 @@ databases.upsertDocument(
|
||||
"<DATABASE_ID>", // databaseId
|
||||
"<COLLECTION_ID>", // collectionId
|
||||
"<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)
|
||||
"<TRANSACTION_ID>", // transactionId (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
|
||||
@@ -2,6 +2,7 @@ import io.appwrite.Client;
|
||||
import io.appwrite.coroutines.CoroutineCallback;
|
||||
import io.appwrite.services.Functions;
|
||||
import io.appwrite.enums.Runtime;
|
||||
import io.appwrite.enums.Scopes;
|
||||
|
||||
Client client = new Client()
|
||||
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
|
||||
@@ -22,7 +23,7 @@ functions.create(
|
||||
false, // logging (optional)
|
||||
"<ENTRYPOINT>", // entrypoint (optional)
|
||||
"<COMMANDS>", // commands (optional)
|
||||
List.of(), // scopes (optional)
|
||||
List.of(Scopes.SESSIONS_WRITE), // scopes (optional)
|
||||
"<INSTALLATION_ID>", // installationId (optional)
|
||||
"<PROVIDER_REPOSITORY_ID>", // providerRepositoryId (optional)
|
||||
"<PROVIDER_BRANCH>", // providerBranch (optional)
|
||||
|
||||
@@ -2,6 +2,7 @@ import io.appwrite.Client;
|
||||
import io.appwrite.coroutines.CoroutineCallback;
|
||||
import io.appwrite.services.Functions;
|
||||
import io.appwrite.enums.Runtime;
|
||||
import io.appwrite.enums.Scopes;
|
||||
|
||||
Client client = new Client()
|
||||
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
|
||||
@@ -22,7 +23,7 @@ functions.update(
|
||||
false, // logging (optional)
|
||||
"<ENTRYPOINT>", // entrypoint (optional)
|
||||
"<COMMANDS>", // commands (optional)
|
||||
List.of(), // scopes (optional)
|
||||
List.of(Scopes.SESSIONS_WRITE), // scopes (optional)
|
||||
"<INSTALLATION_ID>", // installationId (optional)
|
||||
"<PROVIDER_REPOSITORY_ID>", // providerRepositoryId (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,6 +2,7 @@ import io.appwrite.Client;
|
||||
import io.appwrite.coroutines.CoroutineCallback;
|
||||
import io.appwrite.services.TablesDB;
|
||||
import io.appwrite.enums.IndexType;
|
||||
import io.appwrite.enums.OrderBy;
|
||||
|
||||
Client client = new Client()
|
||||
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
|
||||
@@ -16,7 +17,7 @@ tablesDB.createIndex(
|
||||
"", // key
|
||||
IndexType.KEY, // type
|
||||
List.of(), // columns
|
||||
List.of(), // orders (optional)
|
||||
List.of(OrderBy.ASC), // orders (optional)
|
||||
List.of(), // lengths (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
|
||||
@@ -15,7 +15,13 @@ tablesDB.updateRow(
|
||||
"<DATABASE_ID>", // databaseId
|
||||
"<TABLE_ID>", // tableId
|
||||
"<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)
|
||||
"<TRANSACTION_ID>", // transactionId (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
|
||||
@@ -12,7 +12,13 @@ TablesDB tablesDB = new TablesDB(client);
|
||||
tablesDB.updateRows(
|
||||
"<DATABASE_ID>", // databaseId
|
||||
"<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)
|
||||
"<TRANSACTION_ID>", // transactionId (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
|
||||
@@ -14,7 +14,7 @@ TablesDB tablesDB = new TablesDB(client);
|
||||
tablesDB.updateTable(
|
||||
"<DATABASE_ID>", // databaseId
|
||||
"<TABLE_ID>", // tableId
|
||||
"<NAME>", // name
|
||||
"<NAME>", // name (optional)
|
||||
List.of(Permission.read(Role.any())), // permissions (optional)
|
||||
false, // rowSecurity (optional)
|
||||
false, // enabled (optional)
|
||||
|
||||
@@ -11,7 +11,7 @@ TablesDB tablesDB = new TablesDB(client);
|
||||
|
||||
tablesDB.update(
|
||||
"<DATABASE_ID>", // databaseId
|
||||
"<NAME>", // name
|
||||
"<NAME>", // name (optional)
|
||||
false, // enabled (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
|
||||
@@ -15,7 +15,13 @@ tablesDB.upsertRow(
|
||||
"<DATABASE_ID>", // databaseId
|
||||
"<TABLE_ID>", // tableId
|
||||
"<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)
|
||||
"<TRANSACTION_ID>", // transactionId (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import io.appwrite.Client;
|
||||
import io.appwrite.coroutines.CoroutineCallback;
|
||||
import io.appwrite.services.Teams;
|
||||
import io.appwrite.enums.Roles;
|
||||
|
||||
Client client = new Client()
|
||||
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
|
||||
@@ -11,7 +12,7 @@ Teams teams = new Teams(client);
|
||||
|
||||
teams.createMembership(
|
||||
"<TEAM_ID>", // teamId
|
||||
List.of(), // roles
|
||||
List.of(Roles.ADMIN), // roles
|
||||
"email@example.com", // email (optional)
|
||||
"<USER_ID>", // userId (optional)
|
||||
"+12065550100", // phone (optional)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import io.appwrite.Client;
|
||||
import io.appwrite.coroutines.CoroutineCallback;
|
||||
import io.appwrite.services.Teams;
|
||||
import io.appwrite.enums.Roles;
|
||||
|
||||
Client client = new Client()
|
||||
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
|
||||
@@ -12,7 +13,7 @@ Teams teams = new Teams(client);
|
||||
teams.updateMembership(
|
||||
"<TEAM_ID>", // teamId
|
||||
"<MEMBERSHIP_ID>", // membershipId
|
||||
List.of(), // roles
|
||||
List.of(Roles.ADMIN), // roles
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
error.printStackTrace();
|
||||
|
||||
@@ -9,4 +9,6 @@ val client = 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 response = account.createMFAAuthenticator(
|
||||
type = AuthenticatorType.TOTP
|
||||
type = AuthenticatorType.TOTP
|
||||
)
|
||||
|
||||
@@ -11,5 +11,5 @@ val client = Client()
|
||||
val account = Account(client)
|
||||
|
||||
val response = account.createMFAChallenge(
|
||||
factor = AuthenticationFactor.EMAIL
|
||||
factor = AuthenticationFactor.EMAIL
|
||||
)
|
||||
|
||||
@@ -11,7 +11,7 @@ val client = Client()
|
||||
val account = Account(client)
|
||||
|
||||
account.createOAuth2Token(
|
||||
provider = OAuthProvider.AMAZON,
|
||||
provider = OAuthProvider.AMAZON,
|
||||
success = "https://example.com", // optional
|
||||
failure = "https://example.com", // optional
|
||||
scopes = listOf() // optional
|
||||
|
||||
@@ -11,5 +11,5 @@ val client = Client()
|
||||
val account = Account(client)
|
||||
|
||||
val response = account.deleteMFAAuthenticator(
|
||||
type = AuthenticatorType.TOTP
|
||||
type = AuthenticatorType.TOTP
|
||||
)
|
||||
|
||||
@@ -11,6 +11,6 @@ val client = Client()
|
||||
val account = Account(client)
|
||||
|
||||
val response = account.updateMFAAuthenticator(
|
||||
type = AuthenticatorType.TOTP,
|
||||
type = AuthenticatorType.TOTP,
|
||||
otp = "<OTP>"
|
||||
)
|
||||
|
||||
@@ -11,7 +11,7 @@ val client = Client()
|
||||
val avatars = Avatars(client)
|
||||
|
||||
val result = avatars.getBrowser(
|
||||
code = Browser.AVANT_BROWSER,
|
||||
code = Browser.AVANT_BROWSER,
|
||||
width = 0, // optional
|
||||
height = 0, // optional
|
||||
quality = -1 // optional
|
||||
|
||||
@@ -11,7 +11,7 @@ val client = Client()
|
||||
val avatars = Avatars(client)
|
||||
|
||||
val result = avatars.getCreditCard(
|
||||
code = CreditCard.AMERICAN_EXPRESS,
|
||||
code = CreditCard.AMERICAN_EXPRESS,
|
||||
width = 0, // optional
|
||||
height = 0, // optional
|
||||
quality = -1 // optional
|
||||
|
||||
@@ -11,7 +11,7 @@ val client = Client()
|
||||
val avatars = Avatars(client)
|
||||
|
||||
val result = avatars.getFlag(
|
||||
code = Flag.AFGHANISTAN,
|
||||
code = Flag.AFGHANISTAN,
|
||||
width = 0, // optional
|
||||
height = 0, // optional
|
||||
quality = -1 // optional
|
||||
|
||||
@@ -3,7 +3,8 @@ import io.appwrite.coroutines.CoroutineCallback
|
||||
import io.appwrite.services.Avatars
|
||||
import io.appwrite.enums.Theme
|
||||
import io.appwrite.enums.Timezone
|
||||
import io.appwrite.enums.Output
|
||||
import io.appwrite.enums.BrowserPermission
|
||||
import io.appwrite.enums.ImageFormat
|
||||
|
||||
val client = Client()
|
||||
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
|
||||
@@ -21,19 +22,19 @@ val result = avatars.getScreenshot(
|
||||
viewportWidth = 1920, // optional
|
||||
viewportHeight = 1080, // 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
|
||||
fullpage = true, // optional
|
||||
locale = "en-US", // optional
|
||||
timezone = "america/new_york", // optional
|
||||
timezone = Timezone.AMERICA_NEW_YORK, // optional
|
||||
latitude = 37.7749, // optional
|
||||
longitude = -122.4194, // optional
|
||||
accuracy = 100, // optional
|
||||
touch = true, // optional
|
||||
permissions = listOf("geolocation", "notifications"), // optional
|
||||
permissions = listOf(BrowserPermission.GEOLOCATION, BrowserPermission.NOTIFICATIONS), // optional
|
||||
sleep = 3, // optional
|
||||
width = 800, // optional
|
||||
height = 600, // 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.services.Databases
|
||||
import io.appwrite.enums.IndexType
|
||||
import io.appwrite.enums.OrderBy
|
||||
|
||||
val client = Client()
|
||||
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
|
||||
@@ -14,8 +15,8 @@ val response = databases.createIndex(
|
||||
databaseId = "<DATABASE_ID>",
|
||||
collectionId = "<COLLECTION_ID>",
|
||||
key = "",
|
||||
type = IndexType.KEY,
|
||||
type = IndexType.KEY,
|
||||
attributes = listOf(),
|
||||
orders = listOf(), // optional
|
||||
orders = listOf(OrderBy.ASC), // optional
|
||||
lengths = listOf() // optional
|
||||
)
|
||||
|
||||
@@ -15,9 +15,9 @@ val response = databases.createRelationshipAttribute(
|
||||
databaseId = "<DATABASE_ID>",
|
||||
collectionId = "<COLLECTION_ID>",
|
||||
relatedCollectionId = "<RELATED_COLLECTION_ID>",
|
||||
type = RelationshipType.ONETOONE,
|
||||
type = RelationshipType.ONETOONE,
|
||||
twoWay = false, // optional
|
||||
key = "", // optional
|
||||
twoWayKey = "", // optional
|
||||
onDelete = "cascade" // optional
|
||||
onDelete = RelationMutate.CASCADE // optional
|
||||
)
|
||||
|
||||
@@ -14,7 +14,7 @@ val databases = Databases(client)
|
||||
val response = databases.updateCollection(
|
||||
databaseId = "<DATABASE_ID>",
|
||||
collectionId = "<COLLECTION_ID>",
|
||||
name = "<NAME>",
|
||||
name = "<NAME>", // optional
|
||||
permissions = listOf(Permission.read(Role.any())), // optional
|
||||
documentSecurity = false, // optional
|
||||
enabled = false // optional
|
||||
|
||||
@@ -15,7 +15,13 @@ val response = databases.updateDocument(
|
||||
databaseId = "<DATABASE_ID>",
|
||||
collectionId = "<COLLECTION_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
|
||||
transactionId = "<TRANSACTION_ID>" // optional
|
||||
)
|
||||
|
||||
@@ -12,7 +12,13 @@ val databases = Databases(client)
|
||||
val response = databases.updateDocuments(
|
||||
databaseId = "<DATABASE_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
|
||||
transactionId = "<TRANSACTION_ID>" // optional
|
||||
)
|
||||
|
||||
@@ -14,6 +14,6 @@ val response = databases.updateRelationshipAttribute(
|
||||
databaseId = "<DATABASE_ID>",
|
||||
collectionId = "<COLLECTION_ID>",
|
||||
key = "",
|
||||
onDelete = "cascade", // optional
|
||||
onDelete = RelationMutate.CASCADE, // optional
|
||||
newKey = "" // optional
|
||||
)
|
||||
|
||||
@@ -11,6 +11,6 @@ val databases = Databases(client)
|
||||
|
||||
val response = databases.update(
|
||||
databaseId = "<DATABASE_ID>",
|
||||
name = "<NAME>",
|
||||
name = "<NAME>", // optional
|
||||
enabled = false // optional
|
||||
)
|
||||
|
||||
@@ -15,7 +15,13 @@ val response = databases.upsertDocument(
|
||||
databaseId = "<DATABASE_ID>",
|
||||
collectionId = "<COLLECTION_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
|
||||
transactionId = "<TRANSACTION_ID>" // optional
|
||||
)
|
||||
|
||||
@@ -15,7 +15,7 @@ val response = functions.createExecution(
|
||||
body = "<BODY>", // optional
|
||||
async = false, // optional
|
||||
path = "<PATH>", // optional
|
||||
method = "GET", // optional
|
||||
method = ExecutionMethod.GET, // optional
|
||||
headers = mapOf( "a" to "b" ), // optional
|
||||
scheduledAt = "<SCHEDULED_AT>" // optional
|
||||
)
|
||||
|
||||
@@ -15,7 +15,7 @@ val response = functions.createTemplateDeployment(
|
||||
repository = "<REPOSITORY>",
|
||||
owner = "<OWNER>",
|
||||
rootDirectory = "<ROOT_DIRECTORY>",
|
||||
type = TemplateReferenceType.COMMIT,
|
||||
type = TemplateReferenceType.COMMIT,
|
||||
reference = "<REFERENCE>",
|
||||
activate = false // optional
|
||||
)
|
||||
|
||||
@@ -12,7 +12,7 @@ val functions = Functions(client)
|
||||
|
||||
val response = functions.createVcsDeployment(
|
||||
functionId = "<FUNCTION_ID>",
|
||||
type = VCSReferenceType.BRANCH,
|
||||
type = VCSReferenceType.BRANCH,
|
||||
reference = "<REFERENCE>",
|
||||
activate = false // optional
|
||||
)
|
||||
|
||||
@@ -2,6 +2,7 @@ import io.appwrite.Client
|
||||
import io.appwrite.coroutines.CoroutineCallback
|
||||
import io.appwrite.services.Functions
|
||||
import io.appwrite.enums.Runtime
|
||||
import io.appwrite.enums.Scopes
|
||||
|
||||
val client = Client()
|
||||
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
|
||||
@@ -13,7 +14,7 @@ val functions = Functions(client)
|
||||
val response = functions.create(
|
||||
functionId = "<FUNCTION_ID>",
|
||||
name = "<NAME>",
|
||||
runtime = Runtime.NODE_14_5,
|
||||
runtime = Runtime.NODE_14_5,
|
||||
execute = listOf("any"), // optional
|
||||
events = listOf(), // optional
|
||||
schedule = "", // optional
|
||||
@@ -22,7 +23,7 @@ val response = functions.create(
|
||||
logging = false, // optional
|
||||
entrypoint = "<ENTRYPOINT>", // optional
|
||||
commands = "<COMMANDS>", // optional
|
||||
scopes = listOf(), // optional
|
||||
scopes = listOf(Scopes.SESSIONS_WRITE), // optional
|
||||
installationId = "<INSTALLATION_ID>", // optional
|
||||
providerRepositoryId = "<PROVIDER_REPOSITORY_ID>", // optional
|
||||
providerBranch = "<PROVIDER_BRANCH>", // optional
|
||||
|
||||
@@ -13,5 +13,5 @@ val functions = Functions(client)
|
||||
val result = functions.getDeploymentDownload(
|
||||
functionId = "<FUNCTION_ID>",
|
||||
deploymentId = "<DEPLOYMENT_ID>",
|
||||
type = "source" // optional
|
||||
type = DeploymentDownloadType.SOURCE // optional
|
||||
)
|
||||
|
||||
@@ -2,6 +2,7 @@ import io.appwrite.Client
|
||||
import io.appwrite.coroutines.CoroutineCallback
|
||||
import io.appwrite.services.Functions
|
||||
import io.appwrite.enums.Runtime
|
||||
import io.appwrite.enums.Scopes
|
||||
|
||||
val client = Client()
|
||||
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
|
||||
@@ -13,7 +14,7 @@ val functions = Functions(client)
|
||||
val response = functions.update(
|
||||
functionId = "<FUNCTION_ID>",
|
||||
name = "<NAME>",
|
||||
runtime = "node-14.5", // optional
|
||||
runtime = Runtime.NODE_14_5, // optional
|
||||
execute = listOf("any"), // optional
|
||||
events = listOf(), // optional
|
||||
schedule = "", // optional
|
||||
@@ -22,7 +23,7 @@ val response = functions.update(
|
||||
logging = false, // optional
|
||||
entrypoint = "<ENTRYPOINT>", // optional
|
||||
commands = "<COMMANDS>", // optional
|
||||
scopes = listOf(), // optional
|
||||
scopes = listOf(Scopes.SESSIONS_WRITE), // optional
|
||||
installationId = "<INSTALLATION_ID>", // optional
|
||||
providerRepositoryId = "<PROVIDER_REPOSITORY_ID>", // optional
|
||||
providerBranch = "<PROVIDER_BRANCH>", // optional
|
||||
|
||||
@@ -11,6 +11,6 @@ val client = Client()
|
||||
val health = Health(client)
|
||||
|
||||
val response = health.getFailedJobs(
|
||||
name = Name.V1_DATABASE,
|
||||
name = Name.V1_DATABASE,
|
||||
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
|
||||
contentAvailable = false, // optional
|
||||
critical = false, // optional
|
||||
priority = "normal" // optional
|
||||
priority = MessagePriority.NORMAL // optional
|
||||
)
|
||||
|
||||
@@ -17,7 +17,7 @@ val response = messaging.createSMTPProvider(
|
||||
port = 1, // optional
|
||||
username = "<USERNAME>", // optional
|
||||
password = "<PASSWORD>", // optional
|
||||
encryption = "none", // optional
|
||||
encryption = SmtpEncryption.NONE, // optional
|
||||
autoTLS = false, // optional
|
||||
mailer = "<MAILER>", // optional
|
||||
fromName = "<FROM_NAME>", // optional
|
||||
|
||||
@@ -29,5 +29,5 @@ val response = messaging.updatePush(
|
||||
scheduledAt = "", // optional
|
||||
contentAvailable = false, // optional
|
||||
critical = false, // optional
|
||||
priority = "normal" // optional
|
||||
priority = MessagePriority.NORMAL // optional
|
||||
)
|
||||
|
||||
@@ -17,7 +17,7 @@ val response = messaging.updateSMTPProvider(
|
||||
port = 1, // optional
|
||||
username = "<USERNAME>", // optional
|
||||
password = "<PASSWORD>", // optional
|
||||
encryption = "none", // optional
|
||||
encryption = SmtpEncryption.NONE, // optional
|
||||
autoTLS = false, // optional
|
||||
mailer = "<MAILER>", // optional
|
||||
fromName = "<FROM_NAME>", // optional
|
||||
|
||||
@@ -15,7 +15,7 @@ val response = sites.createTemplateDeployment(
|
||||
repository = "<REPOSITORY>",
|
||||
owner = "<OWNER>",
|
||||
rootDirectory = "<ROOT_DIRECTORY>",
|
||||
type = TemplateReferenceType.BRANCH,
|
||||
type = TemplateReferenceType.BRANCH,
|
||||
reference = "<REFERENCE>",
|
||||
activate = false // optional
|
||||
)
|
||||
|
||||
@@ -12,7 +12,7 @@ val sites = Sites(client)
|
||||
|
||||
val response = sites.createVcsDeployment(
|
||||
siteId = "<SITE_ID>",
|
||||
type = VCSReferenceType.BRANCH,
|
||||
type = VCSReferenceType.BRANCH,
|
||||
reference = "<REFERENCE>",
|
||||
activate = false // optional
|
||||
)
|
||||
|
||||
@@ -15,15 +15,15 @@ val sites = Sites(client)
|
||||
val response = sites.create(
|
||||
siteId = "<SITE_ID>",
|
||||
name = "<NAME>",
|
||||
framework = Framework.ANALOG,
|
||||
buildRuntime = BuildRuntime.NODE_14_5,
|
||||
framework = Framework.ANALOG,
|
||||
buildRuntime = BuildRuntime.NODE_14_5,
|
||||
enabled = false, // optional
|
||||
logging = false, // optional
|
||||
timeout = 1, // optional
|
||||
installCommand = "<INSTALL_COMMAND>", // optional
|
||||
buildCommand = "<BUILD_COMMAND>", // optional
|
||||
outputDirectory = "<OUTPUT_DIRECTORY>", // optional
|
||||
adapter = "static", // optional
|
||||
adapter = Adapter.STATIC, // optional
|
||||
installationId = "<INSTALLATION_ID>", // optional
|
||||
fallbackFile = "<FALLBACK_FILE>", // optional
|
||||
providerRepositoryId = "<PROVIDER_REPOSITORY_ID>", // optional
|
||||
|
||||
@@ -13,5 +13,5 @@ val sites = Sites(client)
|
||||
val result = sites.getDeploymentDownload(
|
||||
siteId = "<SITE_ID>",
|
||||
deploymentId = "<DEPLOYMENT_ID>",
|
||||
type = "source" // optional
|
||||
type = DeploymentDownloadType.SOURCE // optional
|
||||
)
|
||||
|
||||
@@ -15,15 +15,15 @@ val sites = Sites(client)
|
||||
val response = sites.update(
|
||||
siteId = "<SITE_ID>",
|
||||
name = "<NAME>",
|
||||
framework = Framework.ANALOG,
|
||||
framework = Framework.ANALOG,
|
||||
enabled = false, // optional
|
||||
logging = false, // optional
|
||||
timeout = 1, // optional
|
||||
installCommand = "<INSTALL_COMMAND>", // optional
|
||||
buildCommand = "<BUILD_COMMAND>", // optional
|
||||
outputDirectory = "<OUTPUT_DIRECTORY>", // optional
|
||||
buildRuntime = "node-14.5", // optional
|
||||
adapter = "static", // optional
|
||||
buildRuntime = BuildRuntime.NODE_14_5, // optional
|
||||
adapter = Adapter.STATIC, // optional
|
||||
fallbackFile = "<FALLBACK_FILE>", // optional
|
||||
installationId = "<INSTALLATION_ID>", // optional
|
||||
providerRepositoryId = "<PROVIDER_REPOSITORY_ID>", // optional
|
||||
|
||||
@@ -20,7 +20,7 @@ val response = storage.createBucket(
|
||||
enabled = false, // optional
|
||||
maximumFileSize = 1, // optional
|
||||
allowedFileExtensions = listOf(), // optional
|
||||
compression = "none", // optional
|
||||
compression = Compression.NONE, // optional
|
||||
encryption = false, // optional
|
||||
antivirus = false, // optional
|
||||
transformations = false // optional
|
||||
|
||||
@@ -16,7 +16,7 @@ val result = storage.getFilePreview(
|
||||
fileId = "<FILE_ID>",
|
||||
width = 0, // optional
|
||||
height = 0, // optional
|
||||
gravity = "center", // optional
|
||||
gravity = ImageGravity.CENTER, // optional
|
||||
quality = -1, // optional
|
||||
borderWidth = 0, // optional
|
||||
borderColor = "", // optional
|
||||
@@ -24,6 +24,6 @@ val result = storage.getFilePreview(
|
||||
opacity = 0, // optional
|
||||
rotation = -360, // optional
|
||||
background = "", // optional
|
||||
output = "jpg", // optional
|
||||
output = ImageFormat.JPG, // optional
|
||||
token = "<TOKEN>" // optional
|
||||
)
|
||||
|
||||
@@ -20,7 +20,7 @@ val response = storage.updateBucket(
|
||||
enabled = false, // optional
|
||||
maximumFileSize = 1, // optional
|
||||
allowedFileExtensions = listOf(), // optional
|
||||
compression = "none", // optional
|
||||
compression = Compression.NONE, // optional
|
||||
encryption = false, // optional
|
||||
antivirus = false, // optional
|
||||
transformations = false // optional
|
||||
|
||||
@@ -2,6 +2,7 @@ import io.appwrite.Client
|
||||
import io.appwrite.coroutines.CoroutineCallback
|
||||
import io.appwrite.services.TablesDB
|
||||
import io.appwrite.enums.IndexType
|
||||
import io.appwrite.enums.OrderBy
|
||||
|
||||
val client = Client()
|
||||
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
|
||||
@@ -14,8 +15,8 @@ val response = tablesDB.createIndex(
|
||||
databaseId = "<DATABASE_ID>",
|
||||
tableId = "<TABLE_ID>",
|
||||
key = "",
|
||||
type = IndexType.KEY,
|
||||
type = IndexType.KEY,
|
||||
columns = listOf(),
|
||||
orders = listOf(), // optional
|
||||
orders = listOf(OrderBy.ASC), // optional
|
||||
lengths = listOf() // optional
|
||||
)
|
||||
|
||||
@@ -15,9 +15,9 @@ val response = tablesDB.createRelationshipColumn(
|
||||
databaseId = "<DATABASE_ID>",
|
||||
tableId = "<TABLE_ID>",
|
||||
relatedTableId = "<RELATED_TABLE_ID>",
|
||||
type = RelationshipType.ONETOONE,
|
||||
type = RelationshipType.ONETOONE,
|
||||
twoWay = false, // optional
|
||||
key = "", // optional
|
||||
twoWayKey = "", // optional
|
||||
onDelete = "cascade" // optional
|
||||
onDelete = RelationMutate.CASCADE // optional
|
||||
)
|
||||
|
||||
@@ -14,6 +14,6 @@ val response = tablesDB.updateRelationshipColumn(
|
||||
databaseId = "<DATABASE_ID>",
|
||||
tableId = "<TABLE_ID>",
|
||||
key = "",
|
||||
onDelete = "cascade", // optional
|
||||
onDelete = RelationMutate.CASCADE, // optional
|
||||
newKey = "" // optional
|
||||
)
|
||||
|
||||
@@ -15,7 +15,13 @@ val response = tablesDB.updateRow(
|
||||
databaseId = "<DATABASE_ID>",
|
||||
tableId = "<TABLE_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
|
||||
transactionId = "<TRANSACTION_ID>" // optional
|
||||
)
|
||||
|
||||
@@ -12,7 +12,13 @@ val tablesDB = TablesDB(client)
|
||||
val response = tablesDB.updateRows(
|
||||
databaseId = "<DATABASE_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
|
||||
transactionId = "<TRANSACTION_ID>" // optional
|
||||
)
|
||||
|
||||
@@ -14,7 +14,7 @@ val tablesDB = TablesDB(client)
|
||||
val response = tablesDB.updateTable(
|
||||
databaseId = "<DATABASE_ID>",
|
||||
tableId = "<TABLE_ID>",
|
||||
name = "<NAME>",
|
||||
name = "<NAME>", // optional
|
||||
permissions = listOf(Permission.read(Role.any())), // optional
|
||||
rowSecurity = false, // optional
|
||||
enabled = false // optional
|
||||
|
||||
@@ -11,6 +11,6 @@ val tablesDB = TablesDB(client)
|
||||
|
||||
val response = tablesDB.update(
|
||||
databaseId = "<DATABASE_ID>",
|
||||
name = "<NAME>",
|
||||
name = "<NAME>", // optional
|
||||
enabled = false // optional
|
||||
)
|
||||
|
||||
@@ -15,7 +15,13 @@ val response = tablesDB.upsertRow(
|
||||
databaseId = "<DATABASE_ID>",
|
||||
tableId = "<TABLE_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
|
||||
transactionId = "<TRANSACTION_ID>" // optional
|
||||
)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import io.appwrite.Client
|
||||
import io.appwrite.coroutines.CoroutineCallback
|
||||
import io.appwrite.services.Teams
|
||||
import io.appwrite.enums.Roles
|
||||
|
||||
val client = Client()
|
||||
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
|
||||
@@ -11,7 +12,7 @@ val teams = Teams(client)
|
||||
|
||||
val response = teams.createMembership(
|
||||
teamId = "<TEAM_ID>",
|
||||
roles = listOf(),
|
||||
roles = listOf(Roles.ADMIN),
|
||||
email = "email@example.com", // optional
|
||||
userId = "<USER_ID>", // optional
|
||||
phone = "+12065550100", // optional
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import io.appwrite.Client
|
||||
import io.appwrite.coroutines.CoroutineCallback
|
||||
import io.appwrite.services.Teams
|
||||
import io.appwrite.enums.Roles
|
||||
|
||||
val client = Client()
|
||||
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
|
||||
@@ -12,5 +13,5 @@ val teams = Teams(client)
|
||||
val response = teams.updateMembership(
|
||||
teamId = "<TEAM_ID>",
|
||||
membershipId = "<MEMBERSHIP_ID>",
|
||||
roles = listOf()
|
||||
roles = listOf(Roles.ADMIN)
|
||||
)
|
||||
|
||||
@@ -14,6 +14,6 @@ val response = users.createSHAUser(
|
||||
userId = "<USER_ID>",
|
||||
email = "email@example.com",
|
||||
password = "password",
|
||||
passwordVersion = "sha1", // optional
|
||||
passwordVersion = PasswordHash.SHA1, // optional
|
||||
name = "<NAME>" // optional
|
||||
)
|
||||
|
||||
@@ -13,7 +13,7 @@ val users = Users(client)
|
||||
val response = users.createTarget(
|
||||
userId = "<USER_ID>",
|
||||
targetId = "<TARGET_ID>",
|
||||
providerType = MessagingProviderType.EMAIL,
|
||||
providerType = MessagingProviderType.EMAIL,
|
||||
identifier = "<IDENTIFIER>",
|
||||
providerId = "<PROVIDER_ID>", // optional
|
||||
name = "<NAME>" // optional
|
||||
|
||||
@@ -12,5 +12,5 @@ val users = Users(client)
|
||||
|
||||
val response = users.deleteMFAAuthenticator(
|
||||
userId = "<USER_ID>",
|
||||
type = AuthenticatorType.TOTP
|
||||
type = AuthenticatorType.TOTP
|
||||
)
|
||||
|
||||
@@ -54,15 +54,14 @@ class Client @JvmOverloads constructor(
|
||||
|
||||
val config: MutableMap<String, String>
|
||||
|
||||
|
||||
init {
|
||||
headers = mutableMapOf(
|
||||
"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-platform" to "server",
|
||||
"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",
|
||||
)
|
||||
|
||||
|
||||
@@ -15,6 +15,15 @@ class Query(
|
||||
|
||||
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 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()
|
||||
|
||||
/**
|
||||
* 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 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()
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
|
||||
@@ -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"),
|
||||
@SerializedName("ready")
|
||||
READY("ready"),
|
||||
@SerializedName("canceled")
|
||||
CANCELED("canceled"),
|
||||
@SerializedName("failed")
|
||||
FAILED("failed");
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@ enum class Name(val value: String) {
|
||||
V1_CERTIFICATES("v1-certificates"),
|
||||
@SerializedName("v1-builds")
|
||||
V1_BUILDS("v1-builds"),
|
||||
@SerializedName("v1-screenshots")
|
||||
V1_SCREENSHOTS("v1-screenshots"),
|
||||
@SerializedName("v1-messaging")
|
||||
V1_MESSAGING("v1-messaging"),
|
||||
@SerializedName("v1-migrations")
|
||||
|
||||
@@ -80,9 +80,7 @@ enum class OAuthProvider(val value: String) {
|
||||
@SerializedName("zoho")
|
||||
ZOHO("zoho"),
|
||||
@SerializedName("zoom")
|
||||
ZOOM("zoom"),
|
||||
@SerializedName("mock")
|
||||
MOCK("mock");
|
||||
ZOOM("zoom");
|
||||
|
||||
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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -62,7 +62,7 @@ data class Bucket(
|
||||
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")
|
||||
val compression: String,
|
||||
@@ -85,6 +85,12 @@ data class Bucket(
|
||||
@SerializedName("transformations")
|
||||
val transformations: Boolean,
|
||||
|
||||
/**
|
||||
* Total size of this bucket in bytes.
|
||||
*/
|
||||
@SerializedName("totalSize")
|
||||
val totalSize: Long,
|
||||
|
||||
) {
|
||||
fun toMap(): Map<String, Any> = mapOf(
|
||||
"\$id" to id as Any,
|
||||
@@ -100,6 +106,7 @@ data class Bucket(
|
||||
"encryption" to encryption as Any,
|
||||
"antivirus" to antivirus as Any,
|
||||
"transformations" to transformations as Any,
|
||||
"totalSize" to totalSize as Any,
|
||||
)
|
||||
|
||||
companion object {
|
||||
@@ -121,6 +128,7 @@ data class Bucket(
|
||||
encryption = map["encryption"] as Boolean,
|
||||
antivirus = map["antivirus"] as Boolean,
|
||||
transformations = map["transformations"] as Boolean,
|
||||
totalSize = (map["totalSize"] as Number).toLong(),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -93,7 +93,7 @@ data class Deployment(
|
||||
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")
|
||||
val status: DeploymentStatus,
|
||||
|
||||
@@ -73,6 +73,18 @@ data class File(
|
||||
@SerializedName("chunksUploaded")
|
||||
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(
|
||||
"\$id" to id as Any,
|
||||
@@ -86,6 +98,8 @@ data class File(
|
||||
"sizeOriginal" to sizeOriginal as Any,
|
||||
"chunksTotal" to chunksTotal as Any,
|
||||
"chunksUploaded" to chunksUploaded as Any,
|
||||
"encryption" to encryption as Any,
|
||||
"compression" to compression as Any,
|
||||
)
|
||||
|
||||
companion object {
|
||||
@@ -105,6 +119,8 @@ data class File(
|
||||
sizeOriginal = (map["sizeOriginal"] as Number).toLong(),
|
||||
chunksTotal = (map["chunksTotal"] 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.
|
||||
*
|
||||
* @param duration Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.
|
||||
* @return [io.appwrite.models.Jwt]
|
||||
*/
|
||||
@JvmOverloads
|
||||
@Throws(AppwriteException::class)
|
||||
suspend fun createJWT(
|
||||
duration: Long? = null,
|
||||
): io.appwrite.models.Jwt {
|
||||
val apiPath = "/account/jwts"
|
||||
|
||||
val apiParams = mutableMapOf<String, Any?>(
|
||||
"duration" to duration,
|
||||
)
|
||||
val apiHeaders = mutableMapOf<String, String>(
|
||||
"content-type" to "application/json",
|
||||
|
||||
@@ -313,12 +313,12 @@ class Avatars(client: Client) : Service(client) {
|
||||
longitude: Double? = null,
|
||||
accuracy: Double? = null,
|
||||
touch: Boolean? = null,
|
||||
permissions: List<String>? = null,
|
||||
permissions: List<io.appwrite.enums.BrowserPermission>? = null,
|
||||
sleep: Long? = null,
|
||||
width: Long? = null,
|
||||
height: Long? = null,
|
||||
quality: Long? = null,
|
||||
output: io.appwrite.enums.Output? = null,
|
||||
output: io.appwrite.enums.ImageFormat? = null,
|
||||
): ByteArray {
|
||||
val apiPath = "/avatars/screenshots"
|
||||
|
||||
|
||||
@@ -340,7 +340,7 @@ class Databases(client: Client) : Service(client) {
|
||||
@Throws(AppwriteException::class)
|
||||
suspend fun update(
|
||||
databaseId: String,
|
||||
name: String,
|
||||
name: String? = null,
|
||||
enabled: Boolean? = null,
|
||||
): io.appwrite.models.Database {
|
||||
val apiPath = "/databases/{databaseId}"
|
||||
@@ -555,7 +555,7 @@ class Databases(client: Client) : Service(client) {
|
||||
suspend fun updateCollection(
|
||||
databaseId: String,
|
||||
collectionId: String,
|
||||
name: String,
|
||||
name: String? = null,
|
||||
permissions: List<String>? = null,
|
||||
documentSecurity: Boolean? = null,
|
||||
enabled: Boolean? = null,
|
||||
@@ -2018,12 +2018,16 @@ class Databases(client: Client) : Service(client) {
|
||||
)
|
||||
val apiHeaders = mutableMapOf<String, String>(
|
||||
)
|
||||
val converter: (Any) -> Any = {
|
||||
io.appwrite.models.AttributeBoolean.from(map = it as Map<String, Any>)
|
||||
}
|
||||
return client.call(
|
||||
"GET",
|
||||
apiPath,
|
||||
apiHeaders,
|
||||
apiParams,
|
||||
responseType = Any::class.java,
|
||||
converter,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2682,7 +2686,7 @@ class Databases(client: Client) : Service(client) {
|
||||
databaseId: String,
|
||||
collectionId: String,
|
||||
documentId: String,
|
||||
data: Any,
|
||||
data: Any? = null,
|
||||
permissions: List<String>? = null,
|
||||
transactionId: String? = null,
|
||||
nestedType: Class<T>,
|
||||
@@ -2734,7 +2738,7 @@ class Databases(client: Client) : Service(client) {
|
||||
databaseId: String,
|
||||
collectionId: String,
|
||||
documentId: String,
|
||||
data: Any,
|
||||
data: Any? = null,
|
||||
permissions: List<String>? = null,
|
||||
transactionId: String? = null,
|
||||
): io.appwrite.models.Document<Map<String, Any>> = upsertDocument(
|
||||
@@ -3127,7 +3131,7 @@ class Databases(client: Client) : Service(client) {
|
||||
key: String,
|
||||
type: io.appwrite.enums.IndexType,
|
||||
attributes: List<String>,
|
||||
orders: List<String>? = null,
|
||||
orders: List<io.appwrite.enums.OrderBy>? = null,
|
||||
lengths: List<Long>? = null,
|
||||
): io.appwrite.models.Index {
|
||||
val apiPath = "/databases/{databaseId}/collections/{collectionId}/indexes"
|
||||
|
||||
@@ -89,7 +89,7 @@ class Functions(client: Client) : Service(client) {
|
||||
logging: Boolean? = null,
|
||||
entrypoint: String? = null,
|
||||
commands: String? = null,
|
||||
scopes: List<String>? = null,
|
||||
scopes: List<io.appwrite.enums.Scopes>? = null,
|
||||
installationId: String? = null,
|
||||
providerRepositoryId: String? = null,
|
||||
providerBranch: String? = null,
|
||||
@@ -256,7 +256,7 @@ class Functions(client: Client) : Service(client) {
|
||||
logging: Boolean? = null,
|
||||
entrypoint: String? = null,
|
||||
commands: String? = null,
|
||||
scopes: List<String>? = null,
|
||||
scopes: List<io.appwrite.enums.Scopes>? = null,
|
||||
installationId: String? = null,
|
||||
providerRepositoryId: String? = null,
|
||||
providerBranch: String? = null,
|
||||
|
||||
@@ -70,26 +70,26 @@ class Health(client: Client) : Service(client) {
|
||||
/**
|
||||
* 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)
|
||||
suspend fun getCache(
|
||||
): io.appwrite.models.HealthStatus {
|
||||
): io.appwrite.models.HealthStatusList {
|
||||
val apiPath = "/health/cache"
|
||||
|
||||
val apiParams = mutableMapOf<String, Any?>(
|
||||
)
|
||||
val apiHeaders = mutableMapOf<String, String>(
|
||||
)
|
||||
val converter: (Any) -> io.appwrite.models.HealthStatus = {
|
||||
io.appwrite.models.HealthStatus.from(map = it as Map<String, Any>)
|
||||
val converter: (Any) -> io.appwrite.models.HealthStatusList = {
|
||||
io.appwrite.models.HealthStatusList.from(map = it as Map<String, Any>)
|
||||
}
|
||||
return client.call(
|
||||
"GET",
|
||||
apiPath,
|
||||
apiHeaders,
|
||||
apiParams,
|
||||
responseType = io.appwrite.models.HealthStatus::class.java,
|
||||
responseType = io.appwrite.models.HealthStatusList::class.java,
|
||||
converter,
|
||||
)
|
||||
}
|
||||
@@ -128,26 +128,26 @@ class Health(client: Client) : Service(client) {
|
||||
/**
|
||||
* Check the Appwrite database servers are up and connection is successful.
|
||||
*
|
||||
* @return [io.appwrite.models.HealthStatus]
|
||||
* @return [io.appwrite.models.HealthStatusList]
|
||||
*/
|
||||
@Throws(AppwriteException::class)
|
||||
suspend fun getDB(
|
||||
): io.appwrite.models.HealthStatus {
|
||||
): io.appwrite.models.HealthStatusList {
|
||||
val apiPath = "/health/db"
|
||||
|
||||
val apiParams = mutableMapOf<String, Any?>(
|
||||
)
|
||||
val apiHeaders = mutableMapOf<String, String>(
|
||||
)
|
||||
val converter: (Any) -> io.appwrite.models.HealthStatus = {
|
||||
io.appwrite.models.HealthStatus.from(map = it as Map<String, Any>)
|
||||
val converter: (Any) -> io.appwrite.models.HealthStatusList = {
|
||||
io.appwrite.models.HealthStatusList.from(map = it as Map<String, Any>)
|
||||
}
|
||||
return client.call(
|
||||
"GET",
|
||||
apiPath,
|
||||
apiHeaders,
|
||||
apiParams,
|
||||
responseType = io.appwrite.models.HealthStatus::class.java,
|
||||
responseType = io.appwrite.models.HealthStatusList::class.java,
|
||||
converter,
|
||||
)
|
||||
}
|
||||
@@ -155,26 +155,57 @@ class Health(client: Client) : Service(client) {
|
||||
/**
|
||||
* 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)
|
||||
suspend fun getPubSub(
|
||||
): io.appwrite.models.HealthStatus {
|
||||
): io.appwrite.models.HealthStatusList {
|
||||
val apiPath = "/health/pubsub"
|
||||
|
||||
val apiParams = mutableMapOf<String, Any?>(
|
||||
)
|
||||
val apiHeaders = mutableMapOf<String, String>(
|
||||
)
|
||||
val converter: (Any) -> io.appwrite.models.HealthStatus = {
|
||||
io.appwrite.models.HealthStatus.from(map = it as Map<String, Any>)
|
||||
val converter: (Any) -> io.appwrite.models.HealthStatusList = {
|
||||
io.appwrite.models.HealthStatusList.from(map = it as Map<String, Any>)
|
||||
}
|
||||
return client.call(
|
||||
"GET",
|
||||
apiPath,
|
||||
apiHeaders,
|
||||
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,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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 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 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 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?
|
||||
@@ -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 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 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 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?
|
||||
@@ -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.
|
||||
*
|
||||
* @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 fileId File unique ID.
|
||||
* @param name Name of the file
|
||||
* @param permissions An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
||||
* @param bucketId Bucket unique ID.
|
||||
* @param fileId File ID.
|
||||
* @param name File name.
|
||||
* @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]
|
||||
*/
|
||||
@JvmOverloads
|
||||
|
||||
@@ -324,7 +324,7 @@ class TablesDB(client: Client) : Service(client) {
|
||||
@Throws(AppwriteException::class)
|
||||
suspend fun update(
|
||||
databaseId: String,
|
||||
name: String,
|
||||
name: String? = null,
|
||||
enabled: Boolean? = null,
|
||||
): io.appwrite.models.Database {
|
||||
val apiPath = "/tablesdb/{databaseId}"
|
||||
@@ -519,7 +519,7 @@ class TablesDB(client: Client) : Service(client) {
|
||||
suspend fun updateTable(
|
||||
databaseId: String,
|
||||
tableId: String,
|
||||
name: String,
|
||||
name: String? = null,
|
||||
permissions: List<String>? = null,
|
||||
rowSecurity: Boolean? = null,
|
||||
enabled: Boolean? = null,
|
||||
@@ -1869,12 +1869,16 @@ class TablesDB(client: Client) : Service(client) {
|
||||
)
|
||||
val apiHeaders = mutableMapOf<String, String>(
|
||||
)
|
||||
val converter: (Any) -> Any = {
|
||||
io.appwrite.models.ColumnBoolean.from(map = it as Map<String, Any>)
|
||||
}
|
||||
return client.call(
|
||||
"GET",
|
||||
apiPath,
|
||||
apiHeaders,
|
||||
apiParams,
|
||||
responseType = Any::class.java,
|
||||
converter,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2017,7 +2021,7 @@ class TablesDB(client: Client) : Service(client) {
|
||||
key: String,
|
||||
type: io.appwrite.enums.IndexType,
|
||||
columns: List<String>,
|
||||
orders: List<String>? = null,
|
||||
orders: List<io.appwrite.enums.OrderBy>? = null,
|
||||
lengths: List<Long>? = null,
|
||||
): io.appwrite.models.ColumnIndex {
|
||||
val apiPath = "/tablesdb/{databaseId}/tables/{tableId}/indexes"
|
||||
|
||||
@@ -319,7 +319,7 @@ class Teams(client: Client) : Service(client) {
|
||||
@Throws(AppwriteException::class)
|
||||
suspend fun createMembership(
|
||||
teamId: String,
|
||||
roles: List<String>,
|
||||
roles: List<io.appwrite.enums.Roles>,
|
||||
email: String? = null,
|
||||
userId: String? = null,
|
||||
phone: String? = null,
|
||||
@@ -399,7 +399,7 @@ class Teams(client: Client) : Service(client) {
|
||||
suspend fun updateMembership(
|
||||
teamId: String,
|
||||
membershipId: String,
|
||||
roles: List<String>,
|
||||
roles: List<io.appwrite.enums.Roles>,
|
||||
): io.appwrite.models.Membership {
|
||||
val apiPath = "/teams/{teamId}/memberships/{membershipId}"
|
||||
.replace("{teamId}", teamId)
|
||||
|
||||
Reference in New Issue
Block a user