mirror of
https://github.com/appwrite/sdk-for-kotlin.git
synced 2026-04-07 19:17:44 +00:00
Merge pull request #71 from appwrite/dev
This commit is contained in:
@@ -1,5 +1,12 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## 15.0.0
|
||||||
|
|
||||||
|
* [BREAKING] Changed `$sequence` type from `int` to `string` for rows and documents
|
||||||
|
* Breaking: Renamed `IndexType` to `DatabasesIndexType` in docs.
|
||||||
|
* Breaking: Replaced `.setKey()` with `.setSession()` in docs examples.
|
||||||
|
* Updated: Updated docs to reflect new `DatabasesIndexType` examples.
|
||||||
|
|
||||||
## 14.1.0
|
## 14.1.0
|
||||||
|
|
||||||
* Added getConsolePausing health status endpoint
|
* Added getConsolePausing health status endpoint
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
[](https://twitter.com/appwrite)
|
[](https://twitter.com/appwrite)
|
||||||
[](https://appwrite.io/discord)
|
[](https://appwrite.io/discord)
|
||||||
|
|
||||||
**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-kotlin/releases).**
|
**This SDK is compatible with Appwrite server version 1.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-kotlin/releases).**
|
||||||
|
|
||||||
> This is the Kotlin SDK for integrating with Appwrite from your Kotlin server-side code. If you're looking for the Android SDK you should check [appwrite/sdk-for-android](https://github.com/appwrite/sdk-for-android)
|
> This is the Kotlin SDK for integrating with Appwrite from your Kotlin server-side code. If you're looking for the Android SDK you should check [appwrite/sdk-for-android](https://github.com/appwrite/sdk-for-android)
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ repositories {
|
|||||||
Next, add the dependency to your project's `build.gradle(.kts)` file:
|
Next, add the dependency to your project's `build.gradle(.kts)` file:
|
||||||
|
|
||||||
```groovy
|
```groovy
|
||||||
implementation("io.appwrite:sdk-for-kotlin:14.1.0")
|
implementation("io.appwrite:sdk-for-kotlin:15.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>14.1.0</version>
|
<version>15.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import io.appwrite.Client;
|
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.DatabasesIndexType;
|
||||||
import io.appwrite.enums.OrderBy;
|
import io.appwrite.enums.OrderBy;
|
||||||
|
|
||||||
Client client = new Client()
|
Client client = new Client()
|
||||||
@@ -16,7 +16,7 @@ databases.createIndex(
|
|||||||
"<DATABASE_ID>", // databaseId
|
"<DATABASE_ID>", // databaseId
|
||||||
"<COLLECTION_ID>", // collectionId
|
"<COLLECTION_ID>", // collectionId
|
||||||
"", // key
|
"", // key
|
||||||
IndexType.KEY, // type
|
DatabasesIndexType.KEY, // type
|
||||||
List.of(), // attributes
|
List.of(), // attributes
|
||||||
List.of(OrderBy.ASC), // orders (optional)
|
List.of(OrderBy.ASC), // orders (optional)
|
||||||
List.of(), // lengths (optional)
|
List.of(), // lengths (optional)
|
||||||
|
|||||||
@@ -30,7 +30,9 @@ functions.create(
|
|||||||
"<PROVIDER_BRANCH>", // providerBranch (optional)
|
"<PROVIDER_BRANCH>", // providerBranch (optional)
|
||||||
false, // providerSilentMode (optional)
|
false, // providerSilentMode (optional)
|
||||||
"<PROVIDER_ROOT_DIRECTORY>", // providerRootDirectory (optional)
|
"<PROVIDER_ROOT_DIRECTORY>", // providerRootDirectory (optional)
|
||||||
"", // specification (optional)
|
"", // buildSpecification (optional)
|
||||||
|
"", // runtimeSpecification (optional)
|
||||||
|
0, // deploymentRetention (optional)
|
||||||
new CoroutineCallback<>((result, error) -> {
|
new CoroutineCallback<>((result, error) -> {
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
error.printStackTrace();
|
error.printStackTrace();
|
||||||
|
|||||||
@@ -30,7 +30,9 @@ functions.update(
|
|||||||
"<PROVIDER_BRANCH>", // providerBranch (optional)
|
"<PROVIDER_BRANCH>", // providerBranch (optional)
|
||||||
false, // providerSilentMode (optional)
|
false, // providerSilentMode (optional)
|
||||||
"<PROVIDER_ROOT_DIRECTORY>", // providerRootDirectory (optional)
|
"<PROVIDER_ROOT_DIRECTORY>", // providerRootDirectory (optional)
|
||||||
"", // specification (optional)
|
"", // buildSpecification (optional)
|
||||||
|
"", // runtimeSpecification (optional)
|
||||||
|
0, // deploymentRetention (optional)
|
||||||
new CoroutineCallback<>((result, error) -> {
|
new CoroutineCallback<>((result, error) -> {
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
error.printStackTrace();
|
error.printStackTrace();
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
```java
|
||||||
|
import io.appwrite.Client;
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback;
|
||||||
|
import io.appwrite.services.Project;
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
Project project = new Project(client);
|
||||||
|
|
||||||
|
project.createVariable(
|
||||||
|
"<VARIABLE_ID>", // variableId
|
||||||
|
"<KEY>", // key
|
||||||
|
"<VALUE>", // value
|
||||||
|
false, // secret (optional)
|
||||||
|
new CoroutineCallback<>((result, error) -> {
|
||||||
|
if (error != null) {
|
||||||
|
error.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(result);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
```
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
```java
|
||||||
|
import io.appwrite.Client;
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback;
|
||||||
|
import io.appwrite.services.Project;
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
Project project = new Project(client);
|
||||||
|
|
||||||
|
project.deleteVariable(
|
||||||
|
"<VARIABLE_ID>", // variableId
|
||||||
|
new CoroutineCallback<>((result, error) -> {
|
||||||
|
if (error != null) {
|
||||||
|
error.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(result);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
```
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
```java
|
||||||
|
import io.appwrite.Client;
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback;
|
||||||
|
import io.appwrite.services.Project;
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
Project project = new Project(client);
|
||||||
|
|
||||||
|
project.getVariable(
|
||||||
|
"<VARIABLE_ID>", // variableId
|
||||||
|
new CoroutineCallback<>((result, error) -> {
|
||||||
|
if (error != null) {
|
||||||
|
error.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(result);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
```
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
```java
|
||||||
|
import io.appwrite.Client;
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback;
|
||||||
|
import io.appwrite.services.Project;
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
Project project = new Project(client);
|
||||||
|
|
||||||
|
project.listVariables(
|
||||||
|
List.of(), // queries (optional)
|
||||||
|
false, // total (optional)
|
||||||
|
new CoroutineCallback<>((result, error) -> {
|
||||||
|
if (error != null) {
|
||||||
|
error.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(result);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
```
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
```java
|
||||||
|
import io.appwrite.Client;
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback;
|
||||||
|
import io.appwrite.services.Project;
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
Project project = new Project(client);
|
||||||
|
|
||||||
|
project.updateVariable(
|
||||||
|
"<VARIABLE_ID>", // variableId
|
||||||
|
"<KEY>", // key (optional)
|
||||||
|
"<VALUE>", // value (optional)
|
||||||
|
false, // secret (optional)
|
||||||
|
new CoroutineCallback<>((result, error) -> {
|
||||||
|
if (error != null) {
|
||||||
|
error.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(result);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
```
|
||||||
@@ -23,6 +23,7 @@ sites.create(
|
|||||||
1, // timeout (optional)
|
1, // timeout (optional)
|
||||||
"<INSTALL_COMMAND>", // installCommand (optional)
|
"<INSTALL_COMMAND>", // installCommand (optional)
|
||||||
"<BUILD_COMMAND>", // buildCommand (optional)
|
"<BUILD_COMMAND>", // buildCommand (optional)
|
||||||
|
"<START_COMMAND>", // startCommand (optional)
|
||||||
"<OUTPUT_DIRECTORY>", // outputDirectory (optional)
|
"<OUTPUT_DIRECTORY>", // outputDirectory (optional)
|
||||||
Adapter.STATIC, // adapter (optional)
|
Adapter.STATIC, // adapter (optional)
|
||||||
"<INSTALLATION_ID>", // installationId (optional)
|
"<INSTALLATION_ID>", // installationId (optional)
|
||||||
@@ -31,7 +32,9 @@ sites.create(
|
|||||||
"<PROVIDER_BRANCH>", // providerBranch (optional)
|
"<PROVIDER_BRANCH>", // providerBranch (optional)
|
||||||
false, // providerSilentMode (optional)
|
false, // providerSilentMode (optional)
|
||||||
"<PROVIDER_ROOT_DIRECTORY>", // providerRootDirectory (optional)
|
"<PROVIDER_ROOT_DIRECTORY>", // providerRootDirectory (optional)
|
||||||
"", // specification (optional)
|
"", // buildSpecification (optional)
|
||||||
|
"", // runtimeSpecification (optional)
|
||||||
|
0, // deploymentRetention (optional)
|
||||||
new CoroutineCallback<>((result, error) -> {
|
new CoroutineCallback<>((result, error) -> {
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
error.printStackTrace();
|
error.printStackTrace();
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ sites.update(
|
|||||||
1, // timeout (optional)
|
1, // timeout (optional)
|
||||||
"<INSTALL_COMMAND>", // installCommand (optional)
|
"<INSTALL_COMMAND>", // installCommand (optional)
|
||||||
"<BUILD_COMMAND>", // buildCommand (optional)
|
"<BUILD_COMMAND>", // buildCommand (optional)
|
||||||
|
"<START_COMMAND>", // startCommand (optional)
|
||||||
"<OUTPUT_DIRECTORY>", // outputDirectory (optional)
|
"<OUTPUT_DIRECTORY>", // outputDirectory (optional)
|
||||||
BuildRuntime.NODE_14_5, // buildRuntime (optional)
|
BuildRuntime.NODE_14_5, // buildRuntime (optional)
|
||||||
Adapter.STATIC, // adapter (optional)
|
Adapter.STATIC, // adapter (optional)
|
||||||
@@ -31,7 +32,9 @@ sites.update(
|
|||||||
"<PROVIDER_BRANCH>", // providerBranch (optional)
|
"<PROVIDER_BRANCH>", // providerBranch (optional)
|
||||||
false, // providerSilentMode (optional)
|
false, // providerSilentMode (optional)
|
||||||
"<PROVIDER_ROOT_DIRECTORY>", // providerRootDirectory (optional)
|
"<PROVIDER_ROOT_DIRECTORY>", // providerRootDirectory (optional)
|
||||||
"", // specification (optional)
|
"", // buildSpecification (optional)
|
||||||
|
"", // runtimeSpecification (optional)
|
||||||
|
0, // deploymentRetention (optional)
|
||||||
new CoroutineCallback<>((result, error) -> {
|
new CoroutineCallback<>((result, error) -> {
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
error.printStackTrace();
|
error.printStackTrace();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import io.appwrite.Client;
|
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.TablesDBIndexType;
|
||||||
import io.appwrite.enums.OrderBy;
|
import io.appwrite.enums.OrderBy;
|
||||||
|
|
||||||
Client client = new Client()
|
Client client = new Client()
|
||||||
@@ -16,7 +16,7 @@ tablesDB.createIndex(
|
|||||||
"<DATABASE_ID>", // databaseId
|
"<DATABASE_ID>", // databaseId
|
||||||
"<TABLE_ID>", // tableId
|
"<TABLE_ID>", // tableId
|
||||||
"", // key
|
"", // key
|
||||||
IndexType.KEY, // type
|
TablesDBIndexType.KEY, // type
|
||||||
List.of(), // columns
|
List.of(), // columns
|
||||||
List.of(OrderBy.ASC), // orders (optional)
|
List.of(OrderBy.ASC), // orders (optional)
|
||||||
List.of(), // lengths (optional)
|
List.of(), // lengths (optional)
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
```java
|
||||||
|
import io.appwrite.Client;
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback;
|
||||||
|
import io.appwrite.services.Users;
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
Users users = new Users(client);
|
||||||
|
|
||||||
|
users.updateImpersonator(
|
||||||
|
"<USER_ID>", // userId
|
||||||
|
false, // impersonator
|
||||||
|
new CoroutineCallback<>((result, error) -> {
|
||||||
|
if (error != null) {
|
||||||
|
error.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(result);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
```
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
```java
|
||||||
|
import io.appwrite.Client;
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback;
|
||||||
|
import io.appwrite.services.Webhooks;
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
Webhooks webhooks = new Webhooks(client);
|
||||||
|
|
||||||
|
webhooks.create(
|
||||||
|
"<WEBHOOK_ID>", // webhookId
|
||||||
|
"", // url
|
||||||
|
"<NAME>", // name
|
||||||
|
List.of(), // events
|
||||||
|
false, // enabled (optional)
|
||||||
|
false, // security (optional)
|
||||||
|
"<HTTP_USER>", // httpUser (optional)
|
||||||
|
"<HTTP_PASS>", // httpPass (optional)
|
||||||
|
new CoroutineCallback<>((result, error) -> {
|
||||||
|
if (error != null) {
|
||||||
|
error.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(result);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
```
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
```java
|
||||||
|
import io.appwrite.Client;
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback;
|
||||||
|
import io.appwrite.services.Webhooks;
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
Webhooks webhooks = new Webhooks(client);
|
||||||
|
|
||||||
|
webhooks.delete(
|
||||||
|
"<WEBHOOK_ID>", // webhookId
|
||||||
|
new CoroutineCallback<>((result, error) -> {
|
||||||
|
if (error != null) {
|
||||||
|
error.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(result);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
```
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
```java
|
||||||
|
import io.appwrite.Client;
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback;
|
||||||
|
import io.appwrite.services.Webhooks;
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
Webhooks webhooks = new Webhooks(client);
|
||||||
|
|
||||||
|
webhooks.get(
|
||||||
|
"<WEBHOOK_ID>", // webhookId
|
||||||
|
new CoroutineCallback<>((result, error) -> {
|
||||||
|
if (error != null) {
|
||||||
|
error.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(result);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
```
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
```java
|
||||||
|
import io.appwrite.Client;
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback;
|
||||||
|
import io.appwrite.services.Webhooks;
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
Webhooks webhooks = new Webhooks(client);
|
||||||
|
|
||||||
|
webhooks.list(
|
||||||
|
List.of(), // queries (optional)
|
||||||
|
false, // total (optional)
|
||||||
|
new CoroutineCallback<>((result, error) -> {
|
||||||
|
if (error != null) {
|
||||||
|
error.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(result);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
```
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
```java
|
||||||
|
import io.appwrite.Client;
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback;
|
||||||
|
import io.appwrite.services.Webhooks;
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
Webhooks webhooks = new Webhooks(client);
|
||||||
|
|
||||||
|
webhooks.updateSignature(
|
||||||
|
"<WEBHOOK_ID>", // webhookId
|
||||||
|
new CoroutineCallback<>((result, error) -> {
|
||||||
|
if (error != null) {
|
||||||
|
error.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(result);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
```
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
```java
|
||||||
|
import io.appwrite.Client;
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback;
|
||||||
|
import io.appwrite.services.Webhooks;
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
Webhooks webhooks = new Webhooks(client);
|
||||||
|
|
||||||
|
webhooks.update(
|
||||||
|
"<WEBHOOK_ID>", // webhookId
|
||||||
|
"<NAME>", // name
|
||||||
|
"", // url
|
||||||
|
List.of(), // events
|
||||||
|
false, // enabled (optional)
|
||||||
|
false, // security (optional)
|
||||||
|
"<HTTP_USER>", // httpUser (optional)
|
||||||
|
"<HTTP_PASS>", // httpPass (optional)
|
||||||
|
new CoroutineCallback<>((result, error) -> {
|
||||||
|
if (error != null) {
|
||||||
|
error.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(result);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
```
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
import io.appwrite.Client
|
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.DatabasesIndexType
|
||||||
import io.appwrite.enums.OrderBy
|
import io.appwrite.enums.OrderBy
|
||||||
|
|
||||||
val client = Client()
|
val client = Client()
|
||||||
@@ -16,7 +16,7 @@ val response = databases.createIndex(
|
|||||||
databaseId = "<DATABASE_ID>",
|
databaseId = "<DATABASE_ID>",
|
||||||
collectionId = "<COLLECTION_ID>",
|
collectionId = "<COLLECTION_ID>",
|
||||||
key = "",
|
key = "",
|
||||||
type = IndexType.KEY,
|
type = DatabasesIndexType.KEY,
|
||||||
attributes = listOf(),
|
attributes = listOf(),
|
||||||
orders = listOf(OrderBy.ASC), // optional
|
orders = listOf(OrderBy.ASC), // optional
|
||||||
lengths = listOf() // optional
|
lengths = listOf() // optional
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ val response = functions.create(
|
|||||||
providerBranch = "<PROVIDER_BRANCH>", // optional
|
providerBranch = "<PROVIDER_BRANCH>", // optional
|
||||||
providerSilentMode = false, // optional
|
providerSilentMode = false, // optional
|
||||||
providerRootDirectory = "<PROVIDER_ROOT_DIRECTORY>", // optional
|
providerRootDirectory = "<PROVIDER_ROOT_DIRECTORY>", // optional
|
||||||
specification = "" // optional
|
buildSpecification = "", // optional
|
||||||
|
runtimeSpecification = "", // optional
|
||||||
|
deploymentRetention = 0 // optional
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ val response = functions.update(
|
|||||||
providerBranch = "<PROVIDER_BRANCH>", // optional
|
providerBranch = "<PROVIDER_BRANCH>", // optional
|
||||||
providerSilentMode = false, // optional
|
providerSilentMode = false, // optional
|
||||||
providerRootDirectory = "<PROVIDER_ROOT_DIRECTORY>", // optional
|
providerRootDirectory = "<PROVIDER_ROOT_DIRECTORY>", // optional
|
||||||
specification = "" // optional
|
buildSpecification = "", // optional
|
||||||
|
runtimeSpecification = "", // optional
|
||||||
|
deploymentRetention = 0 // optional
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
```kotlin
|
||||||
|
import io.appwrite.Client
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback
|
||||||
|
import io.appwrite.services.Project
|
||||||
|
|
||||||
|
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 project = Project(client)
|
||||||
|
|
||||||
|
val response = project.createVariable(
|
||||||
|
variableId = "<VARIABLE_ID>",
|
||||||
|
key = "<KEY>",
|
||||||
|
value = "<VALUE>",
|
||||||
|
secret = false // optional
|
||||||
|
)
|
||||||
|
```
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
```kotlin
|
||||||
|
import io.appwrite.Client
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback
|
||||||
|
import io.appwrite.services.Project
|
||||||
|
|
||||||
|
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 project = Project(client)
|
||||||
|
|
||||||
|
val response = project.deleteVariable(
|
||||||
|
variableId = "<VARIABLE_ID>"
|
||||||
|
)
|
||||||
|
```
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
```kotlin
|
||||||
|
import io.appwrite.Client
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback
|
||||||
|
import io.appwrite.services.Project
|
||||||
|
|
||||||
|
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 project = Project(client)
|
||||||
|
|
||||||
|
val response = project.getVariable(
|
||||||
|
variableId = "<VARIABLE_ID>"
|
||||||
|
)
|
||||||
|
```
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
```kotlin
|
||||||
|
import io.appwrite.Client
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback
|
||||||
|
import io.appwrite.services.Project
|
||||||
|
|
||||||
|
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 project = Project(client)
|
||||||
|
|
||||||
|
val response = project.listVariables(
|
||||||
|
queries = listOf(), // optional
|
||||||
|
total = false // optional
|
||||||
|
)
|
||||||
|
```
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
```kotlin
|
||||||
|
import io.appwrite.Client
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback
|
||||||
|
import io.appwrite.services.Project
|
||||||
|
|
||||||
|
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 project = Project(client)
|
||||||
|
|
||||||
|
val response = project.updateVariable(
|
||||||
|
variableId = "<VARIABLE_ID>",
|
||||||
|
key = "<KEY>", // optional
|
||||||
|
value = "<VALUE>", // optional
|
||||||
|
secret = false // optional
|
||||||
|
)
|
||||||
|
```
|
||||||
@@ -23,6 +23,7 @@ val response = sites.create(
|
|||||||
timeout = 1, // optional
|
timeout = 1, // optional
|
||||||
installCommand = "<INSTALL_COMMAND>", // optional
|
installCommand = "<INSTALL_COMMAND>", // optional
|
||||||
buildCommand = "<BUILD_COMMAND>", // optional
|
buildCommand = "<BUILD_COMMAND>", // optional
|
||||||
|
startCommand = "<START_COMMAND>", // optional
|
||||||
outputDirectory = "<OUTPUT_DIRECTORY>", // optional
|
outputDirectory = "<OUTPUT_DIRECTORY>", // optional
|
||||||
adapter = Adapter.STATIC, // optional
|
adapter = Adapter.STATIC, // optional
|
||||||
installationId = "<INSTALLATION_ID>", // optional
|
installationId = "<INSTALLATION_ID>", // optional
|
||||||
@@ -31,6 +32,8 @@ val response = sites.create(
|
|||||||
providerBranch = "<PROVIDER_BRANCH>", // optional
|
providerBranch = "<PROVIDER_BRANCH>", // optional
|
||||||
providerSilentMode = false, // optional
|
providerSilentMode = false, // optional
|
||||||
providerRootDirectory = "<PROVIDER_ROOT_DIRECTORY>", // optional
|
providerRootDirectory = "<PROVIDER_ROOT_DIRECTORY>", // optional
|
||||||
specification = "" // optional
|
buildSpecification = "", // optional
|
||||||
|
runtimeSpecification = "", // optional
|
||||||
|
deploymentRetention = 0 // optional
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ val response = sites.update(
|
|||||||
timeout = 1, // optional
|
timeout = 1, // optional
|
||||||
installCommand = "<INSTALL_COMMAND>", // optional
|
installCommand = "<INSTALL_COMMAND>", // optional
|
||||||
buildCommand = "<BUILD_COMMAND>", // optional
|
buildCommand = "<BUILD_COMMAND>", // optional
|
||||||
|
startCommand = "<START_COMMAND>", // optional
|
||||||
outputDirectory = "<OUTPUT_DIRECTORY>", // optional
|
outputDirectory = "<OUTPUT_DIRECTORY>", // optional
|
||||||
buildRuntime = BuildRuntime.NODE_14_5, // optional
|
buildRuntime = BuildRuntime.NODE_14_5, // optional
|
||||||
adapter = Adapter.STATIC, // optional
|
adapter = Adapter.STATIC, // optional
|
||||||
@@ -31,6 +32,8 @@ val response = sites.update(
|
|||||||
providerBranch = "<PROVIDER_BRANCH>", // optional
|
providerBranch = "<PROVIDER_BRANCH>", // optional
|
||||||
providerSilentMode = false, // optional
|
providerSilentMode = false, // optional
|
||||||
providerRootDirectory = "<PROVIDER_ROOT_DIRECTORY>", // optional
|
providerRootDirectory = "<PROVIDER_ROOT_DIRECTORY>", // optional
|
||||||
specification = "" // optional
|
buildSpecification = "", // optional
|
||||||
|
runtimeSpecification = "", // optional
|
||||||
|
deploymentRetention = 0 // optional
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import io.appwrite.Client
|
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.TablesDBIndexType
|
||||||
import io.appwrite.enums.OrderBy
|
import io.appwrite.enums.OrderBy
|
||||||
|
|
||||||
val client = Client()
|
val client = Client()
|
||||||
@@ -16,7 +16,7 @@ val response = tablesDB.createIndex(
|
|||||||
databaseId = "<DATABASE_ID>",
|
databaseId = "<DATABASE_ID>",
|
||||||
tableId = "<TABLE_ID>",
|
tableId = "<TABLE_ID>",
|
||||||
key = "",
|
key = "",
|
||||||
type = IndexType.KEY,
|
type = TablesDBIndexType.KEY,
|
||||||
columns = listOf(),
|
columns = listOf(),
|
||||||
orders = listOf(OrderBy.ASC), // optional
|
orders = listOf(OrderBy.ASC), // optional
|
||||||
lengths = listOf() // optional
|
lengths = listOf() // optional
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
```kotlin
|
||||||
|
import io.appwrite.Client
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback
|
||||||
|
import io.appwrite.services.Users
|
||||||
|
|
||||||
|
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 users = Users(client)
|
||||||
|
|
||||||
|
val response = users.updateImpersonator(
|
||||||
|
userId = "<USER_ID>",
|
||||||
|
impersonator = false
|
||||||
|
)
|
||||||
|
```
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
```kotlin
|
||||||
|
import io.appwrite.Client
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback
|
||||||
|
import io.appwrite.services.Webhooks
|
||||||
|
|
||||||
|
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 webhooks = Webhooks(client)
|
||||||
|
|
||||||
|
val response = webhooks.create(
|
||||||
|
webhookId = "<WEBHOOK_ID>",
|
||||||
|
url = "",
|
||||||
|
name = "<NAME>",
|
||||||
|
events = listOf(),
|
||||||
|
enabled = false, // optional
|
||||||
|
security = false, // optional
|
||||||
|
httpUser = "<HTTP_USER>", // optional
|
||||||
|
httpPass = "<HTTP_PASS>" // optional
|
||||||
|
)
|
||||||
|
```
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
```kotlin
|
||||||
|
import io.appwrite.Client
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback
|
||||||
|
import io.appwrite.services.Webhooks
|
||||||
|
|
||||||
|
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 webhooks = Webhooks(client)
|
||||||
|
|
||||||
|
val response = webhooks.delete(
|
||||||
|
webhookId = "<WEBHOOK_ID>"
|
||||||
|
)
|
||||||
|
```
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
```kotlin
|
||||||
|
import io.appwrite.Client
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback
|
||||||
|
import io.appwrite.services.Webhooks
|
||||||
|
|
||||||
|
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 webhooks = Webhooks(client)
|
||||||
|
|
||||||
|
val response = webhooks.get(
|
||||||
|
webhookId = "<WEBHOOK_ID>"
|
||||||
|
)
|
||||||
|
```
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
```kotlin
|
||||||
|
import io.appwrite.Client
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback
|
||||||
|
import io.appwrite.services.Webhooks
|
||||||
|
|
||||||
|
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 webhooks = Webhooks(client)
|
||||||
|
|
||||||
|
val response = webhooks.list(
|
||||||
|
queries = listOf(), // optional
|
||||||
|
total = false // optional
|
||||||
|
)
|
||||||
|
```
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
```kotlin
|
||||||
|
import io.appwrite.Client
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback
|
||||||
|
import io.appwrite.services.Webhooks
|
||||||
|
|
||||||
|
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 webhooks = Webhooks(client)
|
||||||
|
|
||||||
|
val response = webhooks.updateSignature(
|
||||||
|
webhookId = "<WEBHOOK_ID>"
|
||||||
|
)
|
||||||
|
```
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
```kotlin
|
||||||
|
import io.appwrite.Client
|
||||||
|
import io.appwrite.coroutines.CoroutineCallback
|
||||||
|
import io.appwrite.services.Webhooks
|
||||||
|
|
||||||
|
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 webhooks = Webhooks(client)
|
||||||
|
|
||||||
|
val response = webhooks.update(
|
||||||
|
webhookId = "<WEBHOOK_ID>",
|
||||||
|
name = "<NAME>",
|
||||||
|
url = "",
|
||||||
|
events = listOf(),
|
||||||
|
enabled = false, // optional
|
||||||
|
security = false, // optional
|
||||||
|
httpUser = "<HTTP_USER>", // optional
|
||||||
|
httpPass = "<HTTP_PASS>" // optional
|
||||||
|
)
|
||||||
|
```
|
||||||
@@ -57,12 +57,12 @@ class Client @JvmOverloads constructor(
|
|||||||
init {
|
init {
|
||||||
headers = mutableMapOf(
|
headers = mutableMapOf(
|
||||||
"content-type" to "application/json",
|
"content-type" to "application/json",
|
||||||
"user-agent" to "AppwriteKotlinSDK/14.1.0 ${System.getProperty("http.agent")}",
|
"user-agent" to "AppwriteKotlinSDK/15.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 "14.1.0",
|
"x-sdk-version" to "15.0.0",
|
||||||
"x-appwrite-response-format" to "1.8.0",
|
"x-appwrite-response-format" to "1.9.0",
|
||||||
)
|
)
|
||||||
|
|
||||||
config = mutableMapOf()
|
config = mutableMapOf()
|
||||||
@@ -158,6 +158,51 @@ class Client @JvmOverloads constructor(
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set ImpersonateUserId
|
||||||
|
*
|
||||||
|
* Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
|
||||||
|
*
|
||||||
|
* @param {string} impersonateuserid
|
||||||
|
*
|
||||||
|
* @return this
|
||||||
|
*/
|
||||||
|
fun setImpersonateUserId(value: String): Client {
|
||||||
|
config["impersonateUserId"] = value
|
||||||
|
addHeader("x-appwrite-impersonate-user-id", value)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set ImpersonateUserEmail
|
||||||
|
*
|
||||||
|
* Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
|
||||||
|
*
|
||||||
|
* @param {string} impersonateuseremail
|
||||||
|
*
|
||||||
|
* @return this
|
||||||
|
*/
|
||||||
|
fun setImpersonateUserEmail(value: String): Client {
|
||||||
|
config["impersonateUserEmail"] = value
|
||||||
|
addHeader("x-appwrite-impersonate-user-email", value)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set ImpersonateUserPhone
|
||||||
|
*
|
||||||
|
* Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
|
||||||
|
*
|
||||||
|
* @param {string} impersonateuserphone
|
||||||
|
*
|
||||||
|
* @return this
|
||||||
|
*/
|
||||||
|
fun setImpersonateUserPhone(value: String): Client {
|
||||||
|
config["impersonateUserPhone"] = value
|
||||||
|
addHeader("x-appwrite-impersonate-user-phone", value)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set self Signed
|
* Set self Signed
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -5,6 +5,12 @@ import com.google.gson.annotations.SerializedName
|
|||||||
enum class BackupServices(val value: String) {
|
enum class BackupServices(val value: String) {
|
||||||
@SerializedName("databases")
|
@SerializedName("databases")
|
||||||
DATABASES("databases"),
|
DATABASES("databases"),
|
||||||
|
@SerializedName("tablesdb")
|
||||||
|
TABLESDB("tablesdb"),
|
||||||
|
@SerializedName("documentsdb")
|
||||||
|
DOCUMENTSDB("documentsdb"),
|
||||||
|
@SerializedName("vectorsdb")
|
||||||
|
VECTORSDB("vectorsdb"),
|
||||||
@SerializedName("functions")
|
@SerializedName("functions")
|
||||||
FUNCTIONS("functions"),
|
FUNCTIONS("functions"),
|
||||||
@SerializedName("storage")
|
@SerializedName("storage")
|
||||||
|
|||||||
@@ -6,7 +6,11 @@ enum class DatabaseType(val value: String) {
|
|||||||
@SerializedName("legacy")
|
@SerializedName("legacy")
|
||||||
LEGACY("legacy"),
|
LEGACY("legacy"),
|
||||||
@SerializedName("tablesdb")
|
@SerializedName("tablesdb")
|
||||||
TABLESDB("tablesdb");
|
TABLESDB("tablesdb"),
|
||||||
|
@SerializedName("documentsdb")
|
||||||
|
DOCUMENTSDB("documentsdb"),
|
||||||
|
@SerializedName("vectorsdb")
|
||||||
|
VECTORSDB("vectorsdb");
|
||||||
|
|
||||||
override fun toString() = value
|
override fun toString() = value
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package io.appwrite.enums
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
|
enum class DatabasesIndexType(val value: String) {
|
||||||
|
@SerializedName("key")
|
||||||
|
KEY("key"),
|
||||||
|
@SerializedName("fulltext")
|
||||||
|
FULLTEXT("fulltext"),
|
||||||
|
@SerializedName("unique")
|
||||||
|
UNIQUE("unique"),
|
||||||
|
@SerializedName("spatial")
|
||||||
|
SPATIAL("spatial");
|
||||||
|
|
||||||
|
override fun toString() = value
|
||||||
|
}
|
||||||
@@ -117,6 +117,14 @@ enum class Scopes(val value: String) {
|
|||||||
TOKENS_READ("tokens.read"),
|
TOKENS_READ("tokens.read"),
|
||||||
@SerializedName("tokens.write")
|
@SerializedName("tokens.write")
|
||||||
TOKENS_WRITE("tokens.write"),
|
TOKENS_WRITE("tokens.write"),
|
||||||
|
@SerializedName("webhooks.read")
|
||||||
|
WEBHOOKS_READ("webhooks.read"),
|
||||||
|
@SerializedName("webhooks.write")
|
||||||
|
WEBHOOKS_WRITE("webhooks.write"),
|
||||||
|
@SerializedName("project.read")
|
||||||
|
PROJECT_READ("project.read"),
|
||||||
|
@SerializedName("project.write")
|
||||||
|
PROJECT_WRITE("project.write"),
|
||||||
@SerializedName("policies.write")
|
@SerializedName("policies.write")
|
||||||
POLICIES_WRITE("policies.write"),
|
POLICIES_WRITE("policies.write"),
|
||||||
@SerializedName("policies.read")
|
@SerializedName("policies.read")
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ package io.appwrite.enums
|
|||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
enum class IndexType(val value: String) {
|
enum class TablesDBIndexType(val value: String) {
|
||||||
@SerializedName("key")
|
@SerializedName("key")
|
||||||
KEY("key"),
|
KEY("key"),
|
||||||
@SerializedName("fulltext")
|
@SerializedName("fulltext")
|
||||||
@@ -3,10 +3,10 @@ package io.appwrite.enums
|
|||||||
import com.google.gson.annotations.SerializedName
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
enum class TemplateReferenceType(val value: String) {
|
enum class TemplateReferenceType(val value: String) {
|
||||||
@SerializedName("branch")
|
|
||||||
BRANCH("branch"),
|
|
||||||
@SerializedName("commit")
|
@SerializedName("commit")
|
||||||
COMMIT("commit"),
|
COMMIT("commit"),
|
||||||
|
@SerializedName("branch")
|
||||||
|
BRANCH("branch"),
|
||||||
@SerializedName("tag")
|
@SerializedName("tag")
|
||||||
TAG("tag");
|
TAG("tag");
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ data class Document<T>(
|
|||||||
* Document sequence ID.
|
* Document sequence ID.
|
||||||
*/
|
*/
|
||||||
@SerializedName("\$sequence")
|
@SerializedName("\$sequence")
|
||||||
val sequence: Long,
|
val sequence: String,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collection ID.
|
* Collection ID.
|
||||||
@@ -69,7 +69,7 @@ data class Document<T>(
|
|||||||
companion object {
|
companion object {
|
||||||
operator fun invoke(
|
operator fun invoke(
|
||||||
id: String,
|
id: String,
|
||||||
sequence: Long,
|
sequence: String,
|
||||||
collectionId: String,
|
collectionId: String,
|
||||||
databaseId: String,
|
databaseId: String,
|
||||||
createdAt: String,
|
createdAt: String,
|
||||||
@@ -93,7 +93,7 @@ data class Document<T>(
|
|||||||
nestedType: Class<T>
|
nestedType: Class<T>
|
||||||
) = Document<T>(
|
) = Document<T>(
|
||||||
id = map["\$id"] as String,
|
id = map["\$id"] as String,
|
||||||
sequence = (map["\$sequence"] as Number).toLong(),
|
sequence = map["\$sequence"] as String,
|
||||||
collectionId = map["\$collectionId"] as String,
|
collectionId = map["\$collectionId"] as String,
|
||||||
databaseId = map["\$databaseId"] as String,
|
databaseId = map["\$databaseId"] as String,
|
||||||
createdAt = map["\$createdAt"] as String,
|
createdAt = map["\$createdAt"] as String,
|
||||||
|
|||||||
@@ -61,6 +61,12 @@ data class Function(
|
|||||||
@SerializedName("runtime")
|
@SerializedName("runtime")
|
||||||
val runtime: String,
|
val runtime: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* How many days to keep the non-active deployments before they will be automatically deleted.
|
||||||
|
*/
|
||||||
|
@SerializedName("deploymentRetention")
|
||||||
|
val deploymentRetention: Long,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function's active deployment ID.
|
* Function's active deployment ID.
|
||||||
*/
|
*/
|
||||||
@@ -170,10 +176,16 @@ data class Function(
|
|||||||
val providerSilentMode: Boolean,
|
val providerSilentMode: Boolean,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Machine specification for builds and executions.
|
* Machine specification for deployment builds.
|
||||||
*/
|
*/
|
||||||
@SerializedName("specification")
|
@SerializedName("buildSpecification")
|
||||||
val specification: String,
|
val buildSpecification: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Machine specification for executions.
|
||||||
|
*/
|
||||||
|
@SerializedName("runtimeSpecification")
|
||||||
|
val runtimeSpecification: String,
|
||||||
|
|
||||||
) {
|
) {
|
||||||
fun toMap(): Map<String, Any> = mapOf(
|
fun toMap(): Map<String, Any> = mapOf(
|
||||||
@@ -186,6 +198,7 @@ data class Function(
|
|||||||
"live" to live as Any,
|
"live" to live as Any,
|
||||||
"logging" to logging as Any,
|
"logging" to logging as Any,
|
||||||
"runtime" to runtime as Any,
|
"runtime" to runtime as Any,
|
||||||
|
"deploymentRetention" to deploymentRetention as Any,
|
||||||
"deploymentId" to deploymentId as Any,
|
"deploymentId" to deploymentId as Any,
|
||||||
"deploymentCreatedAt" to deploymentCreatedAt as Any,
|
"deploymentCreatedAt" to deploymentCreatedAt as Any,
|
||||||
"latestDeploymentId" to latestDeploymentId as Any,
|
"latestDeploymentId" to latestDeploymentId as Any,
|
||||||
@@ -204,7 +217,8 @@ data class Function(
|
|||||||
"providerBranch" to providerBranch as Any,
|
"providerBranch" to providerBranch as Any,
|
||||||
"providerRootDirectory" to providerRootDirectory as Any,
|
"providerRootDirectory" to providerRootDirectory as Any,
|
||||||
"providerSilentMode" to providerSilentMode as Any,
|
"providerSilentMode" to providerSilentMode as Any,
|
||||||
"specification" to specification as Any,
|
"buildSpecification" to buildSpecification as Any,
|
||||||
|
"runtimeSpecification" to runtimeSpecification as Any,
|
||||||
)
|
)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@@ -222,6 +236,7 @@ data class Function(
|
|||||||
live = map["live"] as Boolean,
|
live = map["live"] as Boolean,
|
||||||
logging = map["logging"] as Boolean,
|
logging = map["logging"] as Boolean,
|
||||||
runtime = map["runtime"] as String,
|
runtime = map["runtime"] as String,
|
||||||
|
deploymentRetention = (map["deploymentRetention"] as Number).toLong(),
|
||||||
deploymentId = map["deploymentId"] as String,
|
deploymentId = map["deploymentId"] as String,
|
||||||
deploymentCreatedAt = map["deploymentCreatedAt"] as String,
|
deploymentCreatedAt = map["deploymentCreatedAt"] as String,
|
||||||
latestDeploymentId = map["latestDeploymentId"] as String,
|
latestDeploymentId = map["latestDeploymentId"] as String,
|
||||||
@@ -240,7 +255,8 @@ data class Function(
|
|||||||
providerBranch = map["providerBranch"] as String,
|
providerBranch = map["providerBranch"] as String,
|
||||||
providerRootDirectory = map["providerRootDirectory"] as String,
|
providerRootDirectory = map["providerRootDirectory"] as String,
|
||||||
providerSilentMode = map["providerSilentMode"] as Boolean,
|
providerSilentMode = map["providerSilentMode"] as Boolean,
|
||||||
specification = map["specification"] as String,
|
buildSpecification = map["buildSpecification"] as String,
|
||||||
|
runtimeSpecification = map["runtimeSpecification"] as String,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,19 +14,19 @@ data class Log(
|
|||||||
val event: String,
|
val event: String,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User ID.
|
* User ID of the actor recorded for this log. During impersonation, this is the original impersonator, not the impersonated target user.
|
||||||
*/
|
*/
|
||||||
@SerializedName("userId")
|
@SerializedName("userId")
|
||||||
val userId: String,
|
val userId: String,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User Email.
|
* User email of the actor recorded for this log. During impersonation, this is the original impersonator.
|
||||||
*/
|
*/
|
||||||
@SerializedName("userEmail")
|
@SerializedName("userEmail")
|
||||||
val userEmail: String,
|
val userEmail: String,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User Name.
|
* User name of the actor recorded for this log. During impersonation, this is the original impersonator.
|
||||||
*/
|
*/
|
||||||
@SerializedName("userName")
|
@SerializedName("userName")
|
||||||
val userName: String,
|
val userName: String,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ data class Row<T>(
|
|||||||
* Row sequence ID.
|
* Row sequence ID.
|
||||||
*/
|
*/
|
||||||
@SerializedName("\$sequence")
|
@SerializedName("\$sequence")
|
||||||
val sequence: Long,
|
val sequence: String,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table ID.
|
* Table ID.
|
||||||
@@ -69,7 +69,7 @@ data class Row<T>(
|
|||||||
companion object {
|
companion object {
|
||||||
operator fun invoke(
|
operator fun invoke(
|
||||||
id: String,
|
id: String,
|
||||||
sequence: Long,
|
sequence: String,
|
||||||
tableId: String,
|
tableId: String,
|
||||||
databaseId: String,
|
databaseId: String,
|
||||||
createdAt: String,
|
createdAt: String,
|
||||||
@@ -93,7 +93,7 @@ data class Row<T>(
|
|||||||
nestedType: Class<T>
|
nestedType: Class<T>
|
||||||
) = Row<T>(
|
) = Row<T>(
|
||||||
id = map["\$id"] as String,
|
id = map["\$id"] as String,
|
||||||
sequence = (map["\$sequence"] as Number).toLong(),
|
sequence = map["\$sequence"] as String,
|
||||||
tableId = map["\$tableId"] as String,
|
tableId = map["\$tableId"] as String,
|
||||||
databaseId = map["\$databaseId"] as String,
|
databaseId = map["\$databaseId"] as String,
|
||||||
createdAt = map["\$createdAt"] as String,
|
createdAt = map["\$createdAt"] as String,
|
||||||
|
|||||||
@@ -55,6 +55,12 @@ data class Site(
|
|||||||
@SerializedName("framework")
|
@SerializedName("framework")
|
||||||
val framework: String,
|
val framework: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* How many days to keep the non-active deployments before they will be automatically deleted.
|
||||||
|
*/
|
||||||
|
@SerializedName("deploymentRetention")
|
||||||
|
val deploymentRetention: Long,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Site's active deployment ID.
|
* Site's active deployment ID.
|
||||||
*/
|
*/
|
||||||
@@ -121,6 +127,12 @@ data class Site(
|
|||||||
@SerializedName("buildCommand")
|
@SerializedName("buildCommand")
|
||||||
val buildCommand: String,
|
val buildCommand: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom command to use when starting site runtime.
|
||||||
|
*/
|
||||||
|
@SerializedName("startCommand")
|
||||||
|
val startCommand: String,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The directory where the site build output is located.
|
* The directory where the site build output is located.
|
||||||
*/
|
*/
|
||||||
@@ -158,10 +170,16 @@ data class Site(
|
|||||||
val providerSilentMode: Boolean,
|
val providerSilentMode: Boolean,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Machine specification for builds and executions.
|
* Machine specification for deployment builds.
|
||||||
*/
|
*/
|
||||||
@SerializedName("specification")
|
@SerializedName("buildSpecification")
|
||||||
val specification: String,
|
val buildSpecification: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Machine specification for SSR executions.
|
||||||
|
*/
|
||||||
|
@SerializedName("runtimeSpecification")
|
||||||
|
val runtimeSpecification: String,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Site build runtime.
|
* Site build runtime.
|
||||||
@@ -191,6 +209,7 @@ data class Site(
|
|||||||
"live" to live as Any,
|
"live" to live as Any,
|
||||||
"logging" to logging as Any,
|
"logging" to logging as Any,
|
||||||
"framework" to framework as Any,
|
"framework" to framework as Any,
|
||||||
|
"deploymentRetention" to deploymentRetention as Any,
|
||||||
"deploymentId" to deploymentId as Any,
|
"deploymentId" to deploymentId as Any,
|
||||||
"deploymentCreatedAt" to deploymentCreatedAt as Any,
|
"deploymentCreatedAt" to deploymentCreatedAt as Any,
|
||||||
"deploymentScreenshotLight" to deploymentScreenshotLight as Any,
|
"deploymentScreenshotLight" to deploymentScreenshotLight as Any,
|
||||||
@@ -202,13 +221,15 @@ data class Site(
|
|||||||
"timeout" to timeout as Any,
|
"timeout" to timeout as Any,
|
||||||
"installCommand" to installCommand as Any,
|
"installCommand" to installCommand as Any,
|
||||||
"buildCommand" to buildCommand as Any,
|
"buildCommand" to buildCommand as Any,
|
||||||
|
"startCommand" to startCommand as Any,
|
||||||
"outputDirectory" to outputDirectory as Any,
|
"outputDirectory" to outputDirectory as Any,
|
||||||
"installationId" to installationId as Any,
|
"installationId" to installationId as Any,
|
||||||
"providerRepositoryId" to providerRepositoryId as Any,
|
"providerRepositoryId" to providerRepositoryId as Any,
|
||||||
"providerBranch" to providerBranch as Any,
|
"providerBranch" to providerBranch as Any,
|
||||||
"providerRootDirectory" to providerRootDirectory as Any,
|
"providerRootDirectory" to providerRootDirectory as Any,
|
||||||
"providerSilentMode" to providerSilentMode as Any,
|
"providerSilentMode" to providerSilentMode as Any,
|
||||||
"specification" to specification as Any,
|
"buildSpecification" to buildSpecification as Any,
|
||||||
|
"runtimeSpecification" to runtimeSpecification as Any,
|
||||||
"buildRuntime" to buildRuntime as Any,
|
"buildRuntime" to buildRuntime as Any,
|
||||||
"adapter" to adapter as Any,
|
"adapter" to adapter as Any,
|
||||||
"fallbackFile" to fallbackFile as Any,
|
"fallbackFile" to fallbackFile as Any,
|
||||||
@@ -228,6 +249,7 @@ data class Site(
|
|||||||
live = map["live"] as Boolean,
|
live = map["live"] as Boolean,
|
||||||
logging = map["logging"] as Boolean,
|
logging = map["logging"] as Boolean,
|
||||||
framework = map["framework"] as String,
|
framework = map["framework"] as String,
|
||||||
|
deploymentRetention = (map["deploymentRetention"] as Number).toLong(),
|
||||||
deploymentId = map["deploymentId"] as String,
|
deploymentId = map["deploymentId"] as String,
|
||||||
deploymentCreatedAt = map["deploymentCreatedAt"] as String,
|
deploymentCreatedAt = map["deploymentCreatedAt"] as String,
|
||||||
deploymentScreenshotLight = map["deploymentScreenshotLight"] as String,
|
deploymentScreenshotLight = map["deploymentScreenshotLight"] as String,
|
||||||
@@ -239,13 +261,15 @@ data class Site(
|
|||||||
timeout = (map["timeout"] as Number).toLong(),
|
timeout = (map["timeout"] as Number).toLong(),
|
||||||
installCommand = map["installCommand"] as String,
|
installCommand = map["installCommand"] as String,
|
||||||
buildCommand = map["buildCommand"] as String,
|
buildCommand = map["buildCommand"] as String,
|
||||||
|
startCommand = map["startCommand"] as String,
|
||||||
outputDirectory = map["outputDirectory"] as String,
|
outputDirectory = map["outputDirectory"] as String,
|
||||||
installationId = map["installationId"] as String,
|
installationId = map["installationId"] as String,
|
||||||
providerRepositoryId = map["providerRepositoryId"] as String,
|
providerRepositoryId = map["providerRepositoryId"] as String,
|
||||||
providerBranch = map["providerBranch"] as String,
|
providerBranch = map["providerBranch"] as String,
|
||||||
providerRootDirectory = map["providerRootDirectory"] as String,
|
providerRootDirectory = map["providerRootDirectory"] as String,
|
||||||
providerSilentMode = map["providerSilentMode"] as Boolean,
|
providerSilentMode = map["providerSilentMode"] as Boolean,
|
||||||
specification = map["specification"] as String,
|
buildSpecification = map["buildSpecification"] as String,
|
||||||
|
runtimeSpecification = map["runtimeSpecification"] as String,
|
||||||
buildRuntime = map["buildRuntime"] as String,
|
buildRuntime = map["buildRuntime"] as String,
|
||||||
adapter = map["adapter"] as String,
|
adapter = map["adapter"] as String,
|
||||||
fallbackFile = map["fallbackFile"] as String,
|
fallbackFile = map["fallbackFile"] as String,
|
||||||
|
|||||||
@@ -121,6 +121,18 @@ data class User<T>(
|
|||||||
@SerializedName("accessedAt")
|
@SerializedName("accessedAt")
|
||||||
val accessedAt: String,
|
val accessedAt: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the user can impersonate other users.
|
||||||
|
*/
|
||||||
|
@SerializedName("impersonator")
|
||||||
|
var impersonator: Boolean?,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID of the original actor performing the impersonation. Present only when the current request is impersonating another user. Internal audit logs attribute the action to this user, while the impersonated target is recorded only in internal audit payload data.
|
||||||
|
*/
|
||||||
|
@SerializedName("impersonatorUserId")
|
||||||
|
var impersonatorUserId: String?,
|
||||||
|
|
||||||
) {
|
) {
|
||||||
fun toMap(): Map<String, Any> = mapOf(
|
fun toMap(): Map<String, Any> = mapOf(
|
||||||
"\$id" to id as Any,
|
"\$id" to id as Any,
|
||||||
@@ -142,6 +154,8 @@ data class User<T>(
|
|||||||
"prefs" to prefs.toMap() as Any,
|
"prefs" to prefs.toMap() as Any,
|
||||||
"targets" to targets.map { it.toMap() } as Any,
|
"targets" to targets.map { it.toMap() } as Any,
|
||||||
"accessedAt" to accessedAt as Any,
|
"accessedAt" to accessedAt as Any,
|
||||||
|
"impersonator" to impersonator as Any,
|
||||||
|
"impersonatorUserId" to impersonatorUserId as Any,
|
||||||
)
|
)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@@ -165,6 +179,8 @@ data class User<T>(
|
|||||||
prefs: Preferences<Map<String, Any>>,
|
prefs: Preferences<Map<String, Any>>,
|
||||||
targets: List<Target>,
|
targets: List<Target>,
|
||||||
accessedAt: String,
|
accessedAt: String,
|
||||||
|
impersonator: Boolean?,
|
||||||
|
impersonatorUserId: String?,
|
||||||
) = User<Map<String, Any>>(
|
) = User<Map<String, Any>>(
|
||||||
id,
|
id,
|
||||||
createdAt,
|
createdAt,
|
||||||
@@ -185,6 +201,8 @@ data class User<T>(
|
|||||||
prefs,
|
prefs,
|
||||||
targets,
|
targets,
|
||||||
accessedAt,
|
accessedAt,
|
||||||
|
impersonator,
|
||||||
|
impersonatorUserId,
|
||||||
)
|
)
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
@@ -211,6 +229,8 @@ data class User<T>(
|
|||||||
prefs = Preferences.from(map = map["prefs"] as Map<String, Any>, nestedType),
|
prefs = Preferences.from(map = map["prefs"] as Map<String, Any>, nestedType),
|
||||||
targets = (map["targets"] as List<Map<String, Any>>).map { Target.from(map = it) },
|
targets = (map["targets"] as List<Map<String, Any>>).map { Target.from(map = it) },
|
||||||
accessedAt = map["accessedAt"] as String,
|
accessedAt = map["accessedAt"] as String,
|
||||||
|
impersonator = map["impersonator"] as? Boolean,
|
||||||
|
impersonatorUserId = map["impersonatorUserId"] as? String,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
package io.appwrite.models
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName
|
||||||
|
import io.appwrite.extensions.jsonCast
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Webhook
|
||||||
|
*/
|
||||||
|
data class Webhook(
|
||||||
|
/**
|
||||||
|
* Webhook ID.
|
||||||
|
*/
|
||||||
|
@SerializedName("\$id")
|
||||||
|
val id: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Webhook creation date in ISO 8601 format.
|
||||||
|
*/
|
||||||
|
@SerializedName("\$createdAt")
|
||||||
|
val createdAt: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Webhook update date in ISO 8601 format.
|
||||||
|
*/
|
||||||
|
@SerializedName("\$updatedAt")
|
||||||
|
val updatedAt: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Webhook name.
|
||||||
|
*/
|
||||||
|
@SerializedName("name")
|
||||||
|
val name: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Webhook URL endpoint.
|
||||||
|
*/
|
||||||
|
@SerializedName("url")
|
||||||
|
val url: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Webhook trigger events.
|
||||||
|
*/
|
||||||
|
@SerializedName("events")
|
||||||
|
val events: List<String>,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicated if SSL / TLS Certificate verification is enabled.
|
||||||
|
*/
|
||||||
|
@SerializedName("security")
|
||||||
|
val security: Boolean,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTTP basic authentication username.
|
||||||
|
*/
|
||||||
|
@SerializedName("httpUser")
|
||||||
|
val httpUser: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTTP basic authentication password.
|
||||||
|
*/
|
||||||
|
@SerializedName("httpPass")
|
||||||
|
val httpPass: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signature key which can be used to validated incoming
|
||||||
|
*/
|
||||||
|
@SerializedName("signatureKey")
|
||||||
|
val signatureKey: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if this webhook is enabled.
|
||||||
|
*/
|
||||||
|
@SerializedName("enabled")
|
||||||
|
val enabled: Boolean,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Webhook error logs from the most recent failure.
|
||||||
|
*/
|
||||||
|
@SerializedName("logs")
|
||||||
|
val logs: String,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of consecutive failed webhook attempts.
|
||||||
|
*/
|
||||||
|
@SerializedName("attempts")
|
||||||
|
val attempts: Long,
|
||||||
|
|
||||||
|
) {
|
||||||
|
fun toMap(): Map<String, Any> = mapOf(
|
||||||
|
"\$id" to id as Any,
|
||||||
|
"\$createdAt" to createdAt as Any,
|
||||||
|
"\$updatedAt" to updatedAt as Any,
|
||||||
|
"name" to name as Any,
|
||||||
|
"url" to url as Any,
|
||||||
|
"events" to events as Any,
|
||||||
|
"security" to security as Any,
|
||||||
|
"httpUser" to httpUser as Any,
|
||||||
|
"httpPass" to httpPass as Any,
|
||||||
|
"signatureKey" to signatureKey as Any,
|
||||||
|
"enabled" to enabled as Any,
|
||||||
|
"logs" to logs as Any,
|
||||||
|
"attempts" to attempts as Any,
|
||||||
|
)
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
fun from(
|
||||||
|
map: Map<String, Any>,
|
||||||
|
) = Webhook(
|
||||||
|
id = map["\$id"] as String,
|
||||||
|
createdAt = map["\$createdAt"] as String,
|
||||||
|
updatedAt = map["\$updatedAt"] as String,
|
||||||
|
name = map["name"] as String,
|
||||||
|
url = map["url"] as String,
|
||||||
|
events = map["events"] as List<String>,
|
||||||
|
security = map["security"] as Boolean,
|
||||||
|
httpUser = map["httpUser"] as String,
|
||||||
|
httpPass = map["httpPass"] as String,
|
||||||
|
signatureKey = map["signatureKey"] as String,
|
||||||
|
enabled = map["enabled"] as Boolean,
|
||||||
|
logs = map["logs"] as String,
|
||||||
|
attempts = (map["attempts"] as Number).toLong(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package io.appwrite.models
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName
|
||||||
|
import io.appwrite.extensions.jsonCast
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Webhooks List
|
||||||
|
*/
|
||||||
|
data class WebhookList(
|
||||||
|
/**
|
||||||
|
* Total number of webhooks that matched your query.
|
||||||
|
*/
|
||||||
|
@SerializedName("total")
|
||||||
|
val total: Long,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of webhooks.
|
||||||
|
*/
|
||||||
|
@SerializedName("webhooks")
|
||||||
|
val webhooks: List<Webhook>,
|
||||||
|
|
||||||
|
) {
|
||||||
|
fun toMap(): Map<String, Any> = mapOf(
|
||||||
|
"total" to total as Any,
|
||||||
|
"webhooks" to webhooks.map { it.toMap() } as Any,
|
||||||
|
)
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
fun from(
|
||||||
|
map: Map<String, Any>,
|
||||||
|
) = WebhookList(
|
||||||
|
total = (map["total"] as Number).toLong(),
|
||||||
|
webhooks = (map["webhooks"] as List<Map<String, Any>>).map { Webhook.from(map = it) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3537,7 +3537,7 @@ class Databases(client: Client) : Service(client) {
|
|||||||
databaseId: String,
|
databaseId: String,
|
||||||
collectionId: String,
|
collectionId: String,
|
||||||
key: String,
|
key: String,
|
||||||
type: io.appwrite.enums.IndexType,
|
type: io.appwrite.enums.DatabasesIndexType,
|
||||||
attributes: List<String>,
|
attributes: List<String>,
|
||||||
orders: List<io.appwrite.enums.OrderBy>? = null,
|
orders: List<io.appwrite.enums.OrderBy>? = null,
|
||||||
lengths: List<Long>? = null,
|
lengths: List<Long>? = null,
|
||||||
|
|||||||
@@ -72,7 +72,9 @@ class Functions(client: Client) : Service(client) {
|
|||||||
* @param providerBranch Production branch for the repo linked to the function.
|
* @param providerBranch Production branch for the repo linked to the function.
|
||||||
* @param providerSilentMode Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.
|
* @param providerSilentMode Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.
|
||||||
* @param providerRootDirectory Path to function code in the linked repo.
|
* @param providerRootDirectory Path to function code in the linked repo.
|
||||||
* @param specification Runtime specification for the function and builds.
|
* @param buildSpecification Build specification for the function deployments.
|
||||||
|
* @param runtimeSpecification Runtime specification for the function executions.
|
||||||
|
* @param deploymentRetention Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept.
|
||||||
* @return [io.appwrite.models.Function]
|
* @return [io.appwrite.models.Function]
|
||||||
*/
|
*/
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
@@ -95,7 +97,9 @@ class Functions(client: Client) : Service(client) {
|
|||||||
providerBranch: String? = null,
|
providerBranch: String? = null,
|
||||||
providerSilentMode: Boolean? = null,
|
providerSilentMode: Boolean? = null,
|
||||||
providerRootDirectory: String? = null,
|
providerRootDirectory: String? = null,
|
||||||
specification: String? = null,
|
buildSpecification: String? = null,
|
||||||
|
runtimeSpecification: String? = null,
|
||||||
|
deploymentRetention: Long? = null,
|
||||||
): io.appwrite.models.Function {
|
): io.appwrite.models.Function {
|
||||||
val apiPath = "/functions"
|
val apiPath = "/functions"
|
||||||
|
|
||||||
@@ -117,7 +121,9 @@ class Functions(client: Client) : Service(client) {
|
|||||||
"providerBranch" to providerBranch,
|
"providerBranch" to providerBranch,
|
||||||
"providerSilentMode" to providerSilentMode,
|
"providerSilentMode" to providerSilentMode,
|
||||||
"providerRootDirectory" to providerRootDirectory,
|
"providerRootDirectory" to providerRootDirectory,
|
||||||
"specification" to specification,
|
"buildSpecification" to buildSpecification,
|
||||||
|
"runtimeSpecification" to runtimeSpecification,
|
||||||
|
"deploymentRetention" to deploymentRetention,
|
||||||
)
|
)
|
||||||
val apiHeaders = mutableMapOf<String, String>(
|
val apiHeaders = mutableMapOf<String, String>(
|
||||||
"content-type" to "application/json",
|
"content-type" to "application/json",
|
||||||
@@ -239,7 +245,9 @@ class Functions(client: Client) : Service(client) {
|
|||||||
* @param providerBranch Production branch for the repo linked to the function
|
* @param providerBranch Production branch for the repo linked to the function
|
||||||
* @param providerSilentMode Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.
|
* @param providerSilentMode Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.
|
||||||
* @param providerRootDirectory Path to function code in the linked repo.
|
* @param providerRootDirectory Path to function code in the linked repo.
|
||||||
* @param specification Runtime specification for the function and builds.
|
* @param buildSpecification Build specification for the function deployments.
|
||||||
|
* @param runtimeSpecification Runtime specification for the function executions.
|
||||||
|
* @param deploymentRetention Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept.
|
||||||
* @return [io.appwrite.models.Function]
|
* @return [io.appwrite.models.Function]
|
||||||
*/
|
*/
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
@@ -262,7 +270,9 @@ class Functions(client: Client) : Service(client) {
|
|||||||
providerBranch: String? = null,
|
providerBranch: String? = null,
|
||||||
providerSilentMode: Boolean? = null,
|
providerSilentMode: Boolean? = null,
|
||||||
providerRootDirectory: String? = null,
|
providerRootDirectory: String? = null,
|
||||||
specification: String? = null,
|
buildSpecification: String? = null,
|
||||||
|
runtimeSpecification: String? = null,
|
||||||
|
deploymentRetention: Long? = null,
|
||||||
): io.appwrite.models.Function {
|
): io.appwrite.models.Function {
|
||||||
val apiPath = "/functions/{functionId}"
|
val apiPath = "/functions/{functionId}"
|
||||||
.replace("{functionId}", functionId)
|
.replace("{functionId}", functionId)
|
||||||
@@ -284,7 +294,9 @@ class Functions(client: Client) : Service(client) {
|
|||||||
"providerBranch" to providerBranch,
|
"providerBranch" to providerBranch,
|
||||||
"providerSilentMode" to providerSilentMode,
|
"providerSilentMode" to providerSilentMode,
|
||||||
"providerRootDirectory" to providerRootDirectory,
|
"providerRootDirectory" to providerRootDirectory,
|
||||||
"specification" to specification,
|
"buildSpecification" to buildSpecification,
|
||||||
|
"runtimeSpecification" to runtimeSpecification,
|
||||||
|
"deploymentRetention" to deploymentRetention,
|
||||||
)
|
)
|
||||||
val apiHeaders = mutableMapOf<String, String>(
|
val apiHeaders = mutableMapOf<String, String>(
|
||||||
"content-type" to "application/json",
|
"content-type" to "application/json",
|
||||||
|
|||||||
@@ -245,68 +245,6 @@ class Health(client: Client) : Service(client) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get billing project aggregation queue.
|
|
||||||
*
|
|
||||||
* @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 getQueueBillingProjectAggregation(
|
|
||||||
threshold: Long? = null,
|
|
||||||
): io.appwrite.models.HealthQueue {
|
|
||||||
val apiPath = "/health/queue/billing-project-aggregation"
|
|
||||||
|
|
||||||
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,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get billing team aggregation queue.
|
|
||||||
*
|
|
||||||
* @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 getQueueBillingTeamAggregation(
|
|
||||||
threshold: Long? = null,
|
|
||||||
): io.appwrite.models.HealthQueue {
|
|
||||||
val apiPath = "/health/queue/billing-team-aggregation"
|
|
||||||
|
|
||||||
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,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of builds that are waiting to be processed in the Appwrite internal queue server.
|
* Get the number of builds that are waiting to be processed in the Appwrite internal queue server.
|
||||||
*
|
*
|
||||||
@@ -338,37 +276,6 @@ class Health(client: Client) : Service(client) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the priority builds queue size.
|
|
||||||
*
|
|
||||||
* @param threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 500.
|
|
||||||
* @return [io.appwrite.models.HealthQueue]
|
|
||||||
*/
|
|
||||||
@JvmOverloads
|
|
||||||
@Throws(AppwriteException::class)
|
|
||||||
suspend fun getQueuePriorityBuilds(
|
|
||||||
threshold: Long? = null,
|
|
||||||
): io.appwrite.models.HealthQueue {
|
|
||||||
val apiPath = "/health/queue/builds-priority"
|
|
||||||
|
|
||||||
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,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server.
|
* Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server.
|
||||||
*
|
*
|
||||||
@@ -655,37 +562,6 @@ class Health(client: Client) : Service(client) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get region manager queue.
|
|
||||||
*
|
|
||||||
* @param threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100.
|
|
||||||
* @return [io.appwrite.models.HealthQueue]
|
|
||||||
*/
|
|
||||||
@JvmOverloads
|
|
||||||
@Throws(AppwriteException::class)
|
|
||||||
suspend fun getQueueRegionManager(
|
|
||||||
threshold: Long? = null,
|
|
||||||
): io.appwrite.models.HealthQueue {
|
|
||||||
val apiPath = "/health/queue/region-manager"
|
|
||||||
|
|
||||||
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,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue.
|
* Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue.
|
||||||
*
|
*
|
||||||
@@ -748,37 +624,6 @@ class Health(client: Client) : Service(client) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get threats queue.
|
|
||||||
*
|
|
||||||
* @param threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100.
|
|
||||||
* @return [io.appwrite.models.HealthQueue]
|
|
||||||
*/
|
|
||||||
@JvmOverloads
|
|
||||||
@Throws(AppwriteException::class)
|
|
||||||
suspend fun getQueueThreats(
|
|
||||||
threshold: Long? = null,
|
|
||||||
): io.appwrite.models.HealthQueue {
|
|
||||||
val apiPath = "/health/queue/threats"
|
|
||||||
|
|
||||||
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,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.
|
* Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,189 @@
|
|||||||
|
package io.appwrite.services
|
||||||
|
|
||||||
|
import io.appwrite.Client
|
||||||
|
import io.appwrite.models.*
|
||||||
|
import io.appwrite.enums.*
|
||||||
|
import io.appwrite.exceptions.AppwriteException
|
||||||
|
import io.appwrite.extensions.classOf
|
||||||
|
import okhttp3.Cookie
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Project service allows you to manage all the projects in your Appwrite server.
|
||||||
|
**/
|
||||||
|
class Project(client: Client) : Service(client) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all project environment variables.
|
||||||
|
*
|
||||||
|
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, resourceType, resourceId, secret
|
||||||
|
* @param total When set to false, the total count returned will be 0 and will not be calculated.
|
||||||
|
* @return [io.appwrite.models.VariableList]
|
||||||
|
*/
|
||||||
|
@JvmOverloads
|
||||||
|
@Throws(AppwriteException::class)
|
||||||
|
suspend fun listVariables(
|
||||||
|
queries: List<String>? = null,
|
||||||
|
total: Boolean? = null,
|
||||||
|
): io.appwrite.models.VariableList {
|
||||||
|
val apiPath = "/project/variables"
|
||||||
|
|
||||||
|
val apiParams = mutableMapOf<String, Any?>(
|
||||||
|
"queries" to queries,
|
||||||
|
"total" to total,
|
||||||
|
)
|
||||||
|
val apiHeaders = mutableMapOf<String, String>(
|
||||||
|
)
|
||||||
|
val converter: (Any) -> io.appwrite.models.VariableList = {
|
||||||
|
io.appwrite.models.VariableList.from(map = it as Map<String, Any>)
|
||||||
|
}
|
||||||
|
return client.call(
|
||||||
|
"GET",
|
||||||
|
apiPath,
|
||||||
|
apiHeaders,
|
||||||
|
apiParams,
|
||||||
|
responseType = io.appwrite.models.VariableList::class.java,
|
||||||
|
converter,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new project environment variable. These variables can be accessed by all functions and sites in the project.
|
||||||
|
*
|
||||||
|
* @param variableId Variable ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
||||||
|
* @param key Variable key. Max length: 255 chars.
|
||||||
|
* @param value Variable value. Max length: 8192 chars.
|
||||||
|
* @param secret Secret variables can be updated or deleted, but only projects can read them during build and runtime.
|
||||||
|
* @return [io.appwrite.models.Variable]
|
||||||
|
*/
|
||||||
|
@JvmOverloads
|
||||||
|
@Throws(AppwriteException::class)
|
||||||
|
suspend fun createVariable(
|
||||||
|
variableId: String,
|
||||||
|
key: String,
|
||||||
|
value: String,
|
||||||
|
secret: Boolean? = null,
|
||||||
|
): io.appwrite.models.Variable {
|
||||||
|
val apiPath = "/project/variables"
|
||||||
|
|
||||||
|
val apiParams = mutableMapOf<String, Any?>(
|
||||||
|
"variableId" to variableId,
|
||||||
|
"key" to key,
|
||||||
|
"value" to value,
|
||||||
|
"secret" to secret,
|
||||||
|
)
|
||||||
|
val apiHeaders = mutableMapOf<String, String>(
|
||||||
|
"content-type" to "application/json",
|
||||||
|
)
|
||||||
|
val converter: (Any) -> io.appwrite.models.Variable = {
|
||||||
|
io.appwrite.models.Variable.from(map = it as Map<String, Any>)
|
||||||
|
}
|
||||||
|
return client.call(
|
||||||
|
"POST",
|
||||||
|
apiPath,
|
||||||
|
apiHeaders,
|
||||||
|
apiParams,
|
||||||
|
responseType = io.appwrite.models.Variable::class.java,
|
||||||
|
converter,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a variable by its unique ID.
|
||||||
|
*
|
||||||
|
* @param variableId Variable ID.
|
||||||
|
* @return [io.appwrite.models.Variable]
|
||||||
|
*/
|
||||||
|
@Throws(AppwriteException::class)
|
||||||
|
suspend fun getVariable(
|
||||||
|
variableId: String,
|
||||||
|
): io.appwrite.models.Variable {
|
||||||
|
val apiPath = "/project/variables/{variableId}"
|
||||||
|
.replace("{variableId}", variableId)
|
||||||
|
|
||||||
|
val apiParams = mutableMapOf<String, Any?>(
|
||||||
|
)
|
||||||
|
val apiHeaders = mutableMapOf<String, String>(
|
||||||
|
)
|
||||||
|
val converter: (Any) -> io.appwrite.models.Variable = {
|
||||||
|
io.appwrite.models.Variable.from(map = it as Map<String, Any>)
|
||||||
|
}
|
||||||
|
return client.call(
|
||||||
|
"GET",
|
||||||
|
apiPath,
|
||||||
|
apiHeaders,
|
||||||
|
apiParams,
|
||||||
|
responseType = io.appwrite.models.Variable::class.java,
|
||||||
|
converter,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update variable by its unique ID.
|
||||||
|
*
|
||||||
|
* @param variableId Variable ID.
|
||||||
|
* @param key Variable key. Max length: 255 chars.
|
||||||
|
* @param value Variable value. Max length: 8192 chars.
|
||||||
|
* @param secret Secret variables can be updated or deleted, but only projects can read them during build and runtime.
|
||||||
|
* @return [io.appwrite.models.Variable]
|
||||||
|
*/
|
||||||
|
@JvmOverloads
|
||||||
|
@Throws(AppwriteException::class)
|
||||||
|
suspend fun updateVariable(
|
||||||
|
variableId: String,
|
||||||
|
key: String? = null,
|
||||||
|
value: String? = null,
|
||||||
|
secret: Boolean? = null,
|
||||||
|
): io.appwrite.models.Variable {
|
||||||
|
val apiPath = "/project/variables/{variableId}"
|
||||||
|
.replace("{variableId}", variableId)
|
||||||
|
|
||||||
|
val apiParams = mutableMapOf<String, Any?>(
|
||||||
|
"key" to key,
|
||||||
|
"value" to value,
|
||||||
|
"secret" to secret,
|
||||||
|
)
|
||||||
|
val apiHeaders = mutableMapOf<String, String>(
|
||||||
|
"content-type" to "application/json",
|
||||||
|
)
|
||||||
|
val converter: (Any) -> io.appwrite.models.Variable = {
|
||||||
|
io.appwrite.models.Variable.from(map = it as Map<String, Any>)
|
||||||
|
}
|
||||||
|
return client.call(
|
||||||
|
"PUT",
|
||||||
|
apiPath,
|
||||||
|
apiHeaders,
|
||||||
|
apiParams,
|
||||||
|
responseType = io.appwrite.models.Variable::class.java,
|
||||||
|
converter,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a variable by its unique ID.
|
||||||
|
*
|
||||||
|
* @param variableId Variable ID.
|
||||||
|
* @return [Any]
|
||||||
|
*/
|
||||||
|
@Throws(AppwriteException::class)
|
||||||
|
suspend fun deleteVariable(
|
||||||
|
variableId: String,
|
||||||
|
): Any {
|
||||||
|
val apiPath = "/project/variables/{variableId}"
|
||||||
|
.replace("{variableId}", variableId)
|
||||||
|
|
||||||
|
val apiParams = mutableMapOf<String, Any?>(
|
||||||
|
)
|
||||||
|
val apiHeaders = mutableMapOf<String, String>(
|
||||||
|
"content-type" to "application/json",
|
||||||
|
)
|
||||||
|
return client.call(
|
||||||
|
"DELETE",
|
||||||
|
apiPath,
|
||||||
|
apiHeaders,
|
||||||
|
apiParams,
|
||||||
|
responseType = Any::class.java,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -64,6 +64,7 @@ class Sites(client: Client) : Service(client) {
|
|||||||
* @param timeout Maximum request time in seconds.
|
* @param timeout Maximum request time in seconds.
|
||||||
* @param installCommand Install Command.
|
* @param installCommand Install Command.
|
||||||
* @param buildCommand Build Command.
|
* @param buildCommand Build Command.
|
||||||
|
* @param startCommand Custom start command. Leave empty to use default.
|
||||||
* @param outputDirectory Output Directory for site.
|
* @param outputDirectory Output Directory for site.
|
||||||
* @param adapter Framework adapter defining rendering strategy. Allowed values are: static, ssr
|
* @param adapter Framework adapter defining rendering strategy. Allowed values are: static, ssr
|
||||||
* @param installationId Appwrite Installation ID for VCS (Version Control System) deployment.
|
* @param installationId Appwrite Installation ID for VCS (Version Control System) deployment.
|
||||||
@@ -72,7 +73,9 @@ class Sites(client: Client) : Service(client) {
|
|||||||
* @param providerBranch Production branch for the repo linked to the site.
|
* @param providerBranch Production branch for the repo linked to the site.
|
||||||
* @param providerSilentMode Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests.
|
* @param providerSilentMode Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests.
|
||||||
* @param providerRootDirectory Path to site code in the linked repo.
|
* @param providerRootDirectory Path to site code in the linked repo.
|
||||||
* @param specification Framework specification for the site and builds.
|
* @param buildSpecification Build specification for the site deployments.
|
||||||
|
* @param runtimeSpecification Runtime specification for the SSR executions.
|
||||||
|
* @param deploymentRetention Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept.
|
||||||
* @return [io.appwrite.models.Site]
|
* @return [io.appwrite.models.Site]
|
||||||
*/
|
*/
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
@@ -87,6 +90,7 @@ class Sites(client: Client) : Service(client) {
|
|||||||
timeout: Long? = null,
|
timeout: Long? = null,
|
||||||
installCommand: String? = null,
|
installCommand: String? = null,
|
||||||
buildCommand: String? = null,
|
buildCommand: String? = null,
|
||||||
|
startCommand: String? = null,
|
||||||
outputDirectory: String? = null,
|
outputDirectory: String? = null,
|
||||||
adapter: io.appwrite.enums.Adapter? = null,
|
adapter: io.appwrite.enums.Adapter? = null,
|
||||||
installationId: String? = null,
|
installationId: String? = null,
|
||||||
@@ -95,7 +99,9 @@ class Sites(client: Client) : Service(client) {
|
|||||||
providerBranch: String? = null,
|
providerBranch: String? = null,
|
||||||
providerSilentMode: Boolean? = null,
|
providerSilentMode: Boolean? = null,
|
||||||
providerRootDirectory: String? = null,
|
providerRootDirectory: String? = null,
|
||||||
specification: String? = null,
|
buildSpecification: String? = null,
|
||||||
|
runtimeSpecification: String? = null,
|
||||||
|
deploymentRetention: Long? = null,
|
||||||
): io.appwrite.models.Site {
|
): io.appwrite.models.Site {
|
||||||
val apiPath = "/sites"
|
val apiPath = "/sites"
|
||||||
|
|
||||||
@@ -108,6 +114,7 @@ class Sites(client: Client) : Service(client) {
|
|||||||
"timeout" to timeout,
|
"timeout" to timeout,
|
||||||
"installCommand" to installCommand,
|
"installCommand" to installCommand,
|
||||||
"buildCommand" to buildCommand,
|
"buildCommand" to buildCommand,
|
||||||
|
"startCommand" to startCommand,
|
||||||
"outputDirectory" to outputDirectory,
|
"outputDirectory" to outputDirectory,
|
||||||
"buildRuntime" to buildRuntime,
|
"buildRuntime" to buildRuntime,
|
||||||
"adapter" to adapter,
|
"adapter" to adapter,
|
||||||
@@ -117,7 +124,9 @@ class Sites(client: Client) : Service(client) {
|
|||||||
"providerBranch" to providerBranch,
|
"providerBranch" to providerBranch,
|
||||||
"providerSilentMode" to providerSilentMode,
|
"providerSilentMode" to providerSilentMode,
|
||||||
"providerRootDirectory" to providerRootDirectory,
|
"providerRootDirectory" to providerRootDirectory,
|
||||||
"specification" to specification,
|
"buildSpecification" to buildSpecification,
|
||||||
|
"runtimeSpecification" to runtimeSpecification,
|
||||||
|
"deploymentRetention" to deploymentRetention,
|
||||||
)
|
)
|
||||||
val apiHeaders = mutableMapOf<String, String>(
|
val apiHeaders = mutableMapOf<String, String>(
|
||||||
"content-type" to "application/json",
|
"content-type" to "application/json",
|
||||||
@@ -230,6 +239,7 @@ class Sites(client: Client) : Service(client) {
|
|||||||
* @param timeout Maximum request time in seconds.
|
* @param timeout Maximum request time in seconds.
|
||||||
* @param installCommand Install Command.
|
* @param installCommand Install Command.
|
||||||
* @param buildCommand Build Command.
|
* @param buildCommand Build Command.
|
||||||
|
* @param startCommand Custom start command. Leave empty to use default.
|
||||||
* @param outputDirectory Output Directory for site.
|
* @param outputDirectory Output Directory for site.
|
||||||
* @param buildRuntime Runtime to use during build step.
|
* @param buildRuntime Runtime to use during build step.
|
||||||
* @param adapter Framework adapter defining rendering strategy. Allowed values are: static, ssr
|
* @param adapter Framework adapter defining rendering strategy. Allowed values are: static, ssr
|
||||||
@@ -239,7 +249,9 @@ class Sites(client: Client) : Service(client) {
|
|||||||
* @param providerBranch Production branch for the repo linked to the site.
|
* @param providerBranch Production branch for the repo linked to the site.
|
||||||
* @param providerSilentMode Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests.
|
* @param providerSilentMode Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests.
|
||||||
* @param providerRootDirectory Path to site code in the linked repo.
|
* @param providerRootDirectory Path to site code in the linked repo.
|
||||||
* @param specification Framework specification for the site and builds.
|
* @param buildSpecification Build specification for the site deployments.
|
||||||
|
* @param runtimeSpecification Runtime specification for the SSR executions.
|
||||||
|
* @param deploymentRetention Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept.
|
||||||
* @return [io.appwrite.models.Site]
|
* @return [io.appwrite.models.Site]
|
||||||
*/
|
*/
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
@@ -253,6 +265,7 @@ class Sites(client: Client) : Service(client) {
|
|||||||
timeout: Long? = null,
|
timeout: Long? = null,
|
||||||
installCommand: String? = null,
|
installCommand: String? = null,
|
||||||
buildCommand: String? = null,
|
buildCommand: String? = null,
|
||||||
|
startCommand: String? = null,
|
||||||
outputDirectory: String? = null,
|
outputDirectory: String? = null,
|
||||||
buildRuntime: io.appwrite.enums.BuildRuntime? = null,
|
buildRuntime: io.appwrite.enums.BuildRuntime? = null,
|
||||||
adapter: io.appwrite.enums.Adapter? = null,
|
adapter: io.appwrite.enums.Adapter? = null,
|
||||||
@@ -262,7 +275,9 @@ class Sites(client: Client) : Service(client) {
|
|||||||
providerBranch: String? = null,
|
providerBranch: String? = null,
|
||||||
providerSilentMode: Boolean? = null,
|
providerSilentMode: Boolean? = null,
|
||||||
providerRootDirectory: String? = null,
|
providerRootDirectory: String? = null,
|
||||||
specification: String? = null,
|
buildSpecification: String? = null,
|
||||||
|
runtimeSpecification: String? = null,
|
||||||
|
deploymentRetention: Long? = null,
|
||||||
): io.appwrite.models.Site {
|
): io.appwrite.models.Site {
|
||||||
val apiPath = "/sites/{siteId}"
|
val apiPath = "/sites/{siteId}"
|
||||||
.replace("{siteId}", siteId)
|
.replace("{siteId}", siteId)
|
||||||
@@ -275,6 +290,7 @@ class Sites(client: Client) : Service(client) {
|
|||||||
"timeout" to timeout,
|
"timeout" to timeout,
|
||||||
"installCommand" to installCommand,
|
"installCommand" to installCommand,
|
||||||
"buildCommand" to buildCommand,
|
"buildCommand" to buildCommand,
|
||||||
|
"startCommand" to startCommand,
|
||||||
"outputDirectory" to outputDirectory,
|
"outputDirectory" to outputDirectory,
|
||||||
"buildRuntime" to buildRuntime,
|
"buildRuntime" to buildRuntime,
|
||||||
"adapter" to adapter,
|
"adapter" to adapter,
|
||||||
@@ -284,7 +300,9 @@ class Sites(client: Client) : Service(client) {
|
|||||||
"providerBranch" to providerBranch,
|
"providerBranch" to providerBranch,
|
||||||
"providerSilentMode" to providerSilentMode,
|
"providerSilentMode" to providerSilentMode,
|
||||||
"providerRootDirectory" to providerRootDirectory,
|
"providerRootDirectory" to providerRootDirectory,
|
||||||
"specification" to specification,
|
"buildSpecification" to buildSpecification,
|
||||||
|
"runtimeSpecification" to runtimeSpecification,
|
||||||
|
"deploymentRetention" to deploymentRetention,
|
||||||
)
|
)
|
||||||
val apiHeaders = mutableMapOf<String, String>(
|
val apiHeaders = mutableMapOf<String, String>(
|
||||||
"content-type" to "application/json",
|
"content-type" to "application/json",
|
||||||
|
|||||||
@@ -2429,7 +2429,7 @@ class TablesDB(client: Client) : Service(client) {
|
|||||||
databaseId: String,
|
databaseId: String,
|
||||||
tableId: String,
|
tableId: String,
|
||||||
key: String,
|
key: String,
|
||||||
type: io.appwrite.enums.IndexType,
|
type: io.appwrite.enums.TablesDBIndexType,
|
||||||
columns: List<String>,
|
columns: List<String>,
|
||||||
orders: List<io.appwrite.enums.OrderBy>? = null,
|
orders: List<io.appwrite.enums.OrderBy>? = null,
|
||||||
lengths: List<Long>? = null,
|
lengths: List<Long>? = null,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class Users(client: Client) : Service(client) {
|
|||||||
/**
|
/**
|
||||||
* Get a list of all the project's users. You can use the query params to filter your results.
|
* Get a list of all the project's users. You can use the query params to filter your results.
|
||||||
*
|
*
|
||||||
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels
|
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels, impersonator
|
||||||
* @param search Search term to filter your list results. Max length: 256 chars.
|
* @param search Search term to filter your list results. Max length: 256 chars.
|
||||||
* @param total When set to false, the total count returned will be 0 and will not be calculated.
|
* @param total When set to false, the total count returned will be 0 and will not be calculated.
|
||||||
* @return [io.appwrite.models.UserList<T>]
|
* @return [io.appwrite.models.UserList<T>]
|
||||||
@@ -54,7 +54,7 @@ class Users(client: Client) : Service(client) {
|
|||||||
/**
|
/**
|
||||||
* Get a list of all the project's users. You can use the query params to filter your results.
|
* Get a list of all the project's users. You can use the query params to filter your results.
|
||||||
*
|
*
|
||||||
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels
|
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels, impersonator
|
||||||
* @param search Search term to filter your list results. Max length: 256 chars.
|
* @param search Search term to filter your list results. Max length: 256 chars.
|
||||||
* @param total When set to false, the total count returned will be 0 and will not be calculated.
|
* @param total When set to false, the total count returned will be 0 and will not be calculated.
|
||||||
* @return [io.appwrite.models.UserList<T>]
|
* @return [io.appwrite.models.UserList<T>]
|
||||||
@@ -848,6 +848,60 @@ class Users(client: Client) : Service(client) {
|
|||||||
nestedType = classOf(),
|
nestedType = classOf(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable or disable whether a user can impersonate other users. When impersonation headers are used, the request runs as the target user for API behavior, while internal audit logs still attribute the action to the original impersonator and store the impersonated target details only in internal audit payload data.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param userId User ID.
|
||||||
|
* @param impersonator Whether the user can impersonate other users. When true, the user can browse project users to choose a target and can pass impersonation headers to act as that user. Internal audit logs still attribute impersonated actions to the original impersonator and store the target user details only in internal audit payload data.
|
||||||
|
* @return [io.appwrite.models.User<T>]
|
||||||
|
*/
|
||||||
|
@Throws(AppwriteException::class)
|
||||||
|
suspend fun <T> updateImpersonator(
|
||||||
|
userId: String,
|
||||||
|
impersonator: Boolean,
|
||||||
|
nestedType: Class<T>,
|
||||||
|
): io.appwrite.models.User<T> {
|
||||||
|
val apiPath = "/users/{userId}/impersonator"
|
||||||
|
.replace("{userId}", userId)
|
||||||
|
|
||||||
|
val apiParams = mutableMapOf<String, Any?>(
|
||||||
|
"impersonator" to impersonator,
|
||||||
|
)
|
||||||
|
val apiHeaders = mutableMapOf<String, String>(
|
||||||
|
"content-type" to "application/json",
|
||||||
|
)
|
||||||
|
val converter: (Any) -> io.appwrite.models.User<T> = {
|
||||||
|
io.appwrite.models.User.from(map = it as Map<String, Any>, nestedType)
|
||||||
|
}
|
||||||
|
return client.call(
|
||||||
|
"PATCH",
|
||||||
|
apiPath,
|
||||||
|
apiHeaders,
|
||||||
|
apiParams,
|
||||||
|
responseType = classOf(),
|
||||||
|
converter,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable or disable whether a user can impersonate other users. When impersonation headers are used, the request runs as the target user for API behavior, while internal audit logs still attribute the action to the original impersonator and store the impersonated target details only in internal audit payload data.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param userId User ID.
|
||||||
|
* @param impersonator Whether the user can impersonate other users. When true, the user can browse project users to choose a target and can pass impersonation headers to act as that user. Internal audit logs still attribute impersonated actions to the original impersonator and store the target user details only in internal audit payload data.
|
||||||
|
* @return [io.appwrite.models.User<T>]
|
||||||
|
*/
|
||||||
|
@Throws(AppwriteException::class)
|
||||||
|
suspend fun updateImpersonator(
|
||||||
|
userId: String,
|
||||||
|
impersonator: Boolean,
|
||||||
|
): io.appwrite.models.User<Map<String, Any>> = updateImpersonator(
|
||||||
|
userId,
|
||||||
|
impersonator,
|
||||||
|
nestedType = classOf(),
|
||||||
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted.
|
* Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,244 @@
|
|||||||
|
package io.appwrite.services
|
||||||
|
|
||||||
|
import io.appwrite.Client
|
||||||
|
import io.appwrite.models.*
|
||||||
|
import io.appwrite.enums.*
|
||||||
|
import io.appwrite.exceptions.AppwriteException
|
||||||
|
import io.appwrite.extensions.classOf
|
||||||
|
import okhttp3.Cookie
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
class Webhooks(client: Client) : Service(client) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all webhooks belonging to the project. You can use the query params to filter your results.
|
||||||
|
*
|
||||||
|
* @param queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, url, httpUser, security, events, enabled, logs, attempts
|
||||||
|
* @param total When set to false, the total count returned will be 0 and will not be calculated.
|
||||||
|
* @return [io.appwrite.models.WebhookList]
|
||||||
|
*/
|
||||||
|
@JvmOverloads
|
||||||
|
@Throws(AppwriteException::class)
|
||||||
|
suspend fun list(
|
||||||
|
queries: List<String>? = null,
|
||||||
|
total: Boolean? = null,
|
||||||
|
): io.appwrite.models.WebhookList {
|
||||||
|
val apiPath = "/webhooks"
|
||||||
|
|
||||||
|
val apiParams = mutableMapOf<String, Any?>(
|
||||||
|
"queries" to queries,
|
||||||
|
"total" to total,
|
||||||
|
)
|
||||||
|
val apiHeaders = mutableMapOf<String, String>(
|
||||||
|
)
|
||||||
|
val converter: (Any) -> io.appwrite.models.WebhookList = {
|
||||||
|
io.appwrite.models.WebhookList.from(map = it as Map<String, Any>)
|
||||||
|
}
|
||||||
|
return client.call(
|
||||||
|
"GET",
|
||||||
|
apiPath,
|
||||||
|
apiHeaders,
|
||||||
|
apiParams,
|
||||||
|
responseType = io.appwrite.models.WebhookList::class.java,
|
||||||
|
converter,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur.
|
||||||
|
*
|
||||||
|
* @param webhookId Webhook ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
||||||
|
* @param url Webhook URL.
|
||||||
|
* @param name Webhook name. Max length: 128 chars.
|
||||||
|
* @param events Events list. Maximum of 100 events are allowed.
|
||||||
|
* @param enabled Enable or disable a webhook.
|
||||||
|
* @param security Certificate verification, false for disabled or true for enabled.
|
||||||
|
* @param httpUser Webhook HTTP user. Max length: 256 chars.
|
||||||
|
* @param httpPass Webhook HTTP password. Max length: 256 chars.
|
||||||
|
* @return [io.appwrite.models.Webhook]
|
||||||
|
*/
|
||||||
|
@JvmOverloads
|
||||||
|
@Throws(AppwriteException::class)
|
||||||
|
suspend fun create(
|
||||||
|
webhookId: String,
|
||||||
|
url: String,
|
||||||
|
name: String,
|
||||||
|
events: List<String>,
|
||||||
|
enabled: Boolean? = null,
|
||||||
|
security: Boolean? = null,
|
||||||
|
httpUser: String? = null,
|
||||||
|
httpPass: String? = null,
|
||||||
|
): io.appwrite.models.Webhook {
|
||||||
|
val apiPath = "/webhooks"
|
||||||
|
|
||||||
|
val apiParams = mutableMapOf<String, Any?>(
|
||||||
|
"webhookId" to webhookId,
|
||||||
|
"url" to url,
|
||||||
|
"name" to name,
|
||||||
|
"events" to events,
|
||||||
|
"enabled" to enabled,
|
||||||
|
"security" to security,
|
||||||
|
"httpUser" to httpUser,
|
||||||
|
"httpPass" to httpPass,
|
||||||
|
)
|
||||||
|
val apiHeaders = mutableMapOf<String, String>(
|
||||||
|
"content-type" to "application/json",
|
||||||
|
)
|
||||||
|
val converter: (Any) -> io.appwrite.models.Webhook = {
|
||||||
|
io.appwrite.models.Webhook.from(map = it as Map<String, Any>)
|
||||||
|
}
|
||||||
|
return client.call(
|
||||||
|
"POST",
|
||||||
|
apiPath,
|
||||||
|
apiHeaders,
|
||||||
|
apiParams,
|
||||||
|
responseType = io.appwrite.models.Webhook::class.java,
|
||||||
|
converter,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project.
|
||||||
|
*
|
||||||
|
* @param webhookId Webhook ID.
|
||||||
|
* @return [io.appwrite.models.Webhook]
|
||||||
|
*/
|
||||||
|
@Throws(AppwriteException::class)
|
||||||
|
suspend fun get(
|
||||||
|
webhookId: String,
|
||||||
|
): io.appwrite.models.Webhook {
|
||||||
|
val apiPath = "/webhooks/{webhookId}"
|
||||||
|
.replace("{webhookId}", webhookId)
|
||||||
|
|
||||||
|
val apiParams = mutableMapOf<String, Any?>(
|
||||||
|
)
|
||||||
|
val apiHeaders = mutableMapOf<String, String>(
|
||||||
|
)
|
||||||
|
val converter: (Any) -> io.appwrite.models.Webhook = {
|
||||||
|
io.appwrite.models.Webhook.from(map = it as Map<String, Any>)
|
||||||
|
}
|
||||||
|
return client.call(
|
||||||
|
"GET",
|
||||||
|
apiPath,
|
||||||
|
apiHeaders,
|
||||||
|
apiParams,
|
||||||
|
responseType = io.appwrite.models.Webhook::class.java,
|
||||||
|
converter,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook.
|
||||||
|
*
|
||||||
|
* @param webhookId Webhook ID.
|
||||||
|
* @param name Webhook name. Max length: 128 chars.
|
||||||
|
* @param url Webhook URL.
|
||||||
|
* @param events Events list. Maximum of 100 events are allowed.
|
||||||
|
* @param enabled Enable or disable a webhook.
|
||||||
|
* @param security Certificate verification, false for disabled or true for enabled.
|
||||||
|
* @param httpUser Webhook HTTP user. Max length: 256 chars.
|
||||||
|
* @param httpPass Webhook HTTP password. Max length: 256 chars.
|
||||||
|
* @return [io.appwrite.models.Webhook]
|
||||||
|
*/
|
||||||
|
@JvmOverloads
|
||||||
|
@Throws(AppwriteException::class)
|
||||||
|
suspend fun update(
|
||||||
|
webhookId: String,
|
||||||
|
name: String,
|
||||||
|
url: String,
|
||||||
|
events: List<String>,
|
||||||
|
enabled: Boolean? = null,
|
||||||
|
security: Boolean? = null,
|
||||||
|
httpUser: String? = null,
|
||||||
|
httpPass: String? = null,
|
||||||
|
): io.appwrite.models.Webhook {
|
||||||
|
val apiPath = "/webhooks/{webhookId}"
|
||||||
|
.replace("{webhookId}", webhookId)
|
||||||
|
|
||||||
|
val apiParams = mutableMapOf<String, Any?>(
|
||||||
|
"name" to name,
|
||||||
|
"url" to url,
|
||||||
|
"events" to events,
|
||||||
|
"enabled" to enabled,
|
||||||
|
"security" to security,
|
||||||
|
"httpUser" to httpUser,
|
||||||
|
"httpPass" to httpPass,
|
||||||
|
)
|
||||||
|
val apiHeaders = mutableMapOf<String, String>(
|
||||||
|
"content-type" to "application/json",
|
||||||
|
)
|
||||||
|
val converter: (Any) -> io.appwrite.models.Webhook = {
|
||||||
|
io.appwrite.models.Webhook.from(map = it as Map<String, Any>)
|
||||||
|
}
|
||||||
|
return client.call(
|
||||||
|
"PUT",
|
||||||
|
apiPath,
|
||||||
|
apiHeaders,
|
||||||
|
apiParams,
|
||||||
|
responseType = io.appwrite.models.Webhook::class.java,
|
||||||
|
converter,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events.
|
||||||
|
*
|
||||||
|
* @param webhookId Webhook ID.
|
||||||
|
* @return [Any]
|
||||||
|
*/
|
||||||
|
@Throws(AppwriteException::class)
|
||||||
|
suspend fun delete(
|
||||||
|
webhookId: String,
|
||||||
|
): Any {
|
||||||
|
val apiPath = "/webhooks/{webhookId}"
|
||||||
|
.replace("{webhookId}", webhookId)
|
||||||
|
|
||||||
|
val apiParams = mutableMapOf<String, Any?>(
|
||||||
|
)
|
||||||
|
val apiHeaders = mutableMapOf<String, String>(
|
||||||
|
"content-type" to "application/json",
|
||||||
|
)
|
||||||
|
return client.call(
|
||||||
|
"DELETE",
|
||||||
|
apiPath,
|
||||||
|
apiHeaders,
|
||||||
|
apiParams,
|
||||||
|
responseType = Any::class.java,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the webhook signature key. This endpoint can be used to regenerate the signature key used to sign and validate payload deliveries for a specific webhook.
|
||||||
|
*
|
||||||
|
* @param webhookId Webhook ID.
|
||||||
|
* @return [io.appwrite.models.Webhook]
|
||||||
|
*/
|
||||||
|
@Throws(AppwriteException::class)
|
||||||
|
suspend fun updateSignature(
|
||||||
|
webhookId: String,
|
||||||
|
): io.appwrite.models.Webhook {
|
||||||
|
val apiPath = "/webhooks/{webhookId}/signature"
|
||||||
|
.replace("{webhookId}", webhookId)
|
||||||
|
|
||||||
|
val apiParams = mutableMapOf<String, Any?>(
|
||||||
|
)
|
||||||
|
val apiHeaders = mutableMapOf<String, String>(
|
||||||
|
"content-type" to "application/json",
|
||||||
|
)
|
||||||
|
val converter: (Any) -> io.appwrite.models.Webhook = {
|
||||||
|
io.appwrite.models.Webhook.from(map = it as Map<String, Any>)
|
||||||
|
}
|
||||||
|
return client.call(
|
||||||
|
"PATCH",
|
||||||
|
apiPath,
|
||||||
|
apiHeaders,
|
||||||
|
apiParams,
|
||||||
|
responseType = io.appwrite.models.Webhook::class.java,
|
||||||
|
converter,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user