diff --git a/README.md b/README.md
index 7452fe1..e7febd7 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,12 @@
# Appwrite Console SDK

-
+
[](https://travis-ci.com/appwrite/sdk-generator)
[](https://twitter.com/appwrite)
[](https://appwrite.io/discord)
-**This SDK is compatible with Appwrite server version 1.3.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-console/releases).**
+**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-console/releases).**
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Console SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
@@ -33,7 +33,7 @@ import { Client, Account } from "@appwrite.io/console";
To install with a CDN (content delivery network) add the following scripts to the bottom of your
tag, but before you use any Appwrite services:
```html
-
+
```
diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md
index 27524cb..9521cf6 100644
--- a/docs/examples/account/create-anonymous-session.md
+++ b/docs/examples/account/create-anonymous-session.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/create-email-session.md b/docs/examples/account/create-email-session.md
index 9318dea..1981277 100644
--- a/docs/examples/account/create-email-session.md
+++ b/docs/examples/account/create-email-session.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/create-j-w-t.md b/docs/examples/account/create-j-w-t.md
index b8d4d7a..8a851df 100644
--- a/docs/examples/account/create-j-w-t.md
+++ b/docs/examples/account/create-j-w-t.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/create-magic-u-r-l-session.md b/docs/examples/account/create-magic-u-r-l-session.md
index 54f7996..6917aa2 100644
--- a/docs/examples/account/create-magic-u-r-l-session.md
+++ b/docs/examples/account/create-magic-u-r-l-session.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/create-o-auth2session.md b/docs/examples/account/create-o-auth2session.md
index a4bc150..bf33c52 100644
--- a/docs/examples/account/create-o-auth2session.md
+++ b/docs/examples/account/create-o-auth2session.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/create-phone-session.md b/docs/examples/account/create-phone-session.md
index 5318098..85e7d68 100644
--- a/docs/examples/account/create-phone-session.md
+++ b/docs/examples/account/create-phone-session.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md
index 5ed9ca9..0b10961 100644
--- a/docs/examples/account/create-phone-verification.md
+++ b/docs/examples/account/create-phone-verification.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md
index 89937c4..dd33c01 100644
--- a/docs/examples/account/create-recovery.md
+++ b/docs/examples/account/create-recovery.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md
index 8817fab..7b1ec32 100644
--- a/docs/examples/account/create-verification.md
+++ b/docs/examples/account/create-verification.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md
index 99208f6..4c61ef8 100644
--- a/docs/examples/account/create.md
+++ b/docs/examples/account/create.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/create-with-invite-code.md b/docs/examples/account/delete-identity.md
similarity index 66%
rename from docs/examples/account/create-with-invite-code.md
rename to docs/examples/account/delete-identity.md
index 76bd23d..8e7a872 100644
--- a/docs/examples/account/create-with-invite-code.md
+++ b/docs/examples/account/delete-identity.md
@@ -5,11 +5,11 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
-const promise = account.createWithInviteCode('[USER_ID]', 'email@example.com', 'password');
+const promise = account.deleteIdentity('[IDENTITY_ID]');
promise.then(function (response) {
console.log(response); // Success
diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md
index 71b19a2..b360b3b 100644
--- a/docs/examples/account/delete-session.md
+++ b/docs/examples/account/delete-session.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md
index c458d66..0d0fea8 100644
--- a/docs/examples/account/delete-sessions.md
+++ b/docs/examples/account/delete-sessions.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md
index bf8f281..284f8fa 100644
--- a/docs/examples/account/get-prefs.md
+++ b/docs/examples/account/get-prefs.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md
index 475c63c..651d35c 100644
--- a/docs/examples/account/get-session.md
+++ b/docs/examples/account/get-session.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md
index fe50858..f6fc4b9 100644
--- a/docs/examples/account/get.md
+++ b/docs/examples/account/get.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md
new file mode 100644
index 0000000..ea18a00
--- /dev/null
+++ b/docs/examples/account/list-identities.md
@@ -0,0 +1,18 @@
+import { Client, Account } from "@appwrite.io/console";
+
+const client = new Client();
+
+const account = new Account(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = account.listIdentities();
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md
index c8ff221..4f1d681 100644
--- a/docs/examples/account/list-logs.md
+++ b/docs/examples/account/list-logs.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md
index 23f0d5c..bd3b102 100644
--- a/docs/examples/account/list-sessions.md
+++ b/docs/examples/account/list-sessions.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md
index 47b01fa..21b7fcc 100644
--- a/docs/examples/account/update-email.md
+++ b/docs/examples/account/update-email.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/update-magic-u-r-l-session.md b/docs/examples/account/update-magic-u-r-l-session.md
index 2b98124..1bc748e 100644
--- a/docs/examples/account/update-magic-u-r-l-session.md
+++ b/docs/examples/account/update-magic-u-r-l-session.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md
index b1c3d3e..5a9ab01 100644
--- a/docs/examples/account/update-name.md
+++ b/docs/examples/account/update-name.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md
index 66b7a41..ca059e5 100644
--- a/docs/examples/account/update-password.md
+++ b/docs/examples/account/update-password.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/update-phone-session.md b/docs/examples/account/update-phone-session.md
index f647850..4b47389 100644
--- a/docs/examples/account/update-phone-session.md
+++ b/docs/examples/account/update-phone-session.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md
index 7e7ea05..99c13cb 100644
--- a/docs/examples/account/update-phone-verification.md
+++ b/docs/examples/account/update-phone-verification.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md
index 90477b2..80f715e 100644
--- a/docs/examples/account/update-phone.md
+++ b/docs/examples/account/update-phone.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md
index 36db265..0a85380 100644
--- a/docs/examples/account/update-prefs.md
+++ b/docs/examples/account/update-prefs.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md
index 9c6de49..64c1545 100644
--- a/docs/examples/account/update-recovery.md
+++ b/docs/examples/account/update-recovery.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md
index a308c10..29dc0c0 100644
--- a/docs/examples/account/update-session.md
+++ b/docs/examples/account/update-session.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md
index 1698904..87b5146 100644
--- a/docs/examples/account/update-status.md
+++ b/docs/examples/account/update-status.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md
index 0fa03d6..93dd5db 100644
--- a/docs/examples/account/update-verification.md
+++ b/docs/examples/account/update-verification.md
@@ -5,7 +5,7 @@ const client = new Client();
const account = new Account(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/assistant/chat.md b/docs/examples/assistant/chat.md
new file mode 100644
index 0000000..a6c22b9
--- /dev/null
+++ b/docs/examples/assistant/chat.md
@@ -0,0 +1,18 @@
+import { Client, Assistant } from "@appwrite.io/console";
+
+const client = new Client();
+
+const assistant = new Assistant(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = assistant.chat('[PROMPT]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md
index d950653..f830eff 100644
--- a/docs/examples/avatars/get-browser.md
+++ b/docs/examples/avatars/get-browser.md
@@ -5,7 +5,7 @@ const client = new Client();
const avatars = new Avatars(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md
index dd2be71..a4e67b2 100644
--- a/docs/examples/avatars/get-credit-card.md
+++ b/docs/examples/avatars/get-credit-card.md
@@ -5,7 +5,7 @@ const client = new Client();
const avatars = new Avatars(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md
index f7ad069..14bc1b9 100644
--- a/docs/examples/avatars/get-favicon.md
+++ b/docs/examples/avatars/get-favicon.md
@@ -5,7 +5,7 @@ const client = new Client();
const avatars = new Avatars(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md
index 0ba68ae..52ebe68 100644
--- a/docs/examples/avatars/get-flag.md
+++ b/docs/examples/avatars/get-flag.md
@@ -5,7 +5,7 @@ const client = new Client();
const avatars = new Avatars(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md
index 30cbf4f..517421e 100644
--- a/docs/examples/avatars/get-image.md
+++ b/docs/examples/avatars/get-image.md
@@ -5,7 +5,7 @@ const client = new Client();
const avatars = new Avatars(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md
index 66a98d4..8b03b5d 100644
--- a/docs/examples/avatars/get-initials.md
+++ b/docs/examples/avatars/get-initials.md
@@ -5,7 +5,7 @@ const client = new Client();
const avatars = new Avatars(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/avatars/get-q-r.md b/docs/examples/avatars/get-q-r.md
index 8886db4..89cea47 100644
--- a/docs/examples/avatars/get-q-r.md
+++ b/docs/examples/avatars/get-q-r.md
@@ -5,7 +5,7 @@ const client = new Client();
const avatars = new Avatars(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/console/variables.md b/docs/examples/console/variables.md
index 5206f35..3c552de 100644
--- a/docs/examples/console/variables.md
+++ b/docs/examples/console/variables.md
@@ -5,7 +5,7 @@ const client = new Client();
const console = new Console(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md
index fb67fda..3924ff5 100644
--- a/docs/examples/databases/create-boolean-attribute.md
+++ b/docs/examples/databases/create-boolean-attribute.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md
index 11ba283..ff3dbd9 100644
--- a/docs/examples/databases/create-collection.md
+++ b/docs/examples/databases/create-collection.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md
index 6ea6fd4..4e1f319 100644
--- a/docs/examples/databases/create-datetime-attribute.md
+++ b/docs/examples/databases/create-datetime-attribute.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md
index bfc7f85..4b9adc4 100644
--- a/docs/examples/databases/create-document.md
+++ b/docs/examples/databases/create-document.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md
index 7f069e0..8d2a552 100644
--- a/docs/examples/databases/create-email-attribute.md
+++ b/docs/examples/databases/create-email-attribute.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md
index 4bf4e72..503290b 100644
--- a/docs/examples/databases/create-enum-attribute.md
+++ b/docs/examples/databases/create-enum-attribute.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md
index 051adcf..7ce41b6 100644
--- a/docs/examples/databases/create-float-attribute.md
+++ b/docs/examples/databases/create-float-attribute.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md
index 7adf23b..4da7980 100644
--- a/docs/examples/databases/create-index.md
+++ b/docs/examples/databases/create-index.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md
index 1002030..28218a1 100644
--- a/docs/examples/databases/create-integer-attribute.md
+++ b/docs/examples/databases/create-integer-attribute.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md
index 7a24794..88fcd66 100644
--- a/docs/examples/databases/create-ip-attribute.md
+++ b/docs/examples/databases/create-ip-attribute.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md
index 51bc588..6fe22ad 100644
--- a/docs/examples/databases/create-relationship-attribute.md
+++ b/docs/examples/databases/create-relationship-attribute.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md
index 99c5511..8beade8 100644
--- a/docs/examples/databases/create-string-attribute.md
+++ b/docs/examples/databases/create-string-attribute.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md
index 7dc2fab..1cbd402 100644
--- a/docs/examples/databases/create-url-attribute.md
+++ b/docs/examples/databases/create-url-attribute.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md
index 66e3006..bca894d 100644
--- a/docs/examples/databases/create.md
+++ b/docs/examples/databases/create.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md
index e7ef3cf..858010b 100644
--- a/docs/examples/databases/delete-attribute.md
+++ b/docs/examples/databases/delete-attribute.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md
index c143669..9ce95a5 100644
--- a/docs/examples/databases/delete-collection.md
+++ b/docs/examples/databases/delete-collection.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md
index 3264df2..d31d06b 100644
--- a/docs/examples/databases/delete-document.md
+++ b/docs/examples/databases/delete-document.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md
index 656ad1b..2ef22b8 100644
--- a/docs/examples/databases/delete-index.md
+++ b/docs/examples/databases/delete-index.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md
index 32169fd..bfd5b0c 100644
--- a/docs/examples/databases/delete.md
+++ b/docs/examples/databases/delete.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md
index e577e11..1542f64 100644
--- a/docs/examples/databases/get-attribute.md
+++ b/docs/examples/databases/get-attribute.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/get-collection-usage.md b/docs/examples/databases/get-collection-usage.md
index 700337f..983a613 100644
--- a/docs/examples/databases/get-collection-usage.md
+++ b/docs/examples/databases/get-collection-usage.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md
index 0033fa3..6dae02f 100644
--- a/docs/examples/databases/get-collection.md
+++ b/docs/examples/databases/get-collection.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/get-database-usage.md b/docs/examples/databases/get-database-usage.md
index 3c7f68e..f750408 100644
--- a/docs/examples/databases/get-database-usage.md
+++ b/docs/examples/databases/get-database-usage.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md
index e9416dc..87569bd 100644
--- a/docs/examples/databases/get-document.md
+++ b/docs/examples/databases/get-document.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md
index 78bb83a..d3df35d 100644
--- a/docs/examples/databases/get-index.md
+++ b/docs/examples/databases/get-index.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/get-usage.md b/docs/examples/databases/get-usage.md
index ef7f8e2..aabe123 100644
--- a/docs/examples/databases/get-usage.md
+++ b/docs/examples/databases/get-usage.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md
index 30dcb38..64c8a85 100644
--- a/docs/examples/databases/get.md
+++ b/docs/examples/databases/get.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md
index 1a3c009..df91236 100644
--- a/docs/examples/databases/list-attributes.md
+++ b/docs/examples/databases/list-attributes.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/list-collection-logs.md b/docs/examples/databases/list-collection-logs.md
index 8be65c7..89662fe 100644
--- a/docs/examples/databases/list-collection-logs.md
+++ b/docs/examples/databases/list-collection-logs.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md
index eeceea6..498e0d9 100644
--- a/docs/examples/databases/list-collections.md
+++ b/docs/examples/databases/list-collections.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/list-document-logs.md b/docs/examples/databases/list-document-logs.md
index 859e294..0161998 100644
--- a/docs/examples/databases/list-document-logs.md
+++ b/docs/examples/databases/list-document-logs.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md
index 46e4e74..9e29eb5 100644
--- a/docs/examples/databases/list-documents.md
+++ b/docs/examples/databases/list-documents.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md
index e78c0f3..3449b7d 100644
--- a/docs/examples/databases/list-indexes.md
+++ b/docs/examples/databases/list-indexes.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/list-logs.md b/docs/examples/databases/list-logs.md
index b818cbe..3b3f0dc 100644
--- a/docs/examples/databases/list-logs.md
+++ b/docs/examples/databases/list-logs.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md
index d96cbe6..20ae557 100644
--- a/docs/examples/databases/list.md
+++ b/docs/examples/databases/list.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md
index d58fd6e..629f864 100644
--- a/docs/examples/databases/update-boolean-attribute.md
+++ b/docs/examples/databases/update-boolean-attribute.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md
index 238fc9e..c0043b2 100644
--- a/docs/examples/databases/update-collection.md
+++ b/docs/examples/databases/update-collection.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md
index d710d02..f5be61d 100644
--- a/docs/examples/databases/update-datetime-attribute.md
+++ b/docs/examples/databases/update-datetime-attribute.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md
index bcd3866..249af34 100644
--- a/docs/examples/databases/update-document.md
+++ b/docs/examples/databases/update-document.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md
index ea77af2..e9a89a9 100644
--- a/docs/examples/databases/update-email-attribute.md
+++ b/docs/examples/databases/update-email-attribute.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md
index 3b930c3..8f0d5b6 100644
--- a/docs/examples/databases/update-enum-attribute.md
+++ b/docs/examples/databases/update-enum-attribute.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md
index 88a62cf..72fcd77 100644
--- a/docs/examples/databases/update-float-attribute.md
+++ b/docs/examples/databases/update-float-attribute.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md
index 6bdafb7..d035b84 100644
--- a/docs/examples/databases/update-integer-attribute.md
+++ b/docs/examples/databases/update-integer-attribute.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md
index 068357c..3373ae4 100644
--- a/docs/examples/databases/update-ip-attribute.md
+++ b/docs/examples/databases/update-ip-attribute.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md
index 17571d2..a329d5b 100644
--- a/docs/examples/databases/update-relationship-attribute.md
+++ b/docs/examples/databases/update-relationship-attribute.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md
index 5b1afea..6948253 100644
--- a/docs/examples/databases/update-string-attribute.md
+++ b/docs/examples/databases/update-string-attribute.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md
index 00e47af..4813940 100644
--- a/docs/examples/databases/update-url-attribute.md
+++ b/docs/examples/databases/update-url-attribute.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md
index 4c1447f..a816095 100644
--- a/docs/examples/databases/update.md
+++ b/docs/examples/databases/update.md
@@ -5,7 +5,7 @@ const client = new Client();
const databases = new Databases(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/functions/create-build.md b/docs/examples/functions/create-build.md
index b178a75..141bb32 100644
--- a/docs/examples/functions/create-build.md
+++ b/docs/examples/functions/create-build.md
@@ -5,7 +5,7 @@ const client = new Client();
const functions = new Functions(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md
index 376162b..6a97468 100644
--- a/docs/examples/functions/create-deployment.md
+++ b/docs/examples/functions/create-deployment.md
@@ -5,11 +5,11 @@ const client = new Client();
const functions = new Functions(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
-const promise = functions.createDeployment('[FUNCTION_ID]', '[ENTRYPOINT]', document.getElementById('uploader').files[0], false);
+const promise = functions.createDeployment('[FUNCTION_ID]', document.getElementById('uploader').files[0], false);
promise.then(function (response) {
console.log(response); // Success
diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md
index 7148128..cd623bb 100644
--- a/docs/examples/functions/create-execution.md
+++ b/docs/examples/functions/create-execution.md
@@ -5,7 +5,7 @@ const client = new Client();
const functions = new Functions(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md
index 12ffbc5..df147ac 100644
--- a/docs/examples/functions/create-variable.md
+++ b/docs/examples/functions/create-variable.md
@@ -5,7 +5,7 @@ const client = new Client();
const functions = new Functions(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md
index ecde885..ef53a13 100644
--- a/docs/examples/functions/create.md
+++ b/docs/examples/functions/create.md
@@ -5,11 +5,11 @@ const client = new Client();
const functions = new Functions(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
-const promise = functions.create('[FUNCTION_ID]', '[NAME]', 'node-14.5');
+const promise = functions.create('[FUNCTION_ID]', '[NAME]', 'node-18.0');
promise.then(function (response) {
console.log(response); // Success
diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md
index f4ad298..9597da3 100644
--- a/docs/examples/functions/delete-deployment.md
+++ b/docs/examples/functions/delete-deployment.md
@@ -5,7 +5,7 @@ const client = new Client();
const functions = new Functions(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/functions/delete-variable.md b/docs/examples/functions/delete-variable.md
index 5a3871c..30f2c03 100644
--- a/docs/examples/functions/delete-variable.md
+++ b/docs/examples/functions/delete-variable.md
@@ -5,7 +5,7 @@ const client = new Client();
const functions = new Functions(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md
index 167db40..3cfa756 100644
--- a/docs/examples/functions/delete.md
+++ b/docs/examples/functions/delete.md
@@ -5,7 +5,7 @@ const client = new Client();
const functions = new Functions(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/functions/download-deployment.md b/docs/examples/functions/download-deployment.md
new file mode 100644
index 0000000..fc514e7
--- /dev/null
+++ b/docs/examples/functions/download-deployment.md
@@ -0,0 +1,14 @@
+import { Client, Functions } from "@appwrite.io/console";
+
+const client = new Client();
+
+const functions = new Functions(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const result = functions.downloadDeployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]');
+
+console.log(result); // Resource URL
\ No newline at end of file
diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md
index f23a372..3a16587 100644
--- a/docs/examples/functions/get-deployment.md
+++ b/docs/examples/functions/get-deployment.md
@@ -5,7 +5,7 @@ const client = new Client();
const functions = new Functions(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md
index 7e59198..ac92b98 100644
--- a/docs/examples/functions/get-execution.md
+++ b/docs/examples/functions/get-execution.md
@@ -5,7 +5,7 @@ const client = new Client();
const functions = new Functions(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/functions/get-function-usage.md b/docs/examples/functions/get-function-usage.md
index cdf4cee..9ac2034 100644
--- a/docs/examples/functions/get-function-usage.md
+++ b/docs/examples/functions/get-function-usage.md
@@ -5,7 +5,7 @@ const client = new Client();
const functions = new Functions(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/functions/get-usage.md b/docs/examples/functions/get-usage.md
index 39b5d86..6e3fe87 100644
--- a/docs/examples/functions/get-usage.md
+++ b/docs/examples/functions/get-usage.md
@@ -5,7 +5,7 @@ const client = new Client();
const functions = new Functions(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md
index 3704697..3d4b07f 100644
--- a/docs/examples/functions/get-variable.md
+++ b/docs/examples/functions/get-variable.md
@@ -5,7 +5,7 @@ const client = new Client();
const functions = new Functions(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md
index f99ee1c..5cb2e28 100644
--- a/docs/examples/functions/get.md
+++ b/docs/examples/functions/get.md
@@ -5,7 +5,7 @@ const client = new Client();
const functions = new Functions(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md
index 1c703da..bd63271 100644
--- a/docs/examples/functions/list-deployments.md
+++ b/docs/examples/functions/list-deployments.md
@@ -5,7 +5,7 @@ const client = new Client();
const functions = new Functions(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md
index c2856c6..5df980d 100644
--- a/docs/examples/functions/list-executions.md
+++ b/docs/examples/functions/list-executions.md
@@ -5,7 +5,7 @@ const client = new Client();
const functions = new Functions(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md
index 8444918..18f13b2 100644
--- a/docs/examples/functions/list-runtimes.md
+++ b/docs/examples/functions/list-runtimes.md
@@ -5,7 +5,7 @@ const client = new Client();
const functions = new Functions(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md
index 8a4c032..5fd03bf 100644
--- a/docs/examples/functions/list-variables.md
+++ b/docs/examples/functions/list-variables.md
@@ -5,7 +5,7 @@ const client = new Client();
const functions = new Functions(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md
index 5669226..721ad6b 100644
--- a/docs/examples/functions/list.md
+++ b/docs/examples/functions/list.md
@@ -5,7 +5,7 @@ const client = new Client();
const functions = new Functions(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/functions/update-deployment.md b/docs/examples/functions/update-deployment.md
index 19a1f4c..9875232 100644
--- a/docs/examples/functions/update-deployment.md
+++ b/docs/examples/functions/update-deployment.md
@@ -5,7 +5,7 @@ const client = new Client();
const functions = new Functions(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md
index 4e590c5..33380ee 100644
--- a/docs/examples/functions/update-variable.md
+++ b/docs/examples/functions/update-variable.md
@@ -5,7 +5,7 @@ const client = new Client();
const functions = new Functions(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md
index 6573b61..473bbeb 100644
--- a/docs/examples/functions/update.md
+++ b/docs/examples/functions/update.md
@@ -5,7 +5,7 @@ const client = new Client();
const functions = new Functions(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md
index 8e1b3e5..ee70c36 100644
--- a/docs/examples/graphql/mutation.md
+++ b/docs/examples/graphql/mutation.md
@@ -5,7 +5,7 @@ const client = new Client();
const graphql = new Graphql(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md
index 7653270..055c6ad 100644
--- a/docs/examples/graphql/query.md
+++ b/docs/examples/graphql/query.md
@@ -5,7 +5,7 @@ const client = new Client();
const graphql = new Graphql(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/health/get-antivirus.md
index 9f4ac23..6d57550 100644
--- a/docs/examples/health/get-antivirus.md
+++ b/docs/examples/health/get-antivirus.md
@@ -5,7 +5,7 @@ const client = new Client();
const health = new Health(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md
index fa936d9..5748c8e 100644
--- a/docs/examples/health/get-cache.md
+++ b/docs/examples/health/get-cache.md
@@ -5,7 +5,7 @@ const client = new Client();
const health = new Health(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/health/get-d-b.md b/docs/examples/health/get-d-b.md
index fb0ca32..181dca7 100644
--- a/docs/examples/health/get-d-b.md
+++ b/docs/examples/health/get-d-b.md
@@ -5,7 +5,7 @@ const client = new Client();
const health = new Health(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md
index b71f00d..a56abb7 100644
--- a/docs/examples/health/get-pub-sub.md
+++ b/docs/examples/health/get-pub-sub.md
@@ -5,7 +5,7 @@ const client = new Client();
const health = new Health(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/health/get-queue-builds.md
new file mode 100644
index 0000000..a312fa7
--- /dev/null
+++ b/docs/examples/health/get-queue-builds.md
@@ -0,0 +1,18 @@
+import { Client, Health } from "@appwrite.io/console";
+
+const client = new Client();
+
+const health = new Health(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = health.getQueueBuilds();
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/health/get-queue-certificates.md b/docs/examples/health/get-queue-certificates.md
index 48cadf6..29fcb67 100644
--- a/docs/examples/health/get-queue-certificates.md
+++ b/docs/examples/health/get-queue-certificates.md
@@ -5,7 +5,7 @@ const client = new Client();
const health = new Health(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md
new file mode 100644
index 0000000..481480a
--- /dev/null
+++ b/docs/examples/health/get-queue-databases.md
@@ -0,0 +1,18 @@
+import { Client, Health } from "@appwrite.io/console";
+
+const client = new Client();
+
+const health = new Health(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = health.getQueueDatabases();
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md
new file mode 100644
index 0000000..c1bbb9f
--- /dev/null
+++ b/docs/examples/health/get-queue-deletes.md
@@ -0,0 +1,18 @@
+import { Client, Health } from "@appwrite.io/console";
+
+const client = new Client();
+
+const health = new Health(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = health.getQueueDeletes();
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md
index b33730d..0b011cb 100644
--- a/docs/examples/health/get-queue-functions.md
+++ b/docs/examples/health/get-queue-functions.md
@@ -5,7 +5,7 @@ const client = new Client();
const health = new Health(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md
index cb5db43..2dc33b3 100644
--- a/docs/examples/health/get-queue-logs.md
+++ b/docs/examples/health/get-queue-logs.md
@@ -5,7 +5,7 @@ const client = new Client();
const health = new Health(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md
new file mode 100644
index 0000000..8d6d682
--- /dev/null
+++ b/docs/examples/health/get-queue-mails.md
@@ -0,0 +1,18 @@
+import { Client, Health } from "@appwrite.io/console";
+
+const client = new Client();
+
+const health = new Health(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = health.getQueueMails();
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md
new file mode 100644
index 0000000..8102e75
--- /dev/null
+++ b/docs/examples/health/get-queue-messaging.md
@@ -0,0 +1,18 @@
+import { Client, Health } from "@appwrite.io/console";
+
+const client = new Client();
+
+const health = new Health(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = health.getQueueMessaging();
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md
new file mode 100644
index 0000000..af02853
--- /dev/null
+++ b/docs/examples/health/get-queue-migrations.md
@@ -0,0 +1,18 @@
+import { Client, Health } from "@appwrite.io/console";
+
+const client = new Client();
+
+const health = new Health(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = health.getQueueMigrations();
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md
index 8b43b58..534d68c 100644
--- a/docs/examples/health/get-queue-webhooks.md
+++ b/docs/examples/health/get-queue-webhooks.md
@@ -5,7 +5,7 @@ const client = new Client();
const health = new Health(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/health/get-queue.md b/docs/examples/health/get-queue.md
index 0970e07..bdc3caf 100644
--- a/docs/examples/health/get-queue.md
+++ b/docs/examples/health/get-queue.md
@@ -5,7 +5,7 @@ const client = new Client();
const health = new Health(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md
index 040ad3f..ff842f4 100644
--- a/docs/examples/health/get-storage-local.md
+++ b/docs/examples/health/get-storage-local.md
@@ -5,7 +5,7 @@ const client = new Client();
const health = new Health(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md
index 357d223..6d8e1c2 100644
--- a/docs/examples/health/get-time.md
+++ b/docs/examples/health/get-time.md
@@ -5,7 +5,7 @@ const client = new Client();
const health = new Health(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/health/get.md b/docs/examples/health/get.md
index eb8d90e..76e74be 100644
--- a/docs/examples/health/get.md
+++ b/docs/examples/health/get.md
@@ -5,7 +5,7 @@ const client = new Client();
const health = new Health(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md
index 84e8862..ac47468 100644
--- a/docs/examples/locale/get.md
+++ b/docs/examples/locale/get.md
@@ -5,7 +5,7 @@ const client = new Client();
const locale = new Locale(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md
new file mode 100644
index 0000000..9cb1335
--- /dev/null
+++ b/docs/examples/locale/list-codes.md
@@ -0,0 +1,18 @@
+import { Client, Locale } from "@appwrite.io/console";
+
+const client = new Client();
+
+const locale = new Locale(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = locale.listCodes();
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md
index 0faa078..b235839 100644
--- a/docs/examples/locale/list-continents.md
+++ b/docs/examples/locale/list-continents.md
@@ -5,7 +5,7 @@ const client = new Client();
const locale = new Locale(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/locale/list-countries-e-u.md b/docs/examples/locale/list-countries-e-u.md
index e2c916f..59d6e24 100644
--- a/docs/examples/locale/list-countries-e-u.md
+++ b/docs/examples/locale/list-countries-e-u.md
@@ -5,7 +5,7 @@ const client = new Client();
const locale = new Locale(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md
index d19818b..898cb3c 100644
--- a/docs/examples/locale/list-countries-phones.md
+++ b/docs/examples/locale/list-countries-phones.md
@@ -5,7 +5,7 @@ const client = new Client();
const locale = new Locale(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md
index fe090c0..a36b8c2 100644
--- a/docs/examples/locale/list-countries.md
+++ b/docs/examples/locale/list-countries.md
@@ -5,7 +5,7 @@ const client = new Client();
const locale = new Locale(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md
index 5adb18a..1f34891 100644
--- a/docs/examples/locale/list-currencies.md
+++ b/docs/examples/locale/list-currencies.md
@@ -5,7 +5,7 @@ const client = new Client();
const locale = new Locale(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md
index 3a50221..4fb4dbf 100644
--- a/docs/examples/locale/list-languages.md
+++ b/docs/examples/locale/list-languages.md
@@ -5,7 +5,7 @@ const client = new Client();
const locale = new Locale(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/migrations/create-appwrite-migration.md b/docs/examples/migrations/create-appwrite-migration.md
new file mode 100644
index 0000000..7001e18
--- /dev/null
+++ b/docs/examples/migrations/create-appwrite-migration.md
@@ -0,0 +1,18 @@
+import { Client, Migrations } from "@appwrite.io/console";
+
+const client = new Client();
+
+const migrations = new Migrations(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = migrations.createAppwriteMigration([], 'https://example.com', '[PROJECT_ID]', '[API_KEY]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/migrations/create-firebase-migration.md b/docs/examples/migrations/create-firebase-migration.md
new file mode 100644
index 0000000..de5becb
--- /dev/null
+++ b/docs/examples/migrations/create-firebase-migration.md
@@ -0,0 +1,18 @@
+import { Client, Migrations } from "@appwrite.io/console";
+
+const client = new Client();
+
+const migrations = new Migrations(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = migrations.createFirebaseMigration([], '[SERVICE_ACCOUNT]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/migrations/create-firebase-o-auth-migration.md b/docs/examples/migrations/create-firebase-o-auth-migration.md
new file mode 100644
index 0000000..07e3efb
--- /dev/null
+++ b/docs/examples/migrations/create-firebase-o-auth-migration.md
@@ -0,0 +1,18 @@
+import { Client, Migrations } from "@appwrite.io/console";
+
+const client = new Client();
+
+const migrations = new Migrations(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = migrations.createFirebaseOAuthMigration([], '[PROJECT_ID]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/migrations/create-n-host-migration.md b/docs/examples/migrations/create-n-host-migration.md
new file mode 100644
index 0000000..b9a614d
--- /dev/null
+++ b/docs/examples/migrations/create-n-host-migration.md
@@ -0,0 +1,18 @@
+import { Client, Migrations } from "@appwrite.io/console";
+
+const client = new Client();
+
+const migrations = new Migrations(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = migrations.createNHostMigration([], '[SUBDOMAIN]', '[REGION]', '[ADMIN_SECRET]', '[DATABASE]', '[USERNAME]', '[PASSWORD]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/migrations/create-supabase-migration.md b/docs/examples/migrations/create-supabase-migration.md
new file mode 100644
index 0000000..38b533f
--- /dev/null
+++ b/docs/examples/migrations/create-supabase-migration.md
@@ -0,0 +1,18 @@
+import { Client, Migrations } from "@appwrite.io/console";
+
+const client = new Client();
+
+const migrations = new Migrations(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = migrations.createSupabaseMigration([], 'https://example.com', '[API_KEY]', '[DATABASE_HOST]', '[USERNAME]', '[PASSWORD]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/migrations/delete-firebase-auth.md b/docs/examples/migrations/delete-firebase-auth.md
new file mode 100644
index 0000000..9884956
--- /dev/null
+++ b/docs/examples/migrations/delete-firebase-auth.md
@@ -0,0 +1,18 @@
+import { Client, Migrations } from "@appwrite.io/console";
+
+const client = new Client();
+
+const migrations = new Migrations(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = migrations.deleteFirebaseAuth();
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/migrations/delete.md b/docs/examples/migrations/delete.md
new file mode 100644
index 0000000..88d8262
--- /dev/null
+++ b/docs/examples/migrations/delete.md
@@ -0,0 +1,18 @@
+import { Client, Migrations } from "@appwrite.io/console";
+
+const client = new Client();
+
+const migrations = new Migrations(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = migrations.delete('[MIGRATION_ID]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/migrations/get-appwrite-report.md b/docs/examples/migrations/get-appwrite-report.md
new file mode 100644
index 0000000..0b922b2
--- /dev/null
+++ b/docs/examples/migrations/get-appwrite-report.md
@@ -0,0 +1,18 @@
+import { Client, Migrations } from "@appwrite.io/console";
+
+const client = new Client();
+
+const migrations = new Migrations(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = migrations.getAppwriteReport([], 'https://example.com', '[PROJECT_ID]', '[KEY]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/migrations/get-firebase-report-o-auth.md b/docs/examples/migrations/get-firebase-report-o-auth.md
new file mode 100644
index 0000000..7b52ac9
--- /dev/null
+++ b/docs/examples/migrations/get-firebase-report-o-auth.md
@@ -0,0 +1,18 @@
+import { Client, Migrations } from "@appwrite.io/console";
+
+const client = new Client();
+
+const migrations = new Migrations(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = migrations.getFirebaseReportOAuth([], '[PROJECT_ID]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/migrations/get-firebase-report.md b/docs/examples/migrations/get-firebase-report.md
new file mode 100644
index 0000000..3764d78
--- /dev/null
+++ b/docs/examples/migrations/get-firebase-report.md
@@ -0,0 +1,18 @@
+import { Client, Migrations } from "@appwrite.io/console";
+
+const client = new Client();
+
+const migrations = new Migrations(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = migrations.getFirebaseReport([], '[SERVICE_ACCOUNT]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/migrations/get-n-host-report.md b/docs/examples/migrations/get-n-host-report.md
new file mode 100644
index 0000000..34d3404
--- /dev/null
+++ b/docs/examples/migrations/get-n-host-report.md
@@ -0,0 +1,18 @@
+import { Client, Migrations } from "@appwrite.io/console";
+
+const client = new Client();
+
+const migrations = new Migrations(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = migrations.getNHostReport([], '[SUBDOMAIN]', '[REGION]', '[ADMIN_SECRET]', '[DATABASE]', '[USERNAME]', '[PASSWORD]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/migrations/get-supabase-report.md b/docs/examples/migrations/get-supabase-report.md
new file mode 100644
index 0000000..00fbb9e
--- /dev/null
+++ b/docs/examples/migrations/get-supabase-report.md
@@ -0,0 +1,18 @@
+import { Client, Migrations } from "@appwrite.io/console";
+
+const client = new Client();
+
+const migrations = new Migrations(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = migrations.getSupabaseReport([], 'https://example.com', '[API_KEY]', '[DATABASE_HOST]', '[USERNAME]', '[PASSWORD]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/migrations/get.md b/docs/examples/migrations/get.md
new file mode 100644
index 0000000..1331be2
--- /dev/null
+++ b/docs/examples/migrations/get.md
@@ -0,0 +1,18 @@
+import { Client, Migrations } from "@appwrite.io/console";
+
+const client = new Client();
+
+const migrations = new Migrations(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = migrations.get('[MIGRATION_ID]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/migrations/list-firebase-projects.md b/docs/examples/migrations/list-firebase-projects.md
new file mode 100644
index 0000000..799f587
--- /dev/null
+++ b/docs/examples/migrations/list-firebase-projects.md
@@ -0,0 +1,18 @@
+import { Client, Migrations } from "@appwrite.io/console";
+
+const client = new Client();
+
+const migrations = new Migrations(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = migrations.listFirebaseProjects();
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/migrations/list.md b/docs/examples/migrations/list.md
new file mode 100644
index 0000000..61f7754
--- /dev/null
+++ b/docs/examples/migrations/list.md
@@ -0,0 +1,18 @@
+import { Client, Migrations } from "@appwrite.io/console";
+
+const client = new Client();
+
+const migrations = new Migrations(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = migrations.list();
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/migrations/retry.md b/docs/examples/migrations/retry.md
new file mode 100644
index 0000000..4c39d98
--- /dev/null
+++ b/docs/examples/migrations/retry.md
@@ -0,0 +1,18 @@
+import { Client, Migrations } from "@appwrite.io/console";
+
+const client = new Client();
+
+const migrations = new Migrations(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = migrations.retry('[MIGRATION_ID]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/project/create-variable.md b/docs/examples/project/create-variable.md
new file mode 100644
index 0000000..94c0f04
--- /dev/null
+++ b/docs/examples/project/create-variable.md
@@ -0,0 +1,18 @@
+import { Client, Project } from "@appwrite.io/console";
+
+const client = new Client();
+
+const project = new Project(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = project.createVariable('[KEY]', '[VALUE]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/project/delete-variable.md b/docs/examples/project/delete-variable.md
new file mode 100644
index 0000000..23c4144
--- /dev/null
+++ b/docs/examples/project/delete-variable.md
@@ -0,0 +1,18 @@
+import { Client, Project } from "@appwrite.io/console";
+
+const client = new Client();
+
+const project = new Project(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = project.deleteVariable('[VARIABLE_ID]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/project/get-usage.md b/docs/examples/project/get-usage.md
index 927ae0d..ca7457d 100644
--- a/docs/examples/project/get-usage.md
+++ b/docs/examples/project/get-usage.md
@@ -5,11 +5,11 @@ const client = new Client();
const project = new Project(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
-const promise = project.getUsage();
+const promise = project.getUsage('', '');
promise.then(function (response) {
console.log(response); // Success
diff --git a/docs/examples/project/get-variable.md b/docs/examples/project/get-variable.md
new file mode 100644
index 0000000..c147f63
--- /dev/null
+++ b/docs/examples/project/get-variable.md
@@ -0,0 +1,18 @@
+import { Client, Project } from "@appwrite.io/console";
+
+const client = new Client();
+
+const project = new Project(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = project.getVariable('[VARIABLE_ID]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/project/list-variables.md b/docs/examples/project/list-variables.md
new file mode 100644
index 0000000..facfc32
--- /dev/null
+++ b/docs/examples/project/list-variables.md
@@ -0,0 +1,18 @@
+import { Client, Project } from "@appwrite.io/console";
+
+const client = new Client();
+
+const project = new Project(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = project.listVariables();
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/project/update-variable.md b/docs/examples/project/update-variable.md
new file mode 100644
index 0000000..5759018
--- /dev/null
+++ b/docs/examples/project/update-variable.md
@@ -0,0 +1,18 @@
+import { Client, Project } from "@appwrite.io/console";
+
+const client = new Client();
+
+const project = new Project(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = project.updateVariable('[VARIABLE_ID]', '[KEY]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/projects/create-key.md b/docs/examples/projects/create-key.md
index 790315c..02032e8 100644
--- a/docs/examples/projects/create-key.md
+++ b/docs/examples/projects/create-key.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/create-platform.md b/docs/examples/projects/create-platform.md
index b825a16..4a31968 100644
--- a/docs/examples/projects/create-platform.md
+++ b/docs/examples/projects/create-platform.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/create-webhook.md b/docs/examples/projects/create-webhook.md
index 0aa6513..356a5ff 100644
--- a/docs/examples/projects/create-webhook.md
+++ b/docs/examples/projects/create-webhook.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/create.md b/docs/examples/projects/create.md
index 59fde73..87eab0a 100644
--- a/docs/examples/projects/create.md
+++ b/docs/examples/projects/create.md
@@ -5,11 +5,11 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
-const promise = projects.create('[PROJECT_ID]', '[NAME]', '[TEAM_ID]');
+const promise = projects.create('', '[NAME]', '[TEAM_ID]');
promise.then(function (response) {
console.log(response); // Success
diff --git a/docs/examples/projects/delete-email-template.md b/docs/examples/projects/delete-email-template.md
new file mode 100644
index 0000000..0df4a1d
--- /dev/null
+++ b/docs/examples/projects/delete-email-template.md
@@ -0,0 +1,18 @@
+import { Client, Projects } from "@appwrite.io/console";
+
+const client = new Client();
+
+const projects = new Projects(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = projects.deleteEmailTemplate('[PROJECT_ID]', 'verification', 'af');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/projects/delete-key.md b/docs/examples/projects/delete-key.md
index 8f757b4..74c6bd1 100644
--- a/docs/examples/projects/delete-key.md
+++ b/docs/examples/projects/delete-key.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/delete-platform.md b/docs/examples/projects/delete-platform.md
index f867852..da8ce56 100644
--- a/docs/examples/projects/delete-platform.md
+++ b/docs/examples/projects/delete-platform.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/delete-sms-template.md b/docs/examples/projects/delete-sms-template.md
new file mode 100644
index 0000000..ba0bc8e
--- /dev/null
+++ b/docs/examples/projects/delete-sms-template.md
@@ -0,0 +1,18 @@
+import { Client, Projects } from "@appwrite.io/console";
+
+const client = new Client();
+
+const projects = new Projects(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = projects.deleteSmsTemplate('[PROJECT_ID]', 'verification', 'af');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/projects/delete-webhook.md b/docs/examples/projects/delete-webhook.md
index 9a326f5..08e3af6 100644
--- a/docs/examples/projects/delete-webhook.md
+++ b/docs/examples/projects/delete-webhook.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/delete.md b/docs/examples/projects/delete.md
index 7df1b8c..4f227a4 100644
--- a/docs/examples/projects/delete.md
+++ b/docs/examples/projects/delete.md
@@ -5,11 +5,11 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
-const promise = projects.delete('[PROJECT_ID]', 'password');
+const promise = projects.delete('[PROJECT_ID]');
promise.then(function (response) {
console.log(response); // Success
diff --git a/docs/examples/projects/get-email-template.md b/docs/examples/projects/get-email-template.md
new file mode 100644
index 0000000..f7c193b
--- /dev/null
+++ b/docs/examples/projects/get-email-template.md
@@ -0,0 +1,18 @@
+import { Client, Projects } from "@appwrite.io/console";
+
+const client = new Client();
+
+const projects = new Projects(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = projects.getEmailTemplate('[PROJECT_ID]', 'verification', 'af');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/projects/get-key.md b/docs/examples/projects/get-key.md
index bc8e4d7..c0d3282 100644
--- a/docs/examples/projects/get-key.md
+++ b/docs/examples/projects/get-key.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/get-platform.md b/docs/examples/projects/get-platform.md
index 8e89e41..fd65231 100644
--- a/docs/examples/projects/get-platform.md
+++ b/docs/examples/projects/get-platform.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/get-sms-template.md b/docs/examples/projects/get-sms-template.md
new file mode 100644
index 0000000..5fce9ff
--- /dev/null
+++ b/docs/examples/projects/get-sms-template.md
@@ -0,0 +1,18 @@
+import { Client, Projects } from "@appwrite.io/console";
+
+const client = new Client();
+
+const projects = new Projects(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = projects.getSmsTemplate('[PROJECT_ID]', 'verification', 'af');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/projects/get-webhook.md b/docs/examples/projects/get-webhook.md
index b0234f2..7f580b5 100644
--- a/docs/examples/projects/get-webhook.md
+++ b/docs/examples/projects/get-webhook.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/get.md b/docs/examples/projects/get.md
index 2c4d203..23c235a 100644
--- a/docs/examples/projects/get.md
+++ b/docs/examples/projects/get.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/list-keys.md b/docs/examples/projects/list-keys.md
index e9bc7bd..c2dce0a 100644
--- a/docs/examples/projects/list-keys.md
+++ b/docs/examples/projects/list-keys.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/list-platforms.md b/docs/examples/projects/list-platforms.md
index 2c2f9eb..968438f 100644
--- a/docs/examples/projects/list-platforms.md
+++ b/docs/examples/projects/list-platforms.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/list-webhooks.md b/docs/examples/projects/list-webhooks.md
index 9df8271..e0e0af3 100644
--- a/docs/examples/projects/list-webhooks.md
+++ b/docs/examples/projects/list-webhooks.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/list.md b/docs/examples/projects/list.md
index 230287e..0cf5002 100644
--- a/docs/examples/projects/list.md
+++ b/docs/examples/projects/list.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/update-auth-duration.md b/docs/examples/projects/update-auth-duration.md
index e93fce8..37c6922 100644
--- a/docs/examples/projects/update-auth-duration.md
+++ b/docs/examples/projects/update-auth-duration.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/update-auth-limit.md b/docs/examples/projects/update-auth-limit.md
index 4c0de16..a63f5b4 100644
--- a/docs/examples/projects/update-auth-limit.md
+++ b/docs/examples/projects/update-auth-limit.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/update-auth-password-dictionary.md b/docs/examples/projects/update-auth-password-dictionary.md
index 2cbeea5..e3cb529 100644
--- a/docs/examples/projects/update-auth-password-dictionary.md
+++ b/docs/examples/projects/update-auth-password-dictionary.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/update-auth-password-history.md b/docs/examples/projects/update-auth-password-history.md
index 0ec081d..67b885d 100644
--- a/docs/examples/projects/update-auth-password-history.md
+++ b/docs/examples/projects/update-auth-password-history.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/update-auth-sessions-limit.md b/docs/examples/projects/update-auth-sessions-limit.md
index 0481980..ef2dffa 100644
--- a/docs/examples/projects/update-auth-sessions-limit.md
+++ b/docs/examples/projects/update-auth-sessions-limit.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/update-auth-status.md b/docs/examples/projects/update-auth-status.md
index bed30d9..4751442 100644
--- a/docs/examples/projects/update-auth-status.md
+++ b/docs/examples/projects/update-auth-status.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/update-domain-verification.md b/docs/examples/projects/update-domain-verification.md
deleted file mode 100644
index 7e128d8..0000000
--- a/docs/examples/projects/update-domain-verification.md
+++ /dev/null
@@ -1,18 +0,0 @@
-import { Client, Projects } from "@appwrite.io/console";
-
-const client = new Client();
-
-const projects = new Projects(client);
-
-client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
- .setProject('5df5acd0d48c2') // Your project ID
-;
-
-const promise = projects.updateDomainVerification('[PROJECT_ID]', '[DOMAIN_ID]');
-
-promise.then(function (response) {
- console.log(response); // Success
-}, function (error) {
- console.log(error); // Failure
-});
\ No newline at end of file
diff --git a/docs/examples/projects/update-email-template.md b/docs/examples/projects/update-email-template.md
new file mode 100644
index 0000000..b495947
--- /dev/null
+++ b/docs/examples/projects/update-email-template.md
@@ -0,0 +1,18 @@
+import { Client, Projects } from "@appwrite.io/console";
+
+const client = new Client();
+
+const projects = new Projects(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = projects.updateEmailTemplate('[PROJECT_ID]', 'verification', 'af', '[SUBJECT]', '[MESSAGE]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/projects/update-key.md b/docs/examples/projects/update-key.md
index 9495a95..fd2bde8 100644
--- a/docs/examples/projects/update-key.md
+++ b/docs/examples/projects/update-key.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/update-o-auth2.md b/docs/examples/projects/update-o-auth2.md
index 2a33b74..34ce814 100644
--- a/docs/examples/projects/update-o-auth2.md
+++ b/docs/examples/projects/update-o-auth2.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/delete-domain.md b/docs/examples/projects/update-personal-data-check.md
similarity index 69%
rename from docs/examples/projects/delete-domain.md
rename to docs/examples/projects/update-personal-data-check.md
index d3e23fa..6165e91 100644
--- a/docs/examples/projects/delete-domain.md
+++ b/docs/examples/projects/update-personal-data-check.md
@@ -5,11 +5,11 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
-const promise = projects.deleteDomain('[PROJECT_ID]', '[DOMAIN_ID]');
+const promise = projects.updatePersonalDataCheck('[PROJECT_ID]', false);
promise.then(function (response) {
console.log(response); // Success
diff --git a/docs/examples/projects/update-platform.md b/docs/examples/projects/update-platform.md
index 44c40ed..ce49dff 100644
--- a/docs/examples/projects/update-platform.md
+++ b/docs/examples/projects/update-platform.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/create-domain.md b/docs/examples/projects/update-service-status-all.md
similarity index 69%
rename from docs/examples/projects/create-domain.md
rename to docs/examples/projects/update-service-status-all.md
index 03283db..d348067 100644
--- a/docs/examples/projects/create-domain.md
+++ b/docs/examples/projects/update-service-status-all.md
@@ -5,11 +5,11 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
-const promise = projects.createDomain('[PROJECT_ID]', '');
+const promise = projects.updateServiceStatusAll('[PROJECT_ID]', false);
promise.then(function (response) {
console.log(response); // Success
diff --git a/docs/examples/projects/update-service-status.md b/docs/examples/projects/update-service-status.md
index 5ca171d..5b72700 100644
--- a/docs/examples/projects/update-service-status.md
+++ b/docs/examples/projects/update-service-status.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/update-sms-template.md b/docs/examples/projects/update-sms-template.md
new file mode 100644
index 0000000..54edccd
--- /dev/null
+++ b/docs/examples/projects/update-sms-template.md
@@ -0,0 +1,18 @@
+import { Client, Projects } from "@appwrite.io/console";
+
+const client = new Client();
+
+const projects = new Projects(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = projects.updateSmsTemplate('[PROJECT_ID]', 'verification', 'af', '[MESSAGE]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/projects/get-domain.md b/docs/examples/projects/update-smtp-configuration.md
similarity index 69%
rename from docs/examples/projects/get-domain.md
rename to docs/examples/projects/update-smtp-configuration.md
index a0b28df..54f344e 100644
--- a/docs/examples/projects/get-domain.md
+++ b/docs/examples/projects/update-smtp-configuration.md
@@ -5,11 +5,11 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
-const promise = projects.getDomain('[PROJECT_ID]', '[DOMAIN_ID]');
+const promise = projects.updateSmtpConfiguration('[PROJECT_ID]', false);
promise.then(function (response) {
console.log(response); // Success
diff --git a/docs/examples/projects/list-domains.md b/docs/examples/projects/update-team.md
similarity index 70%
rename from docs/examples/projects/list-domains.md
rename to docs/examples/projects/update-team.md
index 303125a..8b1c2f5 100644
--- a/docs/examples/projects/list-domains.md
+++ b/docs/examples/projects/update-team.md
@@ -5,11 +5,11 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
-const promise = projects.listDomains('[PROJECT_ID]');
+const promise = projects.updateTeam('[PROJECT_ID]', '[TEAM_ID]');
promise.then(function (response) {
console.log(response); // Success
diff --git a/docs/examples/projects/update-webhook-signature.md b/docs/examples/projects/update-webhook-signature.md
index 60eee58..472271f 100644
--- a/docs/examples/projects/update-webhook-signature.md
+++ b/docs/examples/projects/update-webhook-signature.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/update-webhook.md b/docs/examples/projects/update-webhook.md
index 93ee4bd..1339a45 100644
--- a/docs/examples/projects/update-webhook.md
+++ b/docs/examples/projects/update-webhook.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/projects/update.md b/docs/examples/projects/update.md
index bfaf099..3128180 100644
--- a/docs/examples/projects/update.md
+++ b/docs/examples/projects/update.md
@@ -5,7 +5,7 @@ const client = new Client();
const projects = new Projects(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/proxy/create-rule.md b/docs/examples/proxy/create-rule.md
new file mode 100644
index 0000000..fc11d86
--- /dev/null
+++ b/docs/examples/proxy/create-rule.md
@@ -0,0 +1,18 @@
+import { Client, Proxy } from "@appwrite.io/console";
+
+const client = new Client();
+
+const proxy = new Proxy(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = proxy.createRule('', 'api');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/proxy/delete-rule.md b/docs/examples/proxy/delete-rule.md
new file mode 100644
index 0000000..f21e4f2
--- /dev/null
+++ b/docs/examples/proxy/delete-rule.md
@@ -0,0 +1,18 @@
+import { Client, Proxy } from "@appwrite.io/console";
+
+const client = new Client();
+
+const proxy = new Proxy(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = proxy.deleteRule('[RULE_ID]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/proxy/get-rule.md b/docs/examples/proxy/get-rule.md
new file mode 100644
index 0000000..99ddbca
--- /dev/null
+++ b/docs/examples/proxy/get-rule.md
@@ -0,0 +1,18 @@
+import { Client, Proxy } from "@appwrite.io/console";
+
+const client = new Client();
+
+const proxy = new Proxy(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = proxy.getRule('[RULE_ID]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/proxy/list-rules.md b/docs/examples/proxy/list-rules.md
new file mode 100644
index 0000000..baa2773
--- /dev/null
+++ b/docs/examples/proxy/list-rules.md
@@ -0,0 +1,18 @@
+import { Client, Proxy } from "@appwrite.io/console";
+
+const client = new Client();
+
+const proxy = new Proxy(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = proxy.listRules();
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/proxy/update-rule-verification.md b/docs/examples/proxy/update-rule-verification.md
new file mode 100644
index 0000000..33b4422
--- /dev/null
+++ b/docs/examples/proxy/update-rule-verification.md
@@ -0,0 +1,18 @@
+import { Client, Proxy } from "@appwrite.io/console";
+
+const client = new Client();
+
+const proxy = new Proxy(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = proxy.updateRuleVerification('[RULE_ID]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md
index 76594c1..7696b14 100644
--- a/docs/examples/storage/create-bucket.md
+++ b/docs/examples/storage/create-bucket.md
@@ -5,7 +5,7 @@ const client = new Client();
const storage = new Storage(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md
index ac01673..d1bf55b 100644
--- a/docs/examples/storage/create-file.md
+++ b/docs/examples/storage/create-file.md
@@ -5,7 +5,7 @@ const client = new Client();
const storage = new Storage(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md
index 9ac2efd..4634b11 100644
--- a/docs/examples/storage/delete-bucket.md
+++ b/docs/examples/storage/delete-bucket.md
@@ -5,7 +5,7 @@ const client = new Client();
const storage = new Storage(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md
index bba48cf..b4c0ff0 100644
--- a/docs/examples/storage/delete-file.md
+++ b/docs/examples/storage/delete-file.md
@@ -5,7 +5,7 @@ const client = new Client();
const storage = new Storage(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/storage/get-bucket-usage.md b/docs/examples/storage/get-bucket-usage.md
index 6511c8a..65c66d7 100644
--- a/docs/examples/storage/get-bucket-usage.md
+++ b/docs/examples/storage/get-bucket-usage.md
@@ -5,7 +5,7 @@ const client = new Client();
const storage = new Storage(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md
index c03b59e..2b65e8b 100644
--- a/docs/examples/storage/get-bucket.md
+++ b/docs/examples/storage/get-bucket.md
@@ -5,7 +5,7 @@ const client = new Client();
const storage = new Storage(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md
index 11f19a2..1ce57cb 100644
--- a/docs/examples/storage/get-file-download.md
+++ b/docs/examples/storage/get-file-download.md
@@ -5,7 +5,7 @@ const client = new Client();
const storage = new Storage(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md
index e0044fc..ab6bc18 100644
--- a/docs/examples/storage/get-file-preview.md
+++ b/docs/examples/storage/get-file-preview.md
@@ -5,7 +5,7 @@ const client = new Client();
const storage = new Storage(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md
index ccd9cba..7ce851f 100644
--- a/docs/examples/storage/get-file-view.md
+++ b/docs/examples/storage/get-file-view.md
@@ -5,7 +5,7 @@ const client = new Client();
const storage = new Storage(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md
index 1985606..b6e8003 100644
--- a/docs/examples/storage/get-file.md
+++ b/docs/examples/storage/get-file.md
@@ -5,7 +5,7 @@ const client = new Client();
const storage = new Storage(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/storage/get-usage.md b/docs/examples/storage/get-usage.md
index c79e3b5..f618ba4 100644
--- a/docs/examples/storage/get-usage.md
+++ b/docs/examples/storage/get-usage.md
@@ -5,7 +5,7 @@ const client = new Client();
const storage = new Storage(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md
index a21dfae..5a35690 100644
--- a/docs/examples/storage/list-buckets.md
+++ b/docs/examples/storage/list-buckets.md
@@ -5,7 +5,7 @@ const client = new Client();
const storage = new Storage(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md
index 728f490..0c6170f 100644
--- a/docs/examples/storage/list-files.md
+++ b/docs/examples/storage/list-files.md
@@ -5,7 +5,7 @@ const client = new Client();
const storage = new Storage(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md
index 4821dbe..09ed4ce 100644
--- a/docs/examples/storage/update-bucket.md
+++ b/docs/examples/storage/update-bucket.md
@@ -5,7 +5,7 @@ const client = new Client();
const storage = new Storage(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md
index 2d6b3d4..abaaf9a 100644
--- a/docs/examples/storage/update-file.md
+++ b/docs/examples/storage/update-file.md
@@ -5,7 +5,7 @@ const client = new Client();
const storage = new Storage(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md
index b86f2c9..4ceac9f 100644
--- a/docs/examples/teams/create-membership.md
+++ b/docs/examples/teams/create-membership.md
@@ -5,11 +5,11 @@ const client = new Client();
const teams = new Teams(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
-const promise = teams.createMembership('[TEAM_ID]', [], 'https://example.com');
+const promise = teams.createMembership('[TEAM_ID]', []);
promise.then(function (response) {
console.log(response); // Success
diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md
index 15cdd13..a2cb342 100644
--- a/docs/examples/teams/create.md
+++ b/docs/examples/teams/create.md
@@ -5,7 +5,7 @@ const client = new Client();
const teams = new Teams(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md
index 0b38955..4e7d7e7 100644
--- a/docs/examples/teams/delete-membership.md
+++ b/docs/examples/teams/delete-membership.md
@@ -5,7 +5,7 @@ const client = new Client();
const teams = new Teams(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md
index 8372227..0bc778b 100644
--- a/docs/examples/teams/delete.md
+++ b/docs/examples/teams/delete.md
@@ -5,7 +5,7 @@ const client = new Client();
const teams = new Teams(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md
index 4d4c5b1..c0bdae5 100644
--- a/docs/examples/teams/get-membership.md
+++ b/docs/examples/teams/get-membership.md
@@ -5,7 +5,7 @@ const client = new Client();
const teams = new Teams(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md
index 127284d..2104c5f 100644
--- a/docs/examples/teams/get-prefs.md
+++ b/docs/examples/teams/get-prefs.md
@@ -5,7 +5,7 @@ const client = new Client();
const teams = new Teams(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md
index eaea368..2dbfdb4 100644
--- a/docs/examples/teams/get.md
+++ b/docs/examples/teams/get.md
@@ -5,7 +5,7 @@ const client = new Client();
const teams = new Teams(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/teams/list-logs.md b/docs/examples/teams/list-logs.md
index 6a7c2e2..2c3c731 100644
--- a/docs/examples/teams/list-logs.md
+++ b/docs/examples/teams/list-logs.md
@@ -5,7 +5,7 @@ const client = new Client();
const teams = new Teams(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md
index 3dfd5fb..f7a7d1a 100644
--- a/docs/examples/teams/list-memberships.md
+++ b/docs/examples/teams/list-memberships.md
@@ -5,7 +5,7 @@ const client = new Client();
const teams = new Teams(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md
index 95f3d61..99e482d 100644
--- a/docs/examples/teams/list.md
+++ b/docs/examples/teams/list.md
@@ -5,7 +5,7 @@ const client = new Client();
const teams = new Teams(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md
index a41ba24..1c8ec3a 100644
--- a/docs/examples/teams/update-membership-status.md
+++ b/docs/examples/teams/update-membership-status.md
@@ -5,7 +5,7 @@ const client = new Client();
const teams = new Teams(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/teams/update-membership-roles.md b/docs/examples/teams/update-membership.md
similarity index 67%
rename from docs/examples/teams/update-membership-roles.md
rename to docs/examples/teams/update-membership.md
index d634392..1f9051f 100644
--- a/docs/examples/teams/update-membership-roles.md
+++ b/docs/examples/teams/update-membership.md
@@ -5,11 +5,11 @@ const client = new Client();
const teams = new Teams(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
-const promise = teams.updateMembershipRoles('[TEAM_ID]', '[MEMBERSHIP_ID]', []);
+const promise = teams.updateMembership('[TEAM_ID]', '[MEMBERSHIP_ID]', []);
promise.then(function (response) {
console.log(response); // Success
diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md
index 33ae6dd..4bee8de 100644
--- a/docs/examples/teams/update-name.md
+++ b/docs/examples/teams/update-name.md
@@ -5,7 +5,7 @@ const client = new Client();
const teams = new Teams(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md
index 9fc800b..7d7ed63 100644
--- a/docs/examples/teams/update-prefs.md
+++ b/docs/examples/teams/update-prefs.md
@@ -5,7 +5,7 @@ const client = new Client();
const teams = new Teams(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/create-argon2user.md b/docs/examples/users/create-argon2user.md
index 805d120..f4dabaf 100644
--- a/docs/examples/users/create-argon2user.md
+++ b/docs/examples/users/create-argon2user.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md
index 4e02c46..247f579 100644
--- a/docs/examples/users/create-bcrypt-user.md
+++ b/docs/examples/users/create-bcrypt-user.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/create-m-d5user.md b/docs/examples/users/create-m-d5user.md
index e1001fa..8a81f08 100644
--- a/docs/examples/users/create-m-d5user.md
+++ b/docs/examples/users/create-m-d5user.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/create-p-h-pass-user.md b/docs/examples/users/create-p-h-pass-user.md
index aca4526..f7297c1 100644
--- a/docs/examples/users/create-p-h-pass-user.md
+++ b/docs/examples/users/create-p-h-pass-user.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/create-s-h-a-user.md b/docs/examples/users/create-s-h-a-user.md
index 4678a18..3cefaf1 100644
--- a/docs/examples/users/create-s-h-a-user.md
+++ b/docs/examples/users/create-s-h-a-user.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/create-scrypt-modified-user.md b/docs/examples/users/create-scrypt-modified-user.md
index fa93a14..d8889fa 100644
--- a/docs/examples/users/create-scrypt-modified-user.md
+++ b/docs/examples/users/create-scrypt-modified-user.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md
index 2706708..3c4b357 100644
--- a/docs/examples/users/create-scrypt-user.md
+++ b/docs/examples/users/create-scrypt-user.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md
index 11e21f5..845895d 100644
--- a/docs/examples/users/create.md
+++ b/docs/examples/users/create.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md
new file mode 100644
index 0000000..d2aa30d
--- /dev/null
+++ b/docs/examples/users/delete-identity.md
@@ -0,0 +1,18 @@
+import { Client, Users } from "@appwrite.io/console";
+
+const client = new Client();
+
+const users = new Users(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = users.deleteIdentity('[IDENTITY_ID]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/users/delete-session.md b/docs/examples/users/delete-session.md
index 38ba0c5..70404ca 100644
--- a/docs/examples/users/delete-session.md
+++ b/docs/examples/users/delete-session.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md
index 22666d7..b02771c 100644
--- a/docs/examples/users/delete-sessions.md
+++ b/docs/examples/users/delete-sessions.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md
index e86ed00..0bb95c3 100644
--- a/docs/examples/users/delete.md
+++ b/docs/examples/users/delete.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md
index a0c71f3..593552b 100644
--- a/docs/examples/users/get-prefs.md
+++ b/docs/examples/users/get-prefs.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/get-usage.md b/docs/examples/users/get-usage.md
index 918c4a7..59d95e6 100644
--- a/docs/examples/users/get-usage.md
+++ b/docs/examples/users/get-usage.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md
index e9a3a5a..46cee75 100644
--- a/docs/examples/users/get.md
+++ b/docs/examples/users/get.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md
new file mode 100644
index 0000000..214fa97
--- /dev/null
+++ b/docs/examples/users/list-identities.md
@@ -0,0 +1,18 @@
+import { Client, Users } from "@appwrite.io/console";
+
+const client = new Client();
+
+const users = new Users(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = users.listIdentities();
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md
index 7834730..ded1e98 100644
--- a/docs/examples/users/list-logs.md
+++ b/docs/examples/users/list-logs.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md
index 42707c7..b47f7ac 100644
--- a/docs/examples/users/list-memberships.md
+++ b/docs/examples/users/list-memberships.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md
index 88dfbbb..087834e 100644
--- a/docs/examples/users/list-sessions.md
+++ b/docs/examples/users/list-sessions.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md
index e6dca04..28a8258 100644
--- a/docs/examples/users/list.md
+++ b/docs/examples/users/list.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md
index abfc30e..019b072 100644
--- a/docs/examples/users/update-email-verification.md
+++ b/docs/examples/users/update-email-verification.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md
index 68297b6..e37d03a 100644
--- a/docs/examples/users/update-email.md
+++ b/docs/examples/users/update-email.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md
new file mode 100644
index 0000000..9d61425
--- /dev/null
+++ b/docs/examples/users/update-labels.md
@@ -0,0 +1,18 @@
+import { Client, Users } from "@appwrite.io/console";
+
+const client = new Client();
+
+const users = new Users(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = users.updateLabels('[USER_ID]', []);
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md
index 229b5e6..2834c74 100644
--- a/docs/examples/users/update-name.md
+++ b/docs/examples/users/update-name.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md
index 120cbda..5192abd 100644
--- a/docs/examples/users/update-password.md
+++ b/docs/examples/users/update-password.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md
index fef6ad5..17ddf46 100644
--- a/docs/examples/users/update-phone-verification.md
+++ b/docs/examples/users/update-phone-verification.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md
index bae1771..a1d85aa 100644
--- a/docs/examples/users/update-phone.md
+++ b/docs/examples/users/update-phone.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md
index 3bd0474..e3c5b76 100644
--- a/docs/examples/users/update-prefs.md
+++ b/docs/examples/users/update-prefs.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md
index 16b201e..eafbec7 100644
--- a/docs/examples/users/update-status.md
+++ b/docs/examples/users/update-status.md
@@ -5,7 +5,7 @@ const client = new Client();
const users = new Users(client);
client
- .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/docs/examples/vcs/create-repository-detection.md b/docs/examples/vcs/create-repository-detection.md
new file mode 100644
index 0000000..dc4591e
--- /dev/null
+++ b/docs/examples/vcs/create-repository-detection.md
@@ -0,0 +1,18 @@
+import { Client, Vcs } from "@appwrite.io/console";
+
+const client = new Client();
+
+const vcs = new Vcs(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = vcs.createRepositoryDetection('[INSTALLATION_ID]', '[PROVIDER_REPOSITORY_ID]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/vcs/create-repository.md b/docs/examples/vcs/create-repository.md
new file mode 100644
index 0000000..84f919b
--- /dev/null
+++ b/docs/examples/vcs/create-repository.md
@@ -0,0 +1,18 @@
+import { Client, Vcs } from "@appwrite.io/console";
+
+const client = new Client();
+
+const vcs = new Vcs(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = vcs.createRepository('[INSTALLATION_ID]', '[NAME]', false);
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/vcs/delete-installation.md b/docs/examples/vcs/delete-installation.md
new file mode 100644
index 0000000..b56f76b
--- /dev/null
+++ b/docs/examples/vcs/delete-installation.md
@@ -0,0 +1,18 @@
+import { Client, Vcs } from "@appwrite.io/console";
+
+const client = new Client();
+
+const vcs = new Vcs(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = vcs.deleteInstallation('[INSTALLATION_ID]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/vcs/get-installation.md b/docs/examples/vcs/get-installation.md
new file mode 100644
index 0000000..6dc92e9
--- /dev/null
+++ b/docs/examples/vcs/get-installation.md
@@ -0,0 +1,18 @@
+import { Client, Vcs } from "@appwrite.io/console";
+
+const client = new Client();
+
+const vcs = new Vcs(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = vcs.getInstallation('[INSTALLATION_ID]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/vcs/get-repository.md b/docs/examples/vcs/get-repository.md
new file mode 100644
index 0000000..b2c867d
--- /dev/null
+++ b/docs/examples/vcs/get-repository.md
@@ -0,0 +1,18 @@
+import { Client, Vcs } from "@appwrite.io/console";
+
+const client = new Client();
+
+const vcs = new Vcs(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = vcs.getRepository('[INSTALLATION_ID]', '[PROVIDER_REPOSITORY_ID]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/vcs/list-installations.md b/docs/examples/vcs/list-installations.md
new file mode 100644
index 0000000..f18d999
--- /dev/null
+++ b/docs/examples/vcs/list-installations.md
@@ -0,0 +1,18 @@
+import { Client, Vcs } from "@appwrite.io/console";
+
+const client = new Client();
+
+const vcs = new Vcs(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = vcs.listInstallations();
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/vcs/list-repositories.md b/docs/examples/vcs/list-repositories.md
new file mode 100644
index 0000000..85eea5d
--- /dev/null
+++ b/docs/examples/vcs/list-repositories.md
@@ -0,0 +1,18 @@
+import { Client, Vcs } from "@appwrite.io/console";
+
+const client = new Client();
+
+const vcs = new Vcs(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = vcs.listRepositories('[INSTALLATION_ID]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/vcs/list-repository-branches.md b/docs/examples/vcs/list-repository-branches.md
new file mode 100644
index 0000000..1ebc3a5
--- /dev/null
+++ b/docs/examples/vcs/list-repository-branches.md
@@ -0,0 +1,18 @@
+import { Client, Vcs } from "@appwrite.io/console";
+
+const client = new Client();
+
+const vcs = new Vcs(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = vcs.listRepositoryBranches('[INSTALLATION_ID]', '[PROVIDER_REPOSITORY_ID]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/docs/examples/vcs/update-external-deployments.md b/docs/examples/vcs/update-external-deployments.md
new file mode 100644
index 0000000..a95a2c1
--- /dev/null
+++ b/docs/examples/vcs/update-external-deployments.md
@@ -0,0 +1,18 @@
+import { Client, Vcs } from "@appwrite.io/console";
+
+const client = new Client();
+
+const vcs = new Vcs(client);
+
+client
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+const promise = vcs.updateExternalDeployments('[INSTALLATION_ID]', '[REPOSITORY_ID]', '[PROVIDER_PULL_REQUEST_ID]');
+
+promise.then(function (response) {
+ console.log(response); // Success
+}, function (error) {
+ console.log(error); // Failure
+});
\ No newline at end of file
diff --git a/package.json b/package.json
index d04df54..f05fbef 100644
--- a/package.json
+++ b/package.json
@@ -2,13 +2,14 @@
"name": "@appwrite.io/console",
"homepage": "https://appwrite.io/support",
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
- "version": "0.2.0",
+ "version": "0.3.0",
"license": "BSD-3-Clause",
"main": "dist/cjs/sdk.js",
"exports": {
".": {
"import": "./dist/esm/sdk.js",
- "require": "./dist/cjs/sdk.js"
+ "require": "./dist/cjs/sdk.js",
+ "types": "./types/index.d.ts"
},
"./package.json": "./package.json"
},
diff --git a/src/client.ts b/src/client.ts
index 2fcda69..bf729f6 100644
--- a/src/client.ts
+++ b/src/client.ts
@@ -104,8 +104,8 @@ class Client {
'x-sdk-name': 'Console',
'x-sdk-platform': 'console',
'x-sdk-language': 'web',
- 'x-sdk-version': '0.2.0',
- 'X-Appwrite-Response-Format': '1.0.0',
+ 'x-sdk-version': '0.3.0',
+ 'X-Appwrite-Response-Format': '1.4.0',
};
/**
diff --git a/src/index.ts b/src/index.ts
index 569f7b6..9ce653c 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,17 +1,21 @@
export { Client, Query, AppwriteException } from './client';
export { Account } from './services/account';
export { Avatars } from './services/avatars';
+export { Assistant } from './services/assistant';
export { Console } from './services/console';
export { Databases } from './services/databases';
export { Functions } from './services/functions';
export { Graphql } from './services/graphql';
export { Health } from './services/health';
export { Locale } from './services/locale';
+export { Migrations } from './services/migrations';
export { Project } from './services/project';
export { Projects } from './services/projects';
+export { Proxy } from './services/proxy';
export { Storage } from './services/storage';
export { Teams } from './services/teams';
export { Users } from './services/users';
+export { Vcs } from './services/vcs';
export type { Models, Payload, RealtimeResponseEvent, UploadProgress } from './client';
export type { QueryTypes, QueryTypesList } from './query';
export { Permission } from './permission';
diff --git a/src/models.ts b/src/models.ts
index d1a286b..37dc37d 100644
--- a/src/models.ts
+++ b/src/models.ts
@@ -77,6 +77,19 @@ export namespace Models {
*/
sessions: Session[];
}
+ /**
+ * Identities List
+ */
+ export type IdentityList = {
+ /**
+ * Total number of identities documents that matched your query.
+ */
+ total: number;
+ /**
+ * List of identities.
+ */
+ identities: Identity[];
+ }
/**
* Logs List
*/
@@ -155,6 +168,45 @@ export namespace Models {
*/
functions: Function[];
}
+ /**
+ * Installations List
+ */
+ export type InstallationList = {
+ /**
+ * Total number of installations documents that matched your query.
+ */
+ total: number;
+ /**
+ * List of installations.
+ */
+ installations: Installation[];
+ }
+ /**
+ * Provider Repositories List
+ */
+ export type ProviderRepositoryList = {
+ /**
+ * Total number of providerRepositories documents that matched your query.
+ */
+ total: number;
+ /**
+ * List of providerRepositories.
+ */
+ providerRepositories: ProviderRepository[];
+ }
+ /**
+ * Branches List
+ */
+ export type BranchList = {
+ /**
+ * Total number of branches documents that matched your query.
+ */
+ total: number;
+ /**
+ * List of branches.
+ */
+ branches: Branch[];
+ }
/**
* Runtimes List
*/
@@ -246,19 +298,6 @@ export namespace Models {
*/
platforms: Platform[];
}
- /**
- * Domains List
- */
- export type DomainList = {
- /**
- * Total number of domains documents that matched your query.
- */
- total: number;
- /**
- * List of domains.
- */
- domains: Domain[];
- }
/**
* Countries List
*/
@@ -337,6 +376,58 @@ export namespace Models {
*/
variables: Variable[];
}
+ /**
+ * Rule List
+ */
+ export type ProxyRuleList = {
+ /**
+ * Total number of rules documents that matched your query.
+ */
+ total: number;
+ /**
+ * List of rules.
+ */
+ rules: ProxyRule[];
+ }
+ /**
+ * Locale codes list
+ */
+ export type LocaleCodeList = {
+ /**
+ * Total number of localeCodes documents that matched your query.
+ */
+ total: number;
+ /**
+ * List of localeCodes.
+ */
+ localeCodes: LocaleCode[];
+ }
+ /**
+ * Migrations List
+ */
+ export type MigrationList = {
+ /**
+ * Total number of migrations documents that matched your query.
+ */
+ total: number;
+ /**
+ * List of migrations.
+ */
+ migrations: Migration[];
+ }
+ /**
+ * Migrations Firebase Projects List
+ */
+ export type FirebaseProjectList = {
+ /**
+ * Total number of projects documents that matched your query.
+ */
+ total: number;
+ /**
+ * List of projects.
+ */
+ projects: FirebaseProject[];
+ }
/**
* Database
*/
@@ -357,6 +448,10 @@ export namespace Models {
* Database update date in ISO 8601 format.
*/
$updatedAt: string;
+ /**
+ * If database is enabled. Can be 'enabled' or 'disabled'. When disabled, the database is inaccessible to users, but remains accessible to Server SDKs using API keys.
+ */
+ enabled: boolean;
}
/**
* Collection
@@ -375,7 +470,7 @@ export namespace Models {
*/
$updatedAt: string;
/**
- * Collection permissions. [Learn more about permissions](/docs/permissions).
+ * Collection permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
*/
$permissions: string[];
/**
@@ -387,11 +482,11 @@ export namespace Models {
*/
name: string;
/**
- * Collection enabled.
+ * Collection enabled. Can be 'enabled' or 'disabled'. When disabled, the collection is inaccessible to users, but remains accessible to Server SDKs using API keys.
*/
enabled: boolean;
/**
- * Whether document-level permissions are enabled. [Learn more about permissions](/docs/permissions).
+ * Whether document-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions).
*/
documentSecurity: boolean;
/**
@@ -432,6 +527,10 @@ export namespace Models {
* Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`
*/
status: string;
+ /**
+ * Error message. Displays error generated on failure of creating or deleting an attribute.
+ */
+ error: string;
/**
* Is attribute required?
*/
@@ -465,6 +564,10 @@ export namespace Models {
* Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`
*/
status: string;
+ /**
+ * Error message. Displays error generated on failure of creating or deleting an attribute.
+ */
+ error: string;
/**
* Is attribute required?
*/
@@ -502,6 +605,10 @@ export namespace Models {
* Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`
*/
status: string;
+ /**
+ * Error message. Displays error generated on failure of creating or deleting an attribute.
+ */
+ error: string;
/**
* Is attribute required?
*/
@@ -539,6 +646,10 @@ export namespace Models {
* Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`
*/
status: string;
+ /**
+ * Error message. Displays error generated on failure of creating or deleting an attribute.
+ */
+ error: string;
/**
* Is attribute required?
*/
@@ -568,6 +679,10 @@ export namespace Models {
* Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`
*/
status: string;
+ /**
+ * Error message. Displays error generated on failure of creating or deleting an attribute.
+ */
+ error: string;
/**
* Is attribute required?
*/
@@ -601,6 +716,10 @@ export namespace Models {
* Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`
*/
status: string;
+ /**
+ * Error message. Displays error generated on failure of creating or deleting an attribute.
+ */
+ error: string;
/**
* Is attribute required?
*/
@@ -638,6 +757,10 @@ export namespace Models {
* Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`
*/
status: string;
+ /**
+ * Error message. Displays error generated on failure of creating or deleting an attribute.
+ */
+ error: string;
/**
* Is attribute required?
*/
@@ -671,6 +794,10 @@ export namespace Models {
* Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`
*/
status: string;
+ /**
+ * Error message. Displays error generated on failure of creating or deleting an attribute.
+ */
+ error: string;
/**
* Is attribute required?
*/
@@ -704,6 +831,10 @@ export namespace Models {
* Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`
*/
status: string;
+ /**
+ * Error message. Displays error generated on failure of creating or deleting an attribute.
+ */
+ error: string;
/**
* Is attribute required?
*/
@@ -737,6 +868,10 @@ export namespace Models {
* Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`
*/
status: string;
+ /**
+ * Error message. Displays error generated on failure of creating or deleting an attribute.
+ */
+ error: string;
/**
* Is attribute required?
*/
@@ -786,6 +921,10 @@ export namespace Models {
* Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`
*/
status: string;
+ /**
+ * Error message. Displays error generated on failure of creating or deleting an index.
+ */
+ error: string;
/**
* Index attributes.
*/
@@ -820,7 +959,7 @@ export namespace Models {
*/
$updatedAt: string;
/**
- * Document permissions. [Learn more about permissions](/docs/permissions).
+ * Document permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
*/
$permissions: string[];
[key: string]: any;
@@ -954,6 +1093,10 @@ export namespace Models {
* User status. Pass `true` for enabled and `false` for disabled.
*/
status: boolean;
+ /**
+ * Labels for the user.
+ */
+ labels: string[];
/**
* Password update time in ISO 8601 format.
*/
@@ -978,6 +1121,10 @@ export namespace Models {
* User preferences as a key-value object
*/
prefs: Preferences;
+ /**
+ * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours.
+ */
+ accessedAt: string;
}
/**
* AlgoMD5
@@ -1082,59 +1229,6 @@ export namespace Models {
*/
threads: number;
}
- /**
- * Account
- */
- export type Account = {
- /**
- * User ID.
- */
- $id: string;
- /**
- * User creation date in ISO 8601 format.
- */
- $createdAt: string;
- /**
- * User update date in ISO 8601 format.
- */
- $updatedAt: string;
- /**
- * User name.
- */
- name: string;
- /**
- * User registration date in ISO 8601 format.
- */
- registration: string;
- /**
- * User status. Pass `true` for enabled and `false` for disabled.
- */
- status: boolean;
- /**
- * Password update time in ISO 8601 format.
- */
- passwordUpdate: string;
- /**
- * User email address.
- */
- email: string;
- /**
- * User phone number in E.164 format.
- */
- phone: string;
- /**
- * Email verification status.
- */
- emailVerification: boolean;
- /**
- * Phone verification status.
- */
- phoneVerification: boolean;
- /**
- * User preferences as a key-value object
- */
- prefs: Preferences;
- }
/**
* Preferences
*/
@@ -1246,6 +1340,51 @@ export namespace Models {
*/
current: boolean;
}
+ /**
+ * Identity
+ */
+ export type Identity = {
+ /**
+ * Identity ID.
+ */
+ $id: string;
+ /**
+ * Identity creation date in ISO 8601 format.
+ */
+ $createdAt: string;
+ /**
+ * Identity update date in ISO 8601 format.
+ */
+ $updatedAt: string;
+ /**
+ * User ID.
+ */
+ userId: string;
+ /**
+ * Identity Provider.
+ */
+ provider: string;
+ /**
+ * ID of the User in the Identity Provider.
+ */
+ providerUid: string;
+ /**
+ * Email of the User in the Identity Provider.
+ */
+ providerEmail: string;
+ /**
+ * Identity Provider Access Token.
+ */
+ providerAccessToken: string;
+ /**
+ * The date of when the access token expires in ISO 8601 format.
+ */
+ providerAccessTokenExpiry: string;
+ /**
+ * Identity Provider Refresh Token.
+ */
+ providerRefreshToken: string;
+ }
/**
* Token
*/
@@ -1313,6 +1452,19 @@ export namespace Models {
*/
currency: string;
}
+ /**
+ * LocaleCode
+ */
+ export type LocaleCode = {
+ /**
+ * Locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
+ */
+ code: string;
+ /**
+ * Locale name
+ */
+ name: string;
+ }
/**
* File
*/
@@ -1334,7 +1486,7 @@ export namespace Models {
*/
$updatedAt: string;
/**
- * File permissions. [Learn more about permissions](/docs/permissions).
+ * File permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
*/
$permissions: string[];
/**
@@ -1379,11 +1531,11 @@ export namespace Models {
*/
$updatedAt: string;
/**
- * Bucket permissions. [Learn more about permissions](/docs/permissions).
+ * Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
*/
$permissions: string[];
/**
- * Whether file-level security is enabled. [Learn more about permissions](/docs/permissions).
+ * Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions).
*/
fileSecurity: boolean;
/**
@@ -1525,6 +1677,14 @@ export namespace Models {
* Function enabled.
*/
enabled: boolean;
+ /**
+ * Is the function deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the function to update it with the latest configuration.
+ */
+ live: boolean;
+ /**
+ * Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.
+ */
+ logging: boolean;
/**
* Function execution runtime.
*/
@@ -1549,103 +1709,255 @@ export namespace Models {
* Function execution timeout in seconds.
*/
timeout: number;
- }
- /**
- * Runtime
- */
- export type Runtime = {
/**
- * Runtime ID.
+ * The entrypoint file used to execute the deployment.
*/
- $id: string;
+ entrypoint: string;
/**
- * Runtime Name.
+ * The build command used to build the deployment.
*/
- name: string;
+ commands: string;
/**
- * Runtime version.
+ * Version of Open Runtimes used for the function.
*/
version: string;
/**
- * Base Docker image used to build the runtime.
+ * Function VCS (Version Control System) installation id.
*/
- base: string;
+ installationId: string;
/**
- * Image name of Docker Hub.
+ * VCS (Version Control System) Repository ID
*/
- image: string;
+ providerRepositoryId: string;
/**
- * Name of the logo image.
+ * VCS (Version Control System) branch name
*/
- logo: string;
+ providerBranch: string;
/**
- * List of supported architectures.
+ * Path to function in VCS (Version Control System) repository
*/
- supports: string[];
+ providerRootDirectory: string;
+ /**
+ * Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests
+ */
+ providerSilentMode: boolean;
}
/**
- * Deployment
+ * Installation
*/
- export type Deployment = {
+ export type Installation = {
/**
- * Deployment ID.
+ * Function ID.
*/
$id: string;
/**
- * Deployment creation date in ISO 8601 format.
+ * Function creation date in ISO 8601 format.
*/
$createdAt: string;
/**
- * Deployment update date in ISO 8601 format.
+ * Function update date in ISO 8601 format.
*/
$updatedAt: string;
/**
- * Resource ID.
+ * VCS (Version Control System) provider name.
*/
- resourceId: string;
+ provider: string;
/**
- * Resource type.
+ * VCS (Version Control System) organization name.
*/
- resourceType: string;
+ organization: string;
/**
- * The entrypoint file to use to execute the deployment code.
+ * VCS (Version Control System) installation ID.
*/
- entrypoint: string;
+ providerInstallationId: string;
+ }
+ /**
+ * ProviderRepository
+ */
+ export type ProviderRepository = {
/**
- * The code size in bytes.
+ * VCS (Version Control System) repository ID.
*/
- size: number;
+ id: string;
/**
- * The current build ID.
+ * VCS (Version Control System) repository name.
*/
- buildId: string;
+ name: string;
/**
- * Whether the deployment should be automatically activated.
+ * VCS (Version Control System) organization name
*/
- activate: boolean;
+ organization: string;
/**
- * The deployment status. Possible values are "processing", "building", "pending", "ready", and "failed".
+ * VCS (Version Control System) provider name.
*/
- status: string;
+ provider: string;
/**
- * The build stdout.
+ * Is VCS (Version Control System) repository private?
*/
- buildStdout: string;
+ private: boolean;
/**
- * The build stderr.
+ * Auto-detected runtime suggestion. Empty if getting response of getRuntime().
*/
- buildStderr: string;
+ runtime: string;
/**
- * The current build time in seconds.
+ * Last commit date in ISO 8601 format.
*/
- buildTime: number;
+ pushedAt: string;
}
/**
- * Execution
+ * Detection
*/
- export type Execution = {
+ export type Detection = {
/**
- * Execution ID.
+ * Runtime
+ */
+ runtime: string;
+ }
+ /**
+ * Branch
+ */
+ export type Branch = {
+ /**
+ * Branch Name.
+ */
+ name: string;
+ }
+ /**
+ * Runtime
+ */
+ export type Runtime = {
+ /**
+ * Runtime ID.
+ */
+ $id: string;
+ /**
+ * Runtime Name.
+ */
+ name: string;
+ /**
+ * Runtime version.
+ */
+ version: string;
+ /**
+ * Base Docker image used to build the runtime.
+ */
+ base: string;
+ /**
+ * Image name of Docker Hub.
+ */
+ image: string;
+ /**
+ * Name of the logo image.
+ */
+ logo: string;
+ /**
+ * List of supported architectures.
+ */
+ supports: string[];
+ }
+ /**
+ * Deployment
+ */
+ export type Deployment = {
+ /**
+ * Deployment ID.
+ */
+ $id: string;
+ /**
+ * Deployment creation date in ISO 8601 format.
+ */
+ $createdAt: string;
+ /**
+ * Deployment update date in ISO 8601 format.
+ */
+ $updatedAt: string;
+ /**
+ * Type of deployment.
+ */
+ type: string;
+ /**
+ * Resource ID.
+ */
+ resourceId: string;
+ /**
+ * Resource type.
+ */
+ resourceType: string;
+ /**
+ * The entrypoint file to use to execute the deployment code.
+ */
+ entrypoint: string;
+ /**
+ * The code size in bytes.
+ */
+ size: number;
+ /**
+ * The current build ID.
+ */
+ buildId: string;
+ /**
+ * Whether the deployment should be automatically activated.
+ */
+ activate: boolean;
+ /**
+ * The deployment status. Possible values are "processing", "building", "waiting", "ready", and "failed".
+ */
+ status: string;
+ /**
+ * The build logs.
+ */
+ buildLogs: string;
+ /**
+ * The current build time in seconds.
+ */
+ buildTime: number;
+ /**
+ * The name of the vcs provider repository
+ */
+ providerRepositoryName: string;
+ /**
+ * The name of the vcs provider repository owner
+ */
+ providerRepositoryOwner: string;
+ /**
+ * The url of the vcs provider repository
+ */
+ providerRepositoryUrl: string;
+ /**
+ * The branch of the vcs repository
+ */
+ providerBranch: string;
+ /**
+ * The commit hash of the vcs commit
+ */
+ providerCommitHash: string;
+ /**
+ * The url of vcs commit author
+ */
+ providerCommitAuthorUrl: string;
+ /**
+ * The name of vcs commit author
+ */
+ providerCommitAuthor: string;
+ /**
+ * The commit message
+ */
+ providerCommitMessage: string;
+ /**
+ * The url of the vcs commit
+ */
+ providerCommitUrl: string;
+ /**
+ * The branch of the vcs repository
+ */
+ providerBranchUrl: string;
+ }
+ /**
+ * Execution
+ */
+ export type Execution = {
+ /**
+ * Execution ID.
*/
$id: string;
/**
@@ -1673,23 +1985,39 @@ export namespace Models {
*/
status: string;
/**
- * The script status code.
+ * HTTP request method type.
+ */
+ requestMethod: string;
+ /**
+ * HTTP request path and query.
+ */
+ requestPath: string;
+ /**
+ * HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous.
*/
- statusCode: number;
+ requestHeaders: Headers[];
/**
- * The script response output string. Logs the last 4,000 characters of the execution response output.
+ * HTTP response status code.
*/
- response: string;
+ responseStatusCode: number;
/**
- * The script stdout output string. Logs the last 4,000 characters of the execution stdout output. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.
+ * HTTP response body. This will return empty unless execution is created as synchronous.
*/
- stdout: string;
+ responseBody: string;
/**
- * The script stderr output string. Logs the last 4,000 characters of the execution stderr output. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.
+ * HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous.
*/
- stderr: string;
+ responseHeaders: Headers[];
/**
- * The script execution duration in seconds.
+ * Function logs. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.
+ */
+ logs: string;
+ /**
+ * Function errors. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.
+ */
+ errors: string;
+ /**
+ * Function execution duration in seconds.
*/
duration: number;
}
@@ -1773,6 +2101,10 @@ export namespace Models {
* Whether or not to check user's password against most commonly used passwords.
*/
authPasswordDictionary: boolean;
+ /**
+ * Whether or not to check the user password for similarity with their personal data.
+ */
+ authPersonalDataCheck: boolean;
/**
* List of Providers.
*/
@@ -1790,9 +2122,41 @@ export namespace Models {
*/
keys: Key[];
/**
- * List of Domains.
+ * Status for custom SMTP
+ */
+ smtpEnabled: boolean;
+ /**
+ * SMTP sender name
*/
- domains: Domain[];
+ smtpSenderName: string;
+ /**
+ * SMTP sender email
+ */
+ smtpSenderEmail: string;
+ /**
+ * SMTP reply to email
+ */
+ smtpReplyTo: string;
+ /**
+ * SMTP server host name
+ */
+ smtpHost: string;
+ /**
+ * SMTP server port
+ */
+ smtpPort: number;
+ /**
+ * SMTP server username
+ */
+ smtpUsername: string;
+ /**
+ * SMTP server password
+ */
+ smtpPassword: string;
+ /**
+ * SMTP server secure protocol
+ */
+ smtpSecure: string;
/**
* Email/Password auth method status
*/
@@ -1936,7 +2300,7 @@ export namespace Models {
*/
secret: string;
/**
- * Most recent access date in ISO 8601 format.
+ * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours.
*/
accessedAt: string;
/**
@@ -1944,47 +2308,14 @@ export namespace Models {
*/
sdks: string[];
}
- /**
- * Domain
- */
- export type Domain = {
- /**
- * Domain ID.
- */
- $id: string;
- /**
- * Domain creation date in ISO 8601 format.
- */
- $createdAt: string;
- /**
- * Domain update date in ISO 8601 format.
- */
- $updatedAt: string;
- /**
- * Domain name.
- */
- domain: string;
- /**
- * Registerable domain name.
- */
- registerable: string;
- /**
- * TLD name.
- */
- tld: string;
- /**
- * Verification process status.
- */
- verification: boolean;
- /**
- * Certificate ID.
- */
- certificateId: string;
- }
/**
* Provider
*/
export type Provider = {
+ /**
+ * Provider.
+ */
+ key: string;
/**
* Provider name.
*/
@@ -2072,9 +2403,13 @@ export namespace Models {
*/
value: string;
/**
- * Function ID.
+ * Service to which the variable belongs. Possible values are "project", "function"
*/
- functionId: string;
+ resourceType: string;
+ /**
+ * ID of resource to which the variable belongs. If resourceType is "project", it is empty. If resourceType is "function", it is ID of the function.
+ */
+ resourceId: string;
}
/**
* Country
@@ -2243,145 +2578,229 @@ export namespace Models {
*/
export type UsageDatabases = {
/**
- * The time range of the usage stats.
+ * Time range of the usage stats.
*/
range: string;
/**
- * Aggregated stats for total number of documents.
+ * Total aggregated number of databases.
*/
- databasesTotal: Metric[];
+ databasesTotal: number;
/**
- * Aggregated stats for total number of collections.
+ * Total aggregated number of collections.
*/
- collectionsTotal: Metric[];
+ collectionsTotal: number;
/**
- * Aggregated stats for total number of documents.
+ * Total aggregated number of documents.
*/
- documentsTotal: Metric[];
+ documentsTotal: number;
+ /**
+ * Aggregated number of databases per period.
+ */
+ databases: Metric[];
+ /**
+ * Aggregated number of collections per period.
+ */
+ collections: Metric[];
+ /**
+ * Aggregated number of documents per period.
+ */
+ documents: Metric[];
}
/**
* UsageDatabase
*/
export type UsageDatabase = {
/**
- * The time range of the usage stats.
+ * Time range of the usage stats.
*/
range: string;
/**
- * Aggregated stats for total number of collections.
+ * Total aggregated number of collections.
+ */
+ collectionsTotal: number;
+ /**
+ * Total aggregated number of documents.
*/
- collectionsTotal: Metric[];
+ documentsTotal: number;
/**
- * Aggregated stats for total number of documents.
+ * Aggregated number of collections per period.
*/
- documentsTotal: Metric[];
+ collections: Metric[];
+ /**
+ * Aggregated number of documents per period.
+ */
+ documents: Metric[];
}
/**
* UsageCollection
*/
export type UsageCollection = {
/**
- * The time range of the usage stats.
+ * Time range of the usage stats.
*/
range: string;
/**
- * Aggregated stats for total number of documents.
+ * Total aggregated number of of documents.
+ */
+ documentsTotal: number;
+ /**
+ * Aggregated number of documents per period.
*/
- documentsTotal: Metric[];
+ documents: Metric[];
}
/**
* UsageUsers
*/
export type UsageUsers = {
/**
- * The time range of the usage stats.
+ * Time range of the usage stats.
*/
range: string;
/**
- * Aggregated stats for total number of users.
+ * Total aggregated number of statistics of users.
+ */
+ usersTotal: number;
+ /**
+ * Total aggregated number of active sessions.
*/
- usersTotal: Metric[];
+ sessionsTotal: number;
/**
- * Aggregated stats for sessions created.
+ * Aggregated number of users per period.
*/
- sessionsTotal: Metric[];
+ users: Metric[];
+ /**
+ * Aggregated number of active sessions per period.
+ */
+ sessions: Metric[];
}
/**
* StorageUsage
*/
export type UsageStorage = {
/**
- * The time range of the usage stats.
+ * Time range of the usage stats.
*/
range: string;
/**
- * Aggregated stats for total number of buckets.
+ * Total aggregated number of buckets
+ */
+ bucketsTotal: number;
+ /**
+ * Total aggregated number of files.
+ */
+ filesTotal: number;
+ /**
+ * Total aggregated number of files storage (in bytes).
+ */
+ filesStorageTotal: number;
+ /**
+ * Aggregated number of buckets per period.
*/
- bucketsTotal: Metric[];
+ buckets: Metric[];
/**
- * Aggregated stats for total number of files.
+ * Aggregated number of files per period.
*/
- filesTotal: Metric[];
+ files: Metric[];
/**
- * Aggregated stats for the occupied storage size (in bytes).
+ * Aggregated number of files storage (in bytes) per period .
*/
- filesStorage: Metric[];
+ storage: Metric[];
}
/**
* UsageBuckets
*/
export type UsageBuckets = {
/**
- * The time range of the usage stats.
+ * Time range of the usage stats.
*/
range: string;
/**
- * Aggregated stats for total number of files in this bucket.
+ * Total aggregated number of bucket files.
*/
- filesTotal: Metric[];
+ filesTotal: number;
/**
- * Aggregated stats for total storage of files in this bucket.
+ * Total aggregated number of bucket files storage (in bytes).
*/
- filesStorage: Metric[];
+ filesStorageTotal: number;
+ /**
+ * Aggregated number of bucket files per period.
+ */
+ files: Metric[];
+ /**
+ * Aggregated number of bucket storage files (in bytes) per period.
+ */
+ storage: Metric[];
}
/**
* UsageFunctions
*/
export type UsageFunctions = {
/**
- * The time range of the usage stats.
+ * Time range of the usage stats.
*/
range: string;
/**
- * Aggregated stats for number of functions.
+ * Total aggregated number of functions.
+ */
+ functionsTotal: number;
+ /**
+ * Total aggregated number of functions deployments.
+ */
+ deploymentsTotal: number;
+ /**
+ * Total aggregated sum of functions deployment storage.
+ */
+ deploymentsStorageTotal: number;
+ /**
+ * Total aggregated number of functions build.
+ */
+ buildsTotal: number;
+ /**
+ * total aggregated sum of functions build storage.
+ */
+ buildsStorageTotal: number;
+ /**
+ * Total aggregated sum of functions build compute time.
+ */
+ buildsTimeTotal: number;
+ /**
+ * Total aggregated number of functions execution.
+ */
+ executionsTotal: number;
+ /**
+ * Total aggregated sum of functions execution compute time.
+ */
+ executionsTimeTotal: number;
+ /**
+ * Aggregated number of functions per period.
*/
- functionsTotal: Metric[];
+ functions: Metric[];
/**
- * Aggregated stats for number of function deployments.
+ * Aggregated number of functions deployment per period.
*/
- deploymentsTotal: Metric[];
+ deployments: Metric[];
/**
- * Aggregated stats for function deployments storage.
+ * Aggregated number of functions deployment storage per period.
*/
deploymentsStorage: Metric[];
/**
- * Aggregated stats for number of function builds.
+ * Aggregated number of functions build per period.
*/
- buildsTotal: Metric[];
+ builds: Metric[];
/**
- * Aggregated stats for builds storage.
+ * Aggregated sum of functions build storage per period.
*/
buildsStorage: Metric[];
/**
- * Aggregated stats for function build compute.
+ * Aggregated sum of functions build compute time per period.
*/
buildsTime: Metric[];
/**
- * Aggregated stats for number of function executions.
+ * Aggregated number of functions execution per period.
*/
- executionsTotal: Metric[];
+ executions: Metric[];
/**
- * Aggregated stats for function execution compute.
+ * Aggregated number of functions execution compute time per period.
*/
executionsTime: Metric[];
}
@@ -2390,41 +2809,141 @@ export namespace Models {
*/
export type UsageProject = {
/**
- * The time range of the usage stats.
+ * Total aggregated number of function executions.
*/
- range: string;
+ executionsTotal: number;
+ /**
+ * Total aggregated number of documents.
+ */
+ documentsTotal: number;
+ /**
+ * Total aggregated number of databases.
+ */
+ databasesTotal: number;
+ /**
+ * Total aggregated number of users.
+ */
+ usersTotal: number;
+ /**
+ * Total aggregated sum of files storage size (in bytes).
+ */
+ filesStorageTotal: number;
+ /**
+ * Total aggregated number of buckets.
+ */
+ bucketsTotal: number;
+ /**
+ * Aggregated number of requests per period.
+ */
+ requests: string[];
+ /**
+ * Aggregated number of consumed bandwidth per period.
+ */
+ network: string[];
+ }
+ /**
+ * Headers
+ */
+ export type Headers = {
+ /**
+ * Header name.
+ */
+ name: string;
+ /**
+ * Header value.
+ */
+ value: string;
+ }
+ /**
+ * Rule
+ */
+ export type ProxyRule = {
+ /**
+ * Rule ID.
+ */
+ $id: string;
+ /**
+ * Rule creation date in ISO 8601 format.
+ */
+ $createdAt: string;
+ /**
+ * Rule update date in ISO 8601 format.
+ */
+ $updatedAt: string;
+ /**
+ * Domain name.
+ */
+ domain: string;
+ /**
+ * Action definition for the rule. Possible values are "api", "function", or "redirect"
+ */
+ resourceType: string;
/**
- * Aggregated stats for number of requests.
+ * ID of resource for the action type. If resourceType is "api" or "url", it is empty. If resourceType is "function", it is ID of the function.
*/
- requestsTotal: Metric[];
+ resourceId: string;
+ /**
+ * Domain verification status. Possible values are "created", "verifying", "verified" and "unverified"
+ */
+ status: string;
+ /**
+ * Certificate generation logs. This will return an empty string if generation did not run, or succeeded.
+ */
+ logs: string;
+ /**
+ * Certificate auto-renewal date in ISO 8601 format.
+ */
+ renewAt: string;
+ }
+ /**
+ * SmsTemplate
+ */
+ export type SmsTemplate = {
/**
- * Aggregated stats for consumed bandwidth.
+ * Template type
*/
- network: Metric[];
+ type: string;
+ /**
+ * Template locale
+ */
+ locale: string;
+ /**
+ * Template message
+ */
+ message: string;
+ }
+ /**
+ * EmailTemplate
+ */
+ export type EmailTemplate = {
+ /**
+ * Template type
+ */
+ type: string;
/**
- * Aggregated stats for function executions.
+ * Template locale
*/
- executionsTotal: Metric[];
+ locale: string;
/**
- * Aggregated stats for number of documents.
+ * Template message
*/
- documentsTotal: Metric[];
+ message: string;
/**
- * Aggregated stats for number of databases.
+ * Name of the sender
*/
- databasesTotal: Metric[];
+ senderName: string;
/**
- * Aggregated stats for number of users.
+ * Email of the sender
*/
- usersTotal: Metric[];
+ senderEmail: string;
/**
- * Aggregated stats for the occupied storage size (in bytes).
+ * Reply to email address
*/
- filesStorage: Metric[];
+ replyTo: string;
/**
- * Aggregated stats for number of buckets.
+ * Email subject
*/
- bucketsTotal: Metric[];
+ subject: string;
}
/**
* Console Variables
@@ -2446,5 +2965,116 @@ export namespace Models {
* Defines if usage stats are enabled. This value is set to 'enabled' by default, to disable the usage stats set the value to 'disabled'.
*/
_APP_USAGE_STATS: string;
+ /**
+ * Defines if VCS (Version Control System) is enabled.
+ */
+ _APP_VCS_ENABLED: boolean;
+ /**
+ * Defines if main domain is configured. If so, custom domains can be created.
+ */
+ _APP_DOMAIN_ENABLED: boolean;
+ /**
+ * Defines if AI assistant is enabled.
+ */
+ _APP_ASSISTANT_ENABLED: boolean;
+ }
+ /**
+ * Migration
+ */
+ export type Migration = {
+ /**
+ * Migration ID.
+ */
+ $id: string;
+ /**
+ * Variable creation date in ISO 8601 format.
+ */
+ $createdAt: string;
+ /**
+ * Variable creation date in ISO 8601 format.
+ */
+ $updatedAt: string;
+ /**
+ * Migration status ( pending, processing, failed, completed )
+ */
+ status: string;
+ /**
+ * Migration stage ( init, processing, source-check, destination-check, migrating, finished )
+ */
+ stage: string;
+ /**
+ * A string containing the type of source of the migration.
+ */
+ source: string;
+ /**
+ * Resources to migration.
+ */
+ resources: string[];
+ /**
+ * A group of counters that represent the total progress of the migration.
+ */
+ statusCounters: object;
+ /**
+ * An array of objects containing the report data of the resources that were migrated.
+ */
+ resourceData: object;
+ /**
+ * All errors that occurred during the migration process.
+ */
+ errors: string[];
+ }
+ /**
+ * Migration Report
+ */
+ export type MigrationReport = {
+ /**
+ * Number of users to be migrated.
+ */
+ user: number;
+ /**
+ * Number of teams to be migrated.
+ */
+ team: number;
+ /**
+ * Number of databases to be migrated.
+ */
+ database: number;
+ /**
+ * Number of documents to be migrated.
+ */
+ document: number;
+ /**
+ * Number of files to be migrated.
+ */
+ file: number;
+ /**
+ * Number of buckets to be migrated.
+ */
+ bucket: number;
+ /**
+ * Number of functions to be migrated.
+ */
+ function: number;
+ /**
+ * Size of files to be migrated in mb.
+ */
+ size: number;
+ /**
+ * Version of the Appwrite instance to be migrated.
+ */
+ version: string;
+ }
+ /**
+ * MigrationFirebaseProject
+ */
+ export type FirebaseProject = {
+ /**
+ * Project ID.
+ */
+ projectId: string;
+ /**
+ * Project display name.
+ */
+ displayName: string;
}
}
diff --git a/src/query.ts b/src/query.ts
index 51cbb7a..1f880cb 100644
--- a/src/query.ts
+++ b/src/query.ts
@@ -28,7 +28,7 @@ export class Query {
`isNotNull("${attribute}")`;
static between = (attribute: string, start: string|number, end: string|number): string =>
- `between("${attribute}", [${Query.parseValues(start)},${Query.parseValues(end)}])`;
+ `between("${attribute}", ${Query.parseValues(start)}, ${Query.parseValues(end)})`;
static startsWith = (attribute: string, value: string): string =>
Query.addQuery(attribute, "startsWith", value);
diff --git a/src/role.ts b/src/role.ts
index d94e398..79f8c6b 100644
--- a/src/role.ts
+++ b/src/role.ts
@@ -1,34 +1,100 @@
+/**
+ * Helper class to generate role strings for `Permission`.
+ */
export class Role {
+
+ /**
+ * Grants access to anyone.
+ *
+ * This includes authenticated and unauthenticated users.
+ *
+ * @returns {string}
+ */
public static any(): string {
return 'any'
}
+ /**
+ * Grants access to a specific user by user ID.
+ *
+ * You can optionally pass verified or unverified for
+ * `status` to target specific types of users.
+ *
+ * @param {string} id
+ * @param {string} status
+ * @returns {string}
+ */
public static user(id: string, status: string = ''): string {
- if(status === '') {
+ if (status === '') {
return `user:${id}`
}
return `user:${id}/${status}`
}
-
+
+ /**
+ * Grants access to any authenticated or anonymous user.
+ *
+ * You can optionally pass verified or unverified for
+ * `status` to target specific types of users.
+ *
+ * @param {string} status
+ * @returns {string}
+ */
public static users(status: string = ''): string {
- if(status === '') {
+ if (status === '') {
return 'users'
}
return `users/${status}`
}
-
+
+ /**
+ * Grants access to any guest user without a session.
+ *
+ * Authenticated users don't have access to this role.
+ *
+ * @returns {string}
+ */
public static guests(): string {
return 'guests'
}
-
+
+ /**
+ * Grants access to a team by team ID.
+ *
+ * You can optionally pass a role for `role` to target
+ * team members with the specified role.
+ *
+ * @param {string} id
+ * @param {string} role
+ * @returns {string}
+ */
public static team(id: string, role: string = ''): string {
- if(role === '') {
+ if (role === '') {
return `team:${id}`
}
return `team:${id}/${role}`
}
+ /**
+ * Grants access to a specific member of a team.
+ *
+ * When the member is removed from the team, they will
+ * no longer have access.
+ *
+ * @param {string} id
+ * @returns {string}
+ */
public static member(id: string): string {
return `member:${id}`
}
+
+ /**
+ * Grants access to a user with the specified label.
+ *
+ * @param {string} name
+ * @returns {string}
+ */
+ public static label(name: string): string {
+ return `label:${name}`
+ }
}
\ No newline at end of file
diff --git a/src/services/account.ts b/src/services/account.ts
index 6fc8bc0..29d4b6a 100644
--- a/src/services/account.ts
+++ b/src/services/account.ts
@@ -10,1060 +10,1057 @@ export class Account extends Service {
super(client);
}
- /**
- * Get Account
- *
- * Get currently logged in user data as JSON object.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async get(): Promise> {
- let path = '/account';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create Account
- *
- * Use this endpoint to allow a new user to register a new account in your
- * project. After the user registration completes successfully, you can use
- * the [/account/verfication](/docs/client/account#accountCreateVerification)
- * route to start verifying the user email address. To allow the new user to
- * login to their new account, you need to create a new [account
- * session](/docs/client/account#accountCreateSession).
- *
- * @param {string} userId
- * @param {string} email
- * @param {string} password
- * @param {string} name
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async create(userId: string, email: string, password: string, name?: string): Promise> {
- if (typeof userId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "userId"');
- }
-
- if (typeof email === 'undefined') {
- throw new AppwriteException('Missing required parameter: "email"');
- }
-
- if (typeof password === 'undefined') {
- throw new AppwriteException('Missing required parameter: "password"');
- }
-
- let path = '/account';
- let payload: Payload = {};
-
- if (typeof userId !== 'undefined') {
- payload['userId'] = userId;
- }
-
- if (typeof email !== 'undefined') {
- payload['email'] = email;
- }
-
- if (typeof password !== 'undefined') {
- payload['password'] = password;
- }
-
- if (typeof name !== 'undefined') {
- payload['name'] = name;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Update Email
- *
- * Update currently logged in user account email address. After changing user
- * address, the user confirmation status will get reset. A new confirmation
- * email is not sent automatically however you can use the send confirmation
- * email endpoint again to send the confirmation email. For security measures,
- * user password is required to complete this request.
- * This endpoint can also be used to convert an anonymous account to a normal
- * one, by passing an email address and a new password.
- *
- *
- * @param {string} email
- * @param {string} password
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updateEmail(email: string, password: string): Promise> {
- if (typeof email === 'undefined') {
- throw new AppwriteException('Missing required parameter: "email"');
- }
-
- if (typeof password === 'undefined') {
- throw new AppwriteException('Missing required parameter: "password"');
- }
-
- let path = '/account/email';
- let payload: Payload = {};
-
- if (typeof email !== 'undefined') {
- payload['email'] = email;
- }
-
- if (typeof password !== 'undefined') {
- payload['password'] = password;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('patch', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create account using an invite code
- *
- * Use this endpoint to allow a new user to register a new account in your
- * project. After the user registration completes successfully, you can use
- * the [/account/verfication](/docs/client/account#accountCreateVerification)
- * route to start verifying the user email address. To allow the new user to
- * login to their new account, you need to create a new [account
- * session](/docs/client/account#accountCreateSession).
- *
- * @param {string} userId
- * @param {string} email
- * @param {string} password
- * @param {string} name
- * @param {string} code
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createWithInviteCode(userId: string, email: string, password: string, name?: string, code?: string): Promise> {
- if (typeof userId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "userId"');
- }
-
- if (typeof email === 'undefined') {
- throw new AppwriteException('Missing required parameter: "email"');
- }
-
- if (typeof password === 'undefined') {
- throw new AppwriteException('Missing required parameter: "password"');
- }
-
- let path = '/account/invite';
- let payload: Payload = {};
-
- if (typeof userId !== 'undefined') {
- payload['userId'] = userId;
- }
-
- if (typeof email !== 'undefined') {
- payload['email'] = email;
- }
-
- if (typeof password !== 'undefined') {
- payload['password'] = password;
- }
-
- if (typeof name !== 'undefined') {
- payload['name'] = name;
- }
-
- if (typeof code !== 'undefined') {
- payload['code'] = code;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create JWT
- *
- * Use this endpoint to create a JSON Web Token. You can use the resulting JWT
- * to authenticate on behalf of the current user when working with the
- * Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes
- * from its creation and will be invalid if the user will logout in that time
- * frame.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createJWT(): Promise {
- let path = '/account/jwt';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * List Logs
- *
- * Get currently logged in user list of latest security activity logs. Each
- * log returns user IP address, location and date and time of log.
- *
- * @param {string[]} queries
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async listLogs(queries?: string[]): Promise {
- let path = '/account/logs';
- let payload: Payload = {};
-
- if (typeof queries !== 'undefined') {
- payload['queries'] = queries;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Update Name
- *
- * Update currently logged in user account name.
- *
- * @param {string} name
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updateName(name: string): Promise> {
- if (typeof name === 'undefined') {
- throw new AppwriteException('Missing required parameter: "name"');
- }
-
- let path = '/account/name';
- let payload: Payload = {};
-
- if (typeof name !== 'undefined') {
- payload['name'] = name;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('patch', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Update Password
- *
- * Update currently logged in user password. For validation, user is required
- * to pass in the new password, and the old password. For users created with
- * OAuth, Team Invites and Magic URL, oldPassword is optional.
- *
- * @param {string} password
- * @param {string} oldPassword
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updatePassword(password: string, oldPassword?: string): Promise> {
- if (typeof password === 'undefined') {
- throw new AppwriteException('Missing required parameter: "password"');
- }
-
- let path = '/account/password';
- let payload: Payload = {};
-
- if (typeof password !== 'undefined') {
- payload['password'] = password;
- }
-
- if (typeof oldPassword !== 'undefined') {
- payload['oldPassword'] = oldPassword;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('patch', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Update Phone
- *
- * Update the currently logged in user's phone number. After updating the
- * phone number, the phone verification status will be reset. A confirmation
- * SMS is not sent automatically, however you can use the [POST
- * /account/verification/phone](/docs/client/account#accountCreatePhoneVerification)
- * endpoint to send a confirmation SMS.
- *
- * @param {string} phone
- * @param {string} password
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updatePhone(phone: string, password: string): Promise> {
- if (typeof phone === 'undefined') {
- throw new AppwriteException('Missing required parameter: "phone"');
- }
-
- if (typeof password === 'undefined') {
- throw new AppwriteException('Missing required parameter: "password"');
- }
-
- let path = '/account/phone';
- let payload: Payload = {};
-
- if (typeof phone !== 'undefined') {
- payload['phone'] = phone;
- }
-
- if (typeof password !== 'undefined') {
- payload['password'] = password;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('patch', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Get Account Preferences
- *
- * Get currently logged in user preferences as a key-value object.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getPrefs(): Promise {
- let path = '/account/prefs';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Update Preferences
- *
- * Update currently logged in user account preferences. The object you pass is
- * stored as is, and replaces any previous value. The maximum allowed prefs
- * size is 64kB and throws error if exceeded.
- *
- * @param {Partial} prefs
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updatePrefs(prefs: Partial): Promise> {
- if (typeof prefs === 'undefined') {
- throw new AppwriteException('Missing required parameter: "prefs"');
- }
-
- let path = '/account/prefs';
- let payload: Payload = {};
-
- if (typeof prefs !== 'undefined') {
- payload['prefs'] = prefs;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('patch', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create Password Recovery
- *
- * Sends the user an email with a temporary secret key for password reset.
- * When the user clicks the confirmation link he is redirected back to your
- * app password reset URL with the secret key and email address values
- * attached to the URL query string. Use the query string params to submit a
- * request to the [PUT
- * /account/recovery](/docs/client/account#accountUpdateRecovery) endpoint to
- * complete the process. The verification link sent to the user's email
- * address is valid for 1 hour.
- *
- * @param {string} email
- * @param {string} url
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createRecovery(email: string, url: string): Promise {
- if (typeof email === 'undefined') {
- throw new AppwriteException('Missing required parameter: "email"');
- }
-
- if (typeof url === 'undefined') {
- throw new AppwriteException('Missing required parameter: "url"');
- }
-
- let path = '/account/recovery';
- let payload: Payload = {};
-
- if (typeof email !== 'undefined') {
- payload['email'] = email;
- }
-
- if (typeof url !== 'undefined') {
- payload['url'] = url;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create Password Recovery (confirmation)
- *
- * Use this endpoint to complete the user account password reset. Both the
- * **userId** and **secret** arguments will be passed as query parameters to
- * the redirect URL you have provided when sending your request to the [POST
- * /account/recovery](/docs/client/account#accountCreateRecovery) endpoint.
- *
- * Please note that in order to avoid a [Redirect
- * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
- * the only valid redirect URLs are the ones from domains you have set when
- * adding your platforms in the console interface.
- *
- * @param {string} userId
- * @param {string} secret
- * @param {string} password
- * @param {string} passwordAgain
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updateRecovery(userId: string, secret: string, password: string, passwordAgain: string): Promise {
- if (typeof userId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "userId"');
- }
-
- if (typeof secret === 'undefined') {
- throw new AppwriteException('Missing required parameter: "secret"');
- }
-
- if (typeof password === 'undefined') {
- throw new AppwriteException('Missing required parameter: "password"');
- }
-
- if (typeof passwordAgain === 'undefined') {
- throw new AppwriteException('Missing required parameter: "passwordAgain"');
- }
-
- let path = '/account/recovery';
- let payload: Payload = {};
-
- if (typeof userId !== 'undefined') {
- payload['userId'] = userId;
- }
-
- if (typeof secret !== 'undefined') {
- payload['secret'] = secret;
- }
-
- if (typeof password !== 'undefined') {
- payload['password'] = password;
- }
-
- if (typeof passwordAgain !== 'undefined') {
- payload['passwordAgain'] = passwordAgain;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('put', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * List Sessions
- *
- * Get currently logged in user list of active sessions across different
- * devices.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async listSessions(): Promise {
- let path = '/account/sessions';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Delete Sessions
- *
- * Delete all sessions from the user account and remove any sessions cookies
- * from the end client.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async deleteSessions(): Promise<{}> {
- let path = '/account/sessions';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('delete', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create Anonymous Session
- *
- * Use this endpoint to allow a new user to register an anonymous account in
- * your project. This route will also create a new session for the user. To
- * allow the new user to convert an anonymous account to a normal account, you
- * need to update its [email and
- * password](/docs/client/account#accountUpdateEmail) or create an [OAuth2
- * session](/docs/client/account#accountCreateOAuth2Session).
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createAnonymousSession(): Promise {
- let path = '/account/sessions/anonymous';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create Email Session
- *
- * Allow the user to login into their account by providing a valid email and
- * password combination. This route will create a new session for the user.
- *
- * A user is limited to 10 active sessions at a time by default. [Learn more
- * about session limits](/docs/authentication-security#limits).
- *
- * @param {string} email
- * @param {string} password
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createEmailSession(email: string, password: string): Promise {
- if (typeof email === 'undefined') {
- throw new AppwriteException('Missing required parameter: "email"');
- }
-
- if (typeof password === 'undefined') {
- throw new AppwriteException('Missing required parameter: "password"');
- }
-
- let path = '/account/sessions/email';
- let payload: Payload = {};
-
- if (typeof email !== 'undefined') {
- payload['email'] = email;
- }
-
- if (typeof password !== 'undefined') {
- payload['password'] = password;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create Magic URL session
- *
- * Sends the user an email with a secret key for creating a session. If the
- * provided user ID has not be registered, a new user will be created. When
- * the user clicks the link in the email, the user is redirected back to the
- * URL you provided with the secret key and userId values attached to the URL
- * query string. Use the query string parameters to submit a request to the
- * [PUT
- * /account/sessions/magic-url](/docs/client/account#accountUpdateMagicURLSession)
- * endpoint to complete the login process. The link sent to the user's email
- * address is valid for 1 hour. If you are on a mobile device you can leave
- * the URL parameter empty, so that the login completion will be handled by
- * your Appwrite instance by default.
- *
- * A user is limited to 10 active sessions at a time by default. [Learn more
- * about session limits](/docs/authentication-security#limits).
- *
- * @param {string} userId
- * @param {string} email
- * @param {string} url
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createMagicURLSession(userId: string, email: string, url?: string): Promise {
- if (typeof userId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "userId"');
- }
-
- if (typeof email === 'undefined') {
- throw new AppwriteException('Missing required parameter: "email"');
- }
-
- let path = '/account/sessions/magic-url';
- let payload: Payload = {};
-
- if (typeof userId !== 'undefined') {
- payload['userId'] = userId;
- }
-
- if (typeof email !== 'undefined') {
- payload['email'] = email;
- }
-
- if (typeof url !== 'undefined') {
- payload['url'] = url;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create Magic URL session (confirmation)
- *
- * Use this endpoint to complete creating the session with the Magic URL. Both
- * the **userId** and **secret** arguments will be passed as query parameters
- * to the redirect URL you have provided when sending your request to the
- * [POST
- * /account/sessions/magic-url](/docs/client/account#accountCreateMagicURLSession)
- * endpoint.
- *
- * Please note that in order to avoid a [Redirect
- * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
- * the only valid redirect URLs are the ones from domains you have set when
- * adding your platforms in the console interface.
- *
- * @param {string} userId
- * @param {string} secret
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updateMagicURLSession(userId: string, secret: string): Promise {
- if (typeof userId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "userId"');
- }
-
- if (typeof secret === 'undefined') {
- throw new AppwriteException('Missing required parameter: "secret"');
- }
-
- let path = '/account/sessions/magic-url';
- let payload: Payload = {};
-
- if (typeof userId !== 'undefined') {
- payload['userId'] = userId;
- }
-
- if (typeof secret !== 'undefined') {
- payload['secret'] = secret;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('put', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create OAuth2 Session
- *
- * Allow the user to login to their account using the OAuth2 provider of their
- * choice. Each OAuth2 provider should be enabled from the Appwrite console
- * first. Use the success and failure arguments to provide a redirect URL's
- * back to your app when login is completed.
- *
- * If there is already an active session, the new session will be attached to
- * the logged-in account. If there are no active sessions, the server will
- * attempt to look for a user with the same email address as the email
- * received from the OAuth2 provider and attach the new session to the
- * existing user. If no matching user is found - the server will create a new
- * user.
- *
- * A user is limited to 10 active sessions at a time by default. [Learn more
- * about session limits](/docs/authentication-security#limits).
- *
- *
- * @param {string} provider
- * @param {string} success
- * @param {string} failure
- * @param {string[]} scopes
- * @throws {AppwriteException}
- * @returns {void|string}
- */
- createOAuth2Session(provider: string, success?: string, failure?: string, scopes?: string[]): void | URL {
- if (typeof provider === 'undefined') {
- throw new AppwriteException('Missing required parameter: "provider"');
- }
-
- let path = '/account/sessions/oauth2/{provider}'.replace('{provider}', provider);
- let payload: Payload = {};
-
- if (typeof success !== 'undefined') {
- payload['success'] = success;
- }
-
- if (typeof failure !== 'undefined') {
- payload['failure'] = failure;
- }
-
- if (typeof scopes !== 'undefined') {
- payload['scopes'] = scopes;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- payload['project'] = this.client.config.project;
-
-
- for (const [key, value] of Object.entries(Service.flatten(payload))) {
- uri.searchParams.append(key, value);
- }
- if (typeof window !== 'undefined' && window?.location) {
- window.location.href = uri.toString();
- } else {
- return uri;
- }
- }
-
- /**
- * Create Phone session
- *
- * Sends the user an SMS with a secret key for creating a session. If the
- * provided user ID has not be registered, a new user will be created. Use the
- * returned user ID and secret and submit a request to the [PUT
- * /account/sessions/phone](/docs/client/account#accountUpdatePhoneSession)
- * endpoint to complete the login process. The secret sent to the user's phone
- * is valid for 15 minutes.
- *
- * A user is limited to 10 active sessions at a time by default. [Learn more
- * about session limits](/docs/authentication-security#limits).
- *
- * @param {string} userId
- * @param {string} phone
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createPhoneSession(userId: string, phone: string): Promise {
- if (typeof userId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "userId"');
- }
-
- if (typeof phone === 'undefined') {
- throw new AppwriteException('Missing required parameter: "phone"');
- }
-
- let path = '/account/sessions/phone';
- let payload: Payload = {};
-
- if (typeof userId !== 'undefined') {
- payload['userId'] = userId;
- }
-
- if (typeof phone !== 'undefined') {
- payload['phone'] = phone;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create Phone Session (confirmation)
- *
- * Use this endpoint to complete creating a session with SMS. Use the
- * **userId** from the
- * [createPhoneSession](/docs/client/account#accountCreatePhoneSession)
- * endpoint and the **secret** received via SMS to successfully update and
- * confirm the phone session.
- *
- * @param {string} userId
- * @param {string} secret
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updatePhoneSession(userId: string, secret: string): Promise {
- if (typeof userId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "userId"');
- }
-
- if (typeof secret === 'undefined') {
- throw new AppwriteException('Missing required parameter: "secret"');
- }
-
- let path = '/account/sessions/phone';
- let payload: Payload = {};
-
- if (typeof userId !== 'undefined') {
- payload['userId'] = userId;
- }
-
- if (typeof secret !== 'undefined') {
- payload['secret'] = secret;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('put', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Get Session
- *
- * Use this endpoint to get a logged in user's session using a Session ID.
- * Inputting 'current' will return the current session being used.
- *
- * @param {string} sessionId
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getSession(sessionId: string): Promise {
- if (typeof sessionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "sessionId"');
- }
-
- let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Update OAuth Session (Refresh Tokens)
- *
- * Access tokens have limited lifespan and expire to mitigate security risks.
- * If session was created using an OAuth provider, this route can be used to
- * "refresh" the access token.
- *
- * @param {string} sessionId
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updateSession(sessionId: string): Promise {
- if (typeof sessionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "sessionId"');
- }
-
- let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('patch', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Delete Session
- *
- * Use this endpoint to log out the currently logged in user from all their
- * account sessions across all of their different devices. When using the
- * Session ID argument, only the unique session ID provided is deleted.
- *
- *
- * @param {string} sessionId
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async deleteSession(sessionId: string): Promise<{}> {
- if (typeof sessionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "sessionId"');
- }
-
- let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('delete', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Update Status
- *
- * Block the currently logged in user account. Behind the scene, the user
- * record is not deleted but permanently blocked from any access. To
- * completely delete a user, use the Users API instead.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updateStatus(): Promise> {
- let path = '/account/status';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('patch', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create Email Verification
- *
- * Use this endpoint to send a verification message to your user email address
- * to confirm they are the valid owners of that address. Both the **userId**
- * and **secret** arguments will be passed as query parameters to the URL you
- * have provided to be attached to the verification email. The provided URL
- * should redirect the user back to your app and allow you to complete the
- * verification process by verifying both the **userId** and **secret**
- * parameters. Learn more about how to [complete the verification
- * process](/docs/client/account#accountUpdateEmailVerification). The
- * verification link sent to the user's email address is valid for 7 days.
- *
- * Please note that in order to avoid a [Redirect
- * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md),
- * the only valid redirect URLs are the ones from domains you have set when
- * adding your platforms in the console interface.
- *
- *
- * @param {string} url
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createVerification(url: string): Promise {
- if (typeof url === 'undefined') {
- throw new AppwriteException('Missing required parameter: "url"');
- }
-
- let path = '/account/verification';
- let payload: Payload = {};
-
- if (typeof url !== 'undefined') {
- payload['url'] = url;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create Email Verification (confirmation)
- *
- * Use this endpoint to complete the user email verification process. Use both
- * the **userId** and **secret** parameters that were attached to your app URL
- * to verify the user email ownership. If confirmed this route will return a
- * 200 status code.
- *
- * @param {string} userId
- * @param {string} secret
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updateVerification(userId: string, secret: string): Promise {
- if (typeof userId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "userId"');
- }
-
- if (typeof secret === 'undefined') {
- throw new AppwriteException('Missing required parameter: "secret"');
- }
-
- let path = '/account/verification';
- let payload: Payload = {};
-
- if (typeof userId !== 'undefined') {
- payload['userId'] = userId;
- }
-
- if (typeof secret !== 'undefined') {
- payload['secret'] = secret;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('put', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create Phone Verification
- *
- * Use this endpoint to send a verification SMS to the currently logged in
- * user. This endpoint is meant for use after updating a user's phone number
- * using the [accountUpdatePhone](/docs/client/account#accountUpdatePhone)
- * endpoint. Learn more about how to [complete the verification
- * process](/docs/client/account#accountUpdatePhoneVerification). The
- * verification code sent to the user's phone number is valid for 15 minutes.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createPhoneVerification(): Promise {
- let path = '/account/verification/phone';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create Phone Verification (confirmation)
- *
- * Use this endpoint to complete the user phone verification process. Use the
- * **userId** and **secret** that were sent to your user's phone number to
- * verify the user email ownership. If confirmed this route will return a 200
- * status code.
- *
- * @param {string} userId
- * @param {string} secret
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updatePhoneVerification(userId: string, secret: string): Promise {
- if (typeof userId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "userId"');
- }
-
- if (typeof secret === 'undefined') {
- throw new AppwriteException('Missing required parameter: "secret"');
- }
-
- let path = '/account/verification/phone';
- let payload: Payload = {};
-
- if (typeof userId !== 'undefined') {
- payload['userId'] = userId;
- }
-
- if (typeof secret !== 'undefined') {
- payload['secret'] = secret;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('put', uri, {
- 'content-type': 'application/json',
- }, payload);
+ /**
+ * Get account
+ *
+ * Get the currently logged in user.
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async get(): Promise> {
+ const apiPath = '/account';
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create account
+ *
+ * Use this endpoint to allow a new user to register a new account in your
+ * project. After the user registration completes successfully, you can use
+ * the
+ * [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification)
+ * route to start verifying the user email address. To allow the new user to
+ * login to their new account, you need to create a new [account
+ * session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession).
+ *
+ * @param {string} userId
+ * @param {string} email
+ * @param {string} password
+ * @param {string} name
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async create(userId: string, email: string, password: string, name?: string): Promise> {
+ if (typeof userId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "userId"');
}
+
+ if (typeof email === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "email"');
+ }
+
+ if (typeof password === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "password"');
+ }
+
+ const apiPath = '/account';
+ const payload: Payload = {};
+
+ if (typeof userId !== 'undefined') {
+ payload['userId'] = userId;
+ }
+
+ if (typeof email !== 'undefined') {
+ payload['email'] = email;
+ }
+
+ if (typeof password !== 'undefined') {
+ payload['password'] = password;
+ }
+
+ if (typeof name !== 'undefined') {
+ payload['name'] = name;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update email
+ *
+ * Update currently logged in user account email address. After changing user
+ * address, the user confirmation status will get reset. A new confirmation
+ * email is not sent automatically however you can use the send confirmation
+ * email endpoint again to send the confirmation email. For security measures,
+ * user password is required to complete this request.
+ * This endpoint can also be used to convert an anonymous account to a normal
+ * one, by passing an email address and a new password.
+ *
+ *
+ * @param {string} email
+ * @param {string} password
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updateEmail(email: string, password: string): Promise> {
+ if (typeof email === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "email"');
+ }
+
+ if (typeof password === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "password"');
+ }
+
+ const apiPath = '/account/email';
+ const payload: Payload = {};
+
+ if (typeof email !== 'undefined') {
+ payload['email'] = email;
+ }
+
+ if (typeof password !== 'undefined') {
+ payload['password'] = password;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('patch', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * List Identities
+ *
+ * Get the list of identities for the currently logged in user.
+ *
+ * @param {string} queries
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async listIdentities(queries?: string): Promise {
+ const apiPath = '/account/identities';
+ const payload: Payload = {};
+
+ if (typeof queries !== 'undefined') {
+ payload['queries'] = queries;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Delete Identity
+ *
+ * Delete an identity by its unique ID.
+ *
+ * @param {string} identityId
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async deleteIdentity(identityId: string): Promise<{}> {
+ if (typeof identityId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "identityId"');
+ }
+
+ const apiPath = '/account/identities/{identityId}'.replace('{identityId}', identityId);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('delete', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create JWT
+ *
+ * Use this endpoint to create a JSON Web Token. You can use the resulting JWT
+ * to authenticate on behalf of the current user when working with the
+ * Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes
+ * from its creation and will be invalid if the user will logout in that time
+ * frame.
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createJWT(): Promise {
+ const apiPath = '/account/jwt';
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * List logs
+ *
+ * Get the list of latest security activity logs for the currently logged in
+ * user. Each log returns user IP address, location and date and time of log.
+ *
+ * @param {string[]} queries
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async listLogs(queries?: string[]): Promise {
+ const apiPath = '/account/logs';
+ const payload: Payload = {};
+
+ if (typeof queries !== 'undefined') {
+ payload['queries'] = queries;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update name
+ *
+ * Update currently logged in user account name.
+ *
+ * @param {string} name
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updateName(name: string): Promise> {
+ if (typeof name === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "name"');
+ }
+
+ const apiPath = '/account/name';
+ const payload: Payload = {};
+
+ if (typeof name !== 'undefined') {
+ payload['name'] = name;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('patch', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update password
+ *
+ * Update currently logged in user password. For validation, user is required
+ * to pass in the new password, and the old password. For users created with
+ * OAuth, Team Invites and Magic URL, oldPassword is optional.
+ *
+ * @param {string} password
+ * @param {string} oldPassword
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updatePassword(password: string, oldPassword?: string): Promise> {
+ if (typeof password === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "password"');
+ }
+
+ const apiPath = '/account/password';
+ const payload: Payload = {};
+
+ if (typeof password !== 'undefined') {
+ payload['password'] = password;
+ }
+
+ if (typeof oldPassword !== 'undefined') {
+ payload['oldPassword'] = oldPassword;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('patch', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update phone
+ *
+ * Update the currently logged in user's phone number. After updating the
+ * phone number, the phone verification status will be reset. A confirmation
+ * SMS is not sent automatically, however you can use the [POST
+ * /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification)
+ * endpoint to send a confirmation SMS.
+ *
+ * @param {string} phone
+ * @param {string} password
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updatePhone(phone: string, password: string): Promise> {
+ if (typeof phone === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "phone"');
+ }
+
+ if (typeof password === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "password"');
+ }
+
+ const apiPath = '/account/phone';
+ const payload: Payload = {};
+
+ if (typeof phone !== 'undefined') {
+ payload['phone'] = phone;
+ }
+
+ if (typeof password !== 'undefined') {
+ payload['password'] = password;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('patch', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get account preferences
+ *
+ * Get the preferences as a key-value object for the currently logged in user.
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getPrefs(): Promise {
+ const apiPath = '/account/prefs';
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update preferences
+ *
+ * Update currently logged in user account preferences. The object you pass is
+ * stored as is, and replaces any previous value. The maximum allowed prefs
+ * size is 64kB and throws error if exceeded.
+ *
+ * @param {Partial} prefs
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updatePrefs(prefs: Partial): Promise> {
+ if (typeof prefs === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "prefs"');
+ }
+
+ const apiPath = '/account/prefs';
+ const payload: Payload = {};
+
+ if (typeof prefs !== 'undefined') {
+ payload['prefs'] = prefs;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('patch', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create password recovery
+ *
+ * Sends the user an email with a temporary secret key for password reset.
+ * When the user clicks the confirmation link he is redirected back to your
+ * app password reset URL with the secret key and email address values
+ * attached to the URL query string. Use the query string params to submit a
+ * request to the [PUT
+ * /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery)
+ * endpoint to complete the process. The verification link sent to the user's
+ * email address is valid for 1 hour.
+ *
+ * @param {string} email
+ * @param {string} url
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createRecovery(email: string, url: string): Promise {
+ if (typeof email === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "email"');
+ }
+
+ if (typeof url === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "url"');
+ }
+
+ const apiPath = '/account/recovery';
+ const payload: Payload = {};
+
+ if (typeof email !== 'undefined') {
+ payload['email'] = email;
+ }
+
+ if (typeof url !== 'undefined') {
+ payload['url'] = url;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create password recovery (confirmation)
+ *
+ * Use this endpoint to complete the user account password reset. Both the
+ * **userId** and **secret** arguments will be passed as query parameters to
+ * the redirect URL you have provided when sending your request to the [POST
+ * /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery)
+ * endpoint.
+ *
+ * Please note that in order to avoid a [Redirect
+ * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
+ * the only valid redirect URLs are the ones from domains you have set when
+ * adding your platforms in the console interface.
+ *
+ * @param {string} userId
+ * @param {string} secret
+ * @param {string} password
+ * @param {string} passwordAgain
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updateRecovery(userId: string, secret: string, password: string, passwordAgain: string): Promise {
+ if (typeof userId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "userId"');
+ }
+
+ if (typeof secret === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "secret"');
+ }
+
+ if (typeof password === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "password"');
+ }
+
+ if (typeof passwordAgain === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "passwordAgain"');
+ }
+
+ const apiPath = '/account/recovery';
+ const payload: Payload = {};
+
+ if (typeof userId !== 'undefined') {
+ payload['userId'] = userId;
+ }
+
+ if (typeof secret !== 'undefined') {
+ payload['secret'] = secret;
+ }
+
+ if (typeof password !== 'undefined') {
+ payload['password'] = password;
+ }
+
+ if (typeof passwordAgain !== 'undefined') {
+ payload['passwordAgain'] = passwordAgain;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('put', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * List sessions
+ *
+ * Get the list of active sessions across different devices for the currently
+ * logged in user.
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async listSessions(): Promise {
+ const apiPath = '/account/sessions';
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Delete sessions
+ *
+ * Delete all sessions from the user account and remove any sessions cookies
+ * from the end client.
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async deleteSessions(): Promise<{}> {
+ const apiPath = '/account/sessions';
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('delete', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create anonymous session
+ *
+ * Use this endpoint to allow a new user to register an anonymous account in
+ * your project. This route will also create a new session for the user. To
+ * allow the new user to convert an anonymous account to a normal account, you
+ * need to update its [email and
+ * password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail)
+ * or create an [OAuth2
+ * session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createAnonymousSession(): Promise {
+ const apiPath = '/account/sessions/anonymous';
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create email session
+ *
+ * Allow the user to login into their account by providing a valid email and
+ * password combination. This route will create a new session for the user.
+ *
+ * A user is limited to 10 active sessions at a time by default. [Learn more
+ * about session
+ * limits](https://appwrite.io/docs/authentication-security#limits).
+ *
+ * @param {string} email
+ * @param {string} password
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createEmailSession(email: string, password: string): Promise {
+ if (typeof email === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "email"');
+ }
+
+ if (typeof password === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "password"');
+ }
+
+ const apiPath = '/account/sessions/email';
+ const payload: Payload = {};
+
+ if (typeof email !== 'undefined') {
+ payload['email'] = email;
+ }
+
+ if (typeof password !== 'undefined') {
+ payload['password'] = password;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create magic URL session
+ *
+ * Sends the user an email with a secret key for creating a session. If the
+ * provided user ID has not been registered, a new user will be created. When
+ * the user clicks the link in the email, the user is redirected back to the
+ * URL you provided with the secret key and userId values attached to the URL
+ * query string. Use the query string parameters to submit a request to the
+ * [PUT
+ * /account/sessions/magic-url](https://appwrite.io/docs/references/cloud/client-web/account#updateMagicURLSession)
+ * endpoint to complete the login process. The link sent to the user's email
+ * address is valid for 1 hour. If you are on a mobile device you can leave
+ * the URL parameter empty, so that the login completion will be handled by
+ * your Appwrite instance by default.
+ *
+ * A user is limited to 10 active sessions at a time by default. [Learn more
+ * about session
+ * limits](https://appwrite.io/docs/authentication-security#limits).
+ *
+ *
+ * @param {string} userId
+ * @param {string} email
+ * @param {string} url
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createMagicURLSession(userId: string, email: string, url?: string): Promise {
+ if (typeof userId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "userId"');
+ }
+
+ if (typeof email === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "email"');
+ }
+
+ const apiPath = '/account/sessions/magic-url';
+ const payload: Payload = {};
+
+ if (typeof userId !== 'undefined') {
+ payload['userId'] = userId;
+ }
+
+ if (typeof email !== 'undefined') {
+ payload['email'] = email;
+ }
+
+ if (typeof url !== 'undefined') {
+ payload['url'] = url;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create magic URL session (confirmation)
+ *
+ * Use this endpoint to complete creating the session with the Magic URL. Both
+ * the **userId** and **secret** arguments will be passed as query parameters
+ * to the redirect URL you have provided when sending your request to the
+ * [POST
+ * /account/sessions/magic-url](https://appwrite.io/docs/references/cloud/client-web/account#createMagicURLSession)
+ * endpoint.
+ *
+ * Please note that in order to avoid a [Redirect
+ * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
+ * the only valid redirect URLs are the ones from domains you have set when
+ * adding your platforms in the console interface.
+ *
+ * @param {string} userId
+ * @param {string} secret
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updateMagicURLSession(userId: string, secret: string): Promise {
+ if (typeof userId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "userId"');
+ }
+
+ if (typeof secret === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "secret"');
+ }
+
+ const apiPath = '/account/sessions/magic-url';
+ const payload: Payload = {};
+
+ if (typeof userId !== 'undefined') {
+ payload['userId'] = userId;
+ }
+
+ if (typeof secret !== 'undefined') {
+ payload['secret'] = secret;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('put', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create OAuth2 session
+ *
+ * Allow the user to login to their account using the OAuth2 provider of their
+ * choice. Each OAuth2 provider should be enabled from the Appwrite console
+ * first. Use the success and failure arguments to provide a redirect URL's
+ * back to your app when login is completed.
+ *
+ * If there is already an active session, the new session will be attached to
+ * the logged-in account. If there are no active sessions, the server will
+ * attempt to look for a user with the same email address as the email
+ * received from the OAuth2 provider and attach the new session to the
+ * existing user. If no matching user is found - the server will create a new
+ * user.
+ *
+ * A user is limited to 10 active sessions at a time by default. [Learn more
+ * about session
+ * limits](https://appwrite.io/docs/authentication-security#limits).
+ *
+ *
+ * @param {string} provider
+ * @param {string} success
+ * @param {string} failure
+ * @param {string[]} scopes
+ * @throws {AppwriteException}
+ * @returns {void|string}
+ */
+ createOAuth2Session(provider: string, success?: string, failure?: string, scopes?: string[]): void | URL {
+ if (typeof provider === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "provider"');
+ }
+
+ const apiPath = '/account/sessions/oauth2/{provider}'.replace('{provider}', provider);
+ const payload: Payload = {};
+
+ if (typeof success !== 'undefined') {
+ payload['success'] = success;
+ }
+
+ if (typeof failure !== 'undefined') {
+ payload['failure'] = failure;
+ }
+
+ if (typeof scopes !== 'undefined') {
+ payload['scopes'] = scopes;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ payload['project'] = this.client.config.project;
+
+
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
+ uri.searchParams.append(key, value);
+ }
+ if (typeof window !== 'undefined' && window?.location) {
+ window.location.href = uri.toString();
+ } else {
+ return uri;
+ }
+ }
+
+ /**
+ * Create phone session
+ *
+ * Sends the user an SMS with a secret key for creating a session. If the
+ * provided user ID has not be registered, a new user will be created. Use the
+ * returned user ID and secret and submit a request to the [PUT
+ * /account/sessions/phone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneSession)
+ * endpoint to complete the login process. The secret sent to the user's phone
+ * is valid for 15 minutes.
+ *
+ * A user is limited to 10 active sessions at a time by default. [Learn more
+ * about session
+ * limits](https://appwrite.io/docs/authentication-security#limits).
+ *
+ * @param {string} userId
+ * @param {string} phone
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createPhoneSession(userId: string, phone: string): Promise {
+ if (typeof userId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "userId"');
+ }
+
+ if (typeof phone === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "phone"');
+ }
+
+ const apiPath = '/account/sessions/phone';
+ const payload: Payload = {};
+
+ if (typeof userId !== 'undefined') {
+ payload['userId'] = userId;
+ }
+
+ if (typeof phone !== 'undefined') {
+ payload['phone'] = phone;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create phone session (confirmation)
+ *
+ * Use this endpoint to complete creating a session with SMS. Use the
+ * **userId** from the
+ * [createPhoneSession](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneSession)
+ * endpoint and the **secret** received via SMS to successfully update and
+ * confirm the phone session.
+ *
+ * @param {string} userId
+ * @param {string} secret
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updatePhoneSession(userId: string, secret: string): Promise {
+ if (typeof userId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "userId"');
+ }
+
+ if (typeof secret === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "secret"');
+ }
+
+ const apiPath = '/account/sessions/phone';
+ const payload: Payload = {};
+
+ if (typeof userId !== 'undefined') {
+ payload['userId'] = userId;
+ }
+
+ if (typeof secret !== 'undefined') {
+ payload['secret'] = secret;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('put', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get session
+ *
+ * Use this endpoint to get a logged in user's session using a Session ID.
+ * Inputting 'current' will return the current session being used.
+ *
+ * @param {string} sessionId
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getSession(sessionId: string): Promise {
+ if (typeof sessionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "sessionId"');
+ }
+
+ const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update OAuth session (refresh tokens)
+ *
+ * Access tokens have limited lifespan and expire to mitigate security risks.
+ * If session was created using an OAuth provider, this route can be used to
+ * "refresh" the access token.
+ *
+ * @param {string} sessionId
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updateSession(sessionId: string): Promise {
+ if (typeof sessionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "sessionId"');
+ }
+
+ const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('patch', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Delete session
+ *
+ * Logout the user. Use 'current' as the session ID to logout on this device,
+ * use a session ID to logout on another device. If you're looking to logout
+ * the user on all devices, use [Delete
+ * Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions)
+ * instead.
+ *
+ * @param {string} sessionId
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async deleteSession(sessionId: string): Promise<{}> {
+ if (typeof sessionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "sessionId"');
+ }
+
+ const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('delete', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update status
+ *
+ * Block the currently logged in user account. Behind the scene, the user
+ * record is not deleted but permanently blocked from any access. To
+ * completely delete a user, use the Users API instead.
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updateStatus(): Promise> {
+ const apiPath = '/account/status';
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('patch', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create email verification
+ *
+ * Use this endpoint to send a verification message to your user email address
+ * to confirm they are the valid owners of that address. Both the **userId**
+ * and **secret** arguments will be passed as query parameters to the URL you
+ * have provided to be attached to the verification email. The provided URL
+ * should redirect the user back to your app and allow you to complete the
+ * verification process by verifying both the **userId** and **secret**
+ * parameters. Learn more about how to [complete the verification
+ * process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification).
+ * The verification link sent to the user's email address is valid for 7 days.
+ *
+ * Please note that in order to avoid a [Redirect
+ * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md),
+ * the only valid redirect URLs are the ones from domains you have set when
+ * adding your platforms in the console interface.
+ *
+ *
+ * @param {string} url
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createVerification(url: string): Promise {
+ if (typeof url === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "url"');
+ }
+
+ const apiPath = '/account/verification';
+ const payload: Payload = {};
+
+ if (typeof url !== 'undefined') {
+ payload['url'] = url;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create email verification (confirmation)
+ *
+ * Use this endpoint to complete the user email verification process. Use both
+ * the **userId** and **secret** parameters that were attached to your app URL
+ * to verify the user email ownership. If confirmed this route will return a
+ * 200 status code.
+ *
+ * @param {string} userId
+ * @param {string} secret
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updateVerification(userId: string, secret: string): Promise {
+ if (typeof userId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "userId"');
+ }
+
+ if (typeof secret === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "secret"');
+ }
+
+ const apiPath = '/account/verification';
+ const payload: Payload = {};
+
+ if (typeof userId !== 'undefined') {
+ payload['userId'] = userId;
+ }
+
+ if (typeof secret !== 'undefined') {
+ payload['secret'] = secret;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('put', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create phone verification
+ *
+ * Use this endpoint to send a verification SMS to the currently logged in
+ * user. This endpoint is meant for use after updating a user's phone number
+ * using the
+ * [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone)
+ * endpoint. Learn more about how to [complete the verification
+ * process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification).
+ * The verification code sent to the user's phone number is valid for 15
+ * minutes.
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createPhoneVerification(): Promise {
+ const apiPath = '/account/verification/phone';
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create phone verification (confirmation)
+ *
+ * Use this endpoint to complete the user phone verification process. Use the
+ * **userId** and **secret** that were sent to your user's phone number to
+ * verify the user email ownership. If confirmed this route will return a 200
+ * status code.
+ *
+ * @param {string} userId
+ * @param {string} secret
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updatePhoneVerification(userId: string, secret: string): Promise {
+ if (typeof userId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "userId"');
+ }
+
+ if (typeof secret === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "secret"');
+ }
+
+ const apiPath = '/account/verification/phone';
+ const payload: Payload = {};
+
+ if (typeof userId !== 'undefined') {
+ payload['userId'] = userId;
+ }
+
+ if (typeof secret !== 'undefined') {
+ payload['secret'] = secret;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('put', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
};
diff --git a/src/services/assistant.ts b/src/services/assistant.ts
new file mode 100644
index 0000000..108aa25
--- /dev/null
+++ b/src/services/assistant.ts
@@ -0,0 +1,38 @@
+import { Service } from '../service';
+import { AppwriteException, Client } from '../client';
+import type { Models } from '../models';
+import type { UploadProgress, Payload } from '../client';
+
+export class Assistant extends Service {
+
+ constructor(client: Client)
+ {
+ super(client);
+ }
+
+ /**
+ * Ask Query
+ *
+ *
+ * @param {string} prompt
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async chat(prompt: string): Promise<{}> {
+ if (typeof prompt === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "prompt"');
+ }
+
+ const apiPath = '/console/assistant';
+ const payload: Payload = {};
+
+ if (typeof prompt !== 'undefined') {
+ payload['prompt'] = prompt;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+};
diff --git a/src/services/avatars.ts b/src/services/avatars.ts
index 8887269..13ed4a5 100644
--- a/src/services/avatars.ts
+++ b/src/services/avatars.ts
@@ -10,342 +10,343 @@ export class Avatars extends Service {
super(client);
}
- /**
- * Get Browser Icon
- *
- * You can use this endpoint to show different browser icons to your users.
- * The code argument receives the browser code as it appears in your user [GET
- * /account/sessions](/docs/client/account#accountGetSessions) endpoint. Use
- * width, height and quality arguments to change the output settings.
- *
- * When one dimension is specified and the other is 0, the image is scaled
- * with preserved aspect ratio. If both dimensions are 0, the API provides an
- * image at source quality. If dimensions are not specified, the default size
- * of image returned is 100x100px.
- *
- * @param {string} code
- * @param {number} width
- * @param {number} height
- * @param {number} quality
- * @throws {AppwriteException}
- * @returns {URL}
- */
- getBrowser(code: string, width?: number, height?: number, quality?: number): URL {
- if (typeof code === 'undefined') {
- throw new AppwriteException('Missing required parameter: "code"');
- }
-
- let path = '/avatars/browsers/{code}'.replace('{code}', code);
- let payload: Payload = {};
-
- if (typeof width !== 'undefined') {
- payload['width'] = width;
- }
-
- if (typeof height !== 'undefined') {
- payload['height'] = height;
- }
-
- if (typeof quality !== 'undefined') {
- payload['quality'] = quality;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- payload['project'] = this.client.config.project;
-
-
- for (const [key, value] of Object.entries(Service.flatten(payload))) {
- uri.searchParams.append(key, value);
- }
- return uri;
- }
-
- /**
- * Get Credit Card Icon
- *
- * The credit card endpoint will return you the icon of the credit card
- * provider you need. Use width, height and quality arguments to change the
- * output settings.
- *
- * When one dimension is specified and the other is 0, the image is scaled
- * with preserved aspect ratio. If both dimensions are 0, the API provides an
- * image at source quality. If dimensions are not specified, the default size
- * of image returned is 100x100px.
- *
- *
- * @param {string} code
- * @param {number} width
- * @param {number} height
- * @param {number} quality
- * @throws {AppwriteException}
- * @returns {URL}
- */
- getCreditCard(code: string, width?: number, height?: number, quality?: number): URL {
- if (typeof code === 'undefined') {
- throw new AppwriteException('Missing required parameter: "code"');
- }
-
- let path = '/avatars/credit-cards/{code}'.replace('{code}', code);
- let payload: Payload = {};
-
- if (typeof width !== 'undefined') {
- payload['width'] = width;
- }
-
- if (typeof height !== 'undefined') {
- payload['height'] = height;
- }
-
- if (typeof quality !== 'undefined') {
- payload['quality'] = quality;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- payload['project'] = this.client.config.project;
-
-
- for (const [key, value] of Object.entries(Service.flatten(payload))) {
- uri.searchParams.append(key, value);
- }
- return uri;
- }
-
- /**
- * Get Favicon
- *
- * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote
- * website URL.
- *
- *
- * @param {string} url
- * @throws {AppwriteException}
- * @returns {URL}
- */
- getFavicon(url: string): URL {
- if (typeof url === 'undefined') {
- throw new AppwriteException('Missing required parameter: "url"');
- }
-
- let path = '/avatars/favicon';
- let payload: Payload = {};
-
- if (typeof url !== 'undefined') {
- payload['url'] = url;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- payload['project'] = this.client.config.project;
-
-
- for (const [key, value] of Object.entries(Service.flatten(payload))) {
- uri.searchParams.append(key, value);
- }
- return uri;
- }
-
- /**
- * Get Country Flag
- *
- * You can use this endpoint to show different country flags icons to your
- * users. The code argument receives the 2 letter country code. Use width,
- * height and quality arguments to change the output settings. Country codes
- * follow the [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) standard.
- *
- * When one dimension is specified and the other is 0, the image is scaled
- * with preserved aspect ratio. If both dimensions are 0, the API provides an
- * image at source quality. If dimensions are not specified, the default size
- * of image returned is 100x100px.
- *
- *
- * @param {string} code
- * @param {number} width
- * @param {number} height
- * @param {number} quality
- * @throws {AppwriteException}
- * @returns {URL}
- */
- getFlag(code: string, width?: number, height?: number, quality?: number): URL {
- if (typeof code === 'undefined') {
- throw new AppwriteException('Missing required parameter: "code"');
- }
-
- let path = '/avatars/flags/{code}'.replace('{code}', code);
- let payload: Payload = {};
-
- if (typeof width !== 'undefined') {
- payload['width'] = width;
- }
-
- if (typeof height !== 'undefined') {
- payload['height'] = height;
- }
-
- if (typeof quality !== 'undefined') {
- payload['quality'] = quality;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- payload['project'] = this.client.config.project;
-
-
- for (const [key, value] of Object.entries(Service.flatten(payload))) {
- uri.searchParams.append(key, value);
- }
- return uri;
- }
-
- /**
- * Get Image from URL
- *
- * Use this endpoint to fetch a remote image URL and crop it to any image size
- * you want. This endpoint is very useful if you need to crop and display
- * remote images in your app or in case you want to make sure a 3rd party
- * image is properly served using a TLS protocol.
- *
- * When one dimension is specified and the other is 0, the image is scaled
- * with preserved aspect ratio. If both dimensions are 0, the API provides an
- * image at source quality. If dimensions are not specified, the default size
- * of image returned is 400x400px.
- *
- *
- * @param {string} url
- * @param {number} width
- * @param {number} height
- * @throws {AppwriteException}
- * @returns {URL}
- */
- getImage(url: string, width?: number, height?: number): URL {
- if (typeof url === 'undefined') {
- throw new AppwriteException('Missing required parameter: "url"');
- }
-
- let path = '/avatars/image';
- let payload: Payload = {};
-
- if (typeof url !== 'undefined') {
- payload['url'] = url;
- }
-
- if (typeof width !== 'undefined') {
- payload['width'] = width;
- }
-
- if (typeof height !== 'undefined') {
- payload['height'] = height;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- payload['project'] = this.client.config.project;
-
-
- for (const [key, value] of Object.entries(Service.flatten(payload))) {
- uri.searchParams.append(key, value);
- }
- return uri;
- }
-
- /**
- * Get User Initials
- *
- * Use this endpoint to show your user initials avatar icon on your website or
- * app. By default, this route will try to print your logged-in user name or
- * email initials. You can also overwrite the user name if you pass the 'name'
- * parameter. If no name is given and no user is logged, an empty avatar will
- * be returned.
- *
- * You can use the color and background params to change the avatar colors. By
- * default, a random theme will be selected. The random theme will persist for
- * the user's initials when reloading the same theme will always return for
- * the same initials.
- *
- * When one dimension is specified and the other is 0, the image is scaled
- * with preserved aspect ratio. If both dimensions are 0, the API provides an
- * image at source quality. If dimensions are not specified, the default size
- * of image returned is 100x100px.
- *
- *
- * @param {string} name
- * @param {number} width
- * @param {number} height
- * @param {string} background
- * @throws {AppwriteException}
- * @returns {URL}
- */
- getInitials(name?: string, width?: number, height?: number, background?: string): URL {
- let path = '/avatars/initials';
- let payload: Payload = {};
-
- if (typeof name !== 'undefined') {
- payload['name'] = name;
- }
-
- if (typeof width !== 'undefined') {
- payload['width'] = width;
- }
-
- if (typeof height !== 'undefined') {
- payload['height'] = height;
- }
-
- if (typeof background !== 'undefined') {
- payload['background'] = background;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- payload['project'] = this.client.config.project;
-
-
- for (const [key, value] of Object.entries(Service.flatten(payload))) {
- uri.searchParams.append(key, value);
- }
- return uri;
- }
-
- /**
- * Get QR Code
- *
- * Converts a given plain text to a QR code image. You can use the query
- * parameters to change the size and style of the resulting image.
- *
- *
- * @param {string} text
- * @param {number} size
- * @param {number} margin
- * @param {boolean} download
- * @throws {AppwriteException}
- * @returns {URL}
- */
- getQR(text: string, size?: number, margin?: number, download?: boolean): URL {
- if (typeof text === 'undefined') {
- throw new AppwriteException('Missing required parameter: "text"');
- }
-
- let path = '/avatars/qr';
- let payload: Payload = {};
-
- if (typeof text !== 'undefined') {
- payload['text'] = text;
- }
-
- if (typeof size !== 'undefined') {
- payload['size'] = size;
- }
-
- if (typeof margin !== 'undefined') {
- payload['margin'] = margin;
- }
-
- if (typeof download !== 'undefined') {
- payload['download'] = download;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- payload['project'] = this.client.config.project;
-
-
- for (const [key, value] of Object.entries(Service.flatten(payload))) {
- uri.searchParams.append(key, value);
- }
- return uri;
+ /**
+ * Get browser icon
+ *
+ * You can use this endpoint to show different browser icons to your users.
+ * The code argument receives the browser code as it appears in your user [GET
+ * /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions)
+ * endpoint. Use width, height and quality arguments to change the output
+ * settings.
+ *
+ * When one dimension is specified and the other is 0, the image is scaled
+ * with preserved aspect ratio. If both dimensions are 0, the API provides an
+ * image at source quality. If dimensions are not specified, the default size
+ * of image returned is 100x100px.
+ *
+ * @param {string} code
+ * @param {number} width
+ * @param {number} height
+ * @param {number} quality
+ * @throws {AppwriteException}
+ * @returns {URL}
+ */
+ getBrowser(code: string, width?: number, height?: number, quality?: number): URL {
+ if (typeof code === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "code"');
}
+
+ const apiPath = '/avatars/browsers/{code}'.replace('{code}', code);
+ const payload: Payload = {};
+
+ if (typeof width !== 'undefined') {
+ payload['width'] = width;
+ }
+
+ if (typeof height !== 'undefined') {
+ payload['height'] = height;
+ }
+
+ if (typeof quality !== 'undefined') {
+ payload['quality'] = quality;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ payload['project'] = this.client.config.project;
+
+
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
+ uri.searchParams.append(key, value);
+ }
+ return uri;
+ }
+
+ /**
+ * Get credit card icon
+ *
+ * The credit card endpoint will return you the icon of the credit card
+ * provider you need. Use width, height and quality arguments to change the
+ * output settings.
+ *
+ * When one dimension is specified and the other is 0, the image is scaled
+ * with preserved aspect ratio. If both dimensions are 0, the API provides an
+ * image at source quality. If dimensions are not specified, the default size
+ * of image returned is 100x100px.
+ *
+ *
+ * @param {string} code
+ * @param {number} width
+ * @param {number} height
+ * @param {number} quality
+ * @throws {AppwriteException}
+ * @returns {URL}
+ */
+ getCreditCard(code: string, width?: number, height?: number, quality?: number): URL {
+ if (typeof code === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "code"');
+ }
+
+ const apiPath = '/avatars/credit-cards/{code}'.replace('{code}', code);
+ const payload: Payload = {};
+
+ if (typeof width !== 'undefined') {
+ payload['width'] = width;
+ }
+
+ if (typeof height !== 'undefined') {
+ payload['height'] = height;
+ }
+
+ if (typeof quality !== 'undefined') {
+ payload['quality'] = quality;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ payload['project'] = this.client.config.project;
+
+
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
+ uri.searchParams.append(key, value);
+ }
+ return uri;
+ }
+
+ /**
+ * Get favicon
+ *
+ * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote
+ * website URL.
+ *
+ *
+ * @param {string} url
+ * @throws {AppwriteException}
+ * @returns {URL}
+ */
+ getFavicon(url: string): URL {
+ if (typeof url === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "url"');
+ }
+
+ const apiPath = '/avatars/favicon';
+ const payload: Payload = {};
+
+ if (typeof url !== 'undefined') {
+ payload['url'] = url;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ payload['project'] = this.client.config.project;
+
+
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
+ uri.searchParams.append(key, value);
+ }
+ return uri;
+ }
+
+ /**
+ * Get country flag
+ *
+ * You can use this endpoint to show different country flags icons to your
+ * users. The code argument receives the 2 letter country code. Use width,
+ * height and quality arguments to change the output settings. Country codes
+ * follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard.
+ *
+ * When one dimension is specified and the other is 0, the image is scaled
+ * with preserved aspect ratio. If both dimensions are 0, the API provides an
+ * image at source quality. If dimensions are not specified, the default size
+ * of image returned is 100x100px.
+ *
+ *
+ * @param {string} code
+ * @param {number} width
+ * @param {number} height
+ * @param {number} quality
+ * @throws {AppwriteException}
+ * @returns {URL}
+ */
+ getFlag(code: string, width?: number, height?: number, quality?: number): URL {
+ if (typeof code === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "code"');
+ }
+
+ const apiPath = '/avatars/flags/{code}'.replace('{code}', code);
+ const payload: Payload = {};
+
+ if (typeof width !== 'undefined') {
+ payload['width'] = width;
+ }
+
+ if (typeof height !== 'undefined') {
+ payload['height'] = height;
+ }
+
+ if (typeof quality !== 'undefined') {
+ payload['quality'] = quality;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ payload['project'] = this.client.config.project;
+
+
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
+ uri.searchParams.append(key, value);
+ }
+ return uri;
+ }
+
+ /**
+ * Get image from URL
+ *
+ * Use this endpoint to fetch a remote image URL and crop it to any image size
+ * you want. This endpoint is very useful if you need to crop and display
+ * remote images in your app or in case you want to make sure a 3rd party
+ * image is properly served using a TLS protocol.
+ *
+ * When one dimension is specified and the other is 0, the image is scaled
+ * with preserved aspect ratio. If both dimensions are 0, the API provides an
+ * image at source quality. If dimensions are not specified, the default size
+ * of image returned is 400x400px.
+ *
+ *
+ * @param {string} url
+ * @param {number} width
+ * @param {number} height
+ * @throws {AppwriteException}
+ * @returns {URL}
+ */
+ getImage(url: string, width?: number, height?: number): URL {
+ if (typeof url === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "url"');
+ }
+
+ const apiPath = '/avatars/image';
+ const payload: Payload = {};
+
+ if (typeof url !== 'undefined') {
+ payload['url'] = url;
+ }
+
+ if (typeof width !== 'undefined') {
+ payload['width'] = width;
+ }
+
+ if (typeof height !== 'undefined') {
+ payload['height'] = height;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ payload['project'] = this.client.config.project;
+
+
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
+ uri.searchParams.append(key, value);
+ }
+ return uri;
+ }
+
+ /**
+ * Get user initials
+ *
+ * Use this endpoint to show your user initials avatar icon on your website or
+ * app. By default, this route will try to print your logged-in user name or
+ * email initials. You can also overwrite the user name if you pass the 'name'
+ * parameter. If no name is given and no user is logged, an empty avatar will
+ * be returned.
+ *
+ * You can use the color and background params to change the avatar colors. By
+ * default, a random theme will be selected. The random theme will persist for
+ * the user's initials when reloading the same theme will always return for
+ * the same initials.
+ *
+ * When one dimension is specified and the other is 0, the image is scaled
+ * with preserved aspect ratio. If both dimensions are 0, the API provides an
+ * image at source quality. If dimensions are not specified, the default size
+ * of image returned is 100x100px.
+ *
+ *
+ * @param {string} name
+ * @param {number} width
+ * @param {number} height
+ * @param {string} background
+ * @throws {AppwriteException}
+ * @returns {URL}
+ */
+ getInitials(name?: string, width?: number, height?: number, background?: string): URL {
+ const apiPath = '/avatars/initials';
+ const payload: Payload = {};
+
+ if (typeof name !== 'undefined') {
+ payload['name'] = name;
+ }
+
+ if (typeof width !== 'undefined') {
+ payload['width'] = width;
+ }
+
+ if (typeof height !== 'undefined') {
+ payload['height'] = height;
+ }
+
+ if (typeof background !== 'undefined') {
+ payload['background'] = background;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ payload['project'] = this.client.config.project;
+
+
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
+ uri.searchParams.append(key, value);
+ }
+ return uri;
+ }
+
+ /**
+ * Get QR code
+ *
+ * Converts a given plain text to a QR code image. You can use the query
+ * parameters to change the size and style of the resulting image.
+ *
+ *
+ * @param {string} text
+ * @param {number} size
+ * @param {number} margin
+ * @param {boolean} download
+ * @throws {AppwriteException}
+ * @returns {URL}
+ */
+ getQR(text: string, size?: number, margin?: number, download?: boolean): URL {
+ if (typeof text === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "text"');
+ }
+
+ const apiPath = '/avatars/qr';
+ const payload: Payload = {};
+
+ if (typeof text !== 'undefined') {
+ payload['text'] = text;
+ }
+
+ if (typeof size !== 'undefined') {
+ payload['size'] = size;
+ }
+
+ if (typeof margin !== 'undefined') {
+ payload['margin'] = margin;
+ }
+
+ if (typeof download !== 'undefined') {
+ payload['download'] = download;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ payload['project'] = this.client.config.project;
+
+
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
+ uri.searchParams.append(key, value);
+ }
+ return uri;
+ }
};
diff --git a/src/services/console.ts b/src/services/console.ts
index a091cb5..4ac795c 100644
--- a/src/services/console.ts
+++ b/src/services/console.ts
@@ -10,21 +10,21 @@ export class Console extends Service {
super(client);
}
- /**
- * Get Variables
- *
- * Get all Environment Variables that are relevant for the console.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async variables(): Promise {
- let path = '/console/variables';
- let payload: Payload = {};
+ /**
+ * Get variables
+ *
+ * Get all Environment Variables that are relevant for the console.
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async variables(): Promise {
+ const apiPath = '/console/variables';
+ const payload: Payload = {};
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
};
diff --git a/src/services/databases.ts b/src/services/databases.ts
index d073479..aa7da7f 100644
--- a/src/services/databases.ts
+++ b/src/services/databases.ts
@@ -10,2145 +10,2175 @@ export class Databases extends Service {
super(client);
}
- /**
- * List Databases
- *
- * Get a list of all databases from the current Appwrite project. You can use
- * the search parameter to filter your results.
- *
- * @param {string[]} queries
- * @param {string} search
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async list(queries?: string[], search?: string): Promise {
- let path = '/databases';
- let payload: Payload = {};
-
- if (typeof queries !== 'undefined') {
- payload['queries'] = queries;
- }
-
- if (typeof search !== 'undefined') {
- payload['search'] = search;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create Database
- *
- * Create a new Database.
- *
- *
- * @param {string} databaseId
- * @param {string} name
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async create(databaseId: string, name: string): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof name === 'undefined') {
- throw new AppwriteException('Missing required parameter: "name"');
- }
-
- let path = '/databases';
- let payload: Payload = {};
-
- if (typeof databaseId !== 'undefined') {
- payload['databaseId'] = databaseId;
- }
-
- if (typeof name !== 'undefined') {
- payload['name'] = name;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Get usage stats for the database
- *
- *
- * @param {string} range
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getUsage(range?: string): Promise {
- let path = '/databases/usage';
- let payload: Payload = {};
-
- if (typeof range !== 'undefined') {
- payload['range'] = range;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Get Database
- *
- * Get a database by its unique ID. This endpoint response returns a JSON
- * object with the database metadata.
- *
- * @param {string} databaseId
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async get(databaseId: string): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- let path = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Update Database
- *
- * Update a database by its unique ID.
- *
- * @param {string} databaseId
- * @param {string} name
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async update(databaseId: string, name: string): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof name === 'undefined') {
- throw new AppwriteException('Missing required parameter: "name"');
- }
-
- let path = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
- let payload: Payload = {};
-
- if (typeof name !== 'undefined') {
- payload['name'] = name;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('put', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Delete Database
- *
- * Delete a database by its unique ID. Only API keys with with databases.write
- * scope can delete a database.
- *
- * @param {string} databaseId
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async delete(databaseId: string): Promise<{}> {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- let path = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('delete', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * List Collections
- *
- * Get a list of all collections that belong to the provided databaseId. You
- * can use the search parameter to filter your results.
- *
- * @param {string} databaseId
- * @param {string[]} queries
- * @param {string} search
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async listCollections(databaseId: string, queries?: string[], search?: string): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- let path = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
- let payload: Payload = {};
-
- if (typeof queries !== 'undefined') {
- payload['queries'] = queries;
- }
-
- if (typeof search !== 'undefined') {
- payload['search'] = search;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create Collection
- *
- * Create a new Collection. Before using this route, you should create a new
- * database resource using either a [server
- * integration](/docs/server/databases#databasesCreateCollection) API or
- * directly from your database console.
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} name
- * @param {string[]} permissions
- * @param {boolean} documentSecurity
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof name === 'undefined') {
- throw new AppwriteException('Missing required parameter: "name"');
- }
-
- let path = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
- let payload: Payload = {};
-
- if (typeof collectionId !== 'undefined') {
- payload['collectionId'] = collectionId;
- }
-
- if (typeof name !== 'undefined') {
- payload['name'] = name;
- }
-
- if (typeof permissions !== 'undefined') {
- payload['permissions'] = permissions;
- }
-
- if (typeof documentSecurity !== 'undefined') {
- payload['documentSecurity'] = documentSecurity;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Get Collection
- *
- * Get a collection by its unique ID. This endpoint response returns a JSON
- * object with the collection metadata.
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getCollection(databaseId: string, collectionId: string): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Update Collection
- *
- * Update a collection by its unique ID.
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} name
- * @param {string[]} permissions
- * @param {boolean} documentSecurity
- * @param {boolean} enabled
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updateCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof name === 'undefined') {
- throw new AppwriteException('Missing required parameter: "name"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
- let payload: Payload = {};
-
- if (typeof name !== 'undefined') {
- payload['name'] = name;
- }
-
- if (typeof permissions !== 'undefined') {
- payload['permissions'] = permissions;
- }
-
- if (typeof documentSecurity !== 'undefined') {
- payload['documentSecurity'] = documentSecurity;
- }
-
- if (typeof enabled !== 'undefined') {
- payload['enabled'] = enabled;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('put', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Delete Collection
- *
- * Delete a collection by its unique ID. Only users with write permissions
- * have access to delete this resource.
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async deleteCollection(databaseId: string, collectionId: string): Promise<{}> {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('delete', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * List Attributes
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async listAttributes(databaseId: string, collectionId: string): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create Boolean Attribute
- *
- * Create a boolean attribute.
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @param {boolean} required
- * @param {boolean} xdefault
- * @param {boolean} array
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- if (typeof required === 'undefined') {
- throw new AppwriteException('Missing required parameter: "required"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
- let payload: Payload = {};
-
- if (typeof key !== 'undefined') {
- payload['key'] = key;
- }
-
- if (typeof required !== 'undefined') {
- payload['required'] = required;
- }
-
- if (typeof xdefault !== 'undefined') {
- payload['default'] = xdefault;
- }
-
- if (typeof array !== 'undefined') {
- payload['array'] = array;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Update Boolean Attribute
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @param {boolean} required
- * @param {boolean} xdefault
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- if (typeof required === 'undefined') {
- throw new AppwriteException('Missing required parameter: "required"');
- }
-
- if (typeof xdefault === 'undefined') {
- throw new AppwriteException('Missing required parameter: "xdefault"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
- let payload: Payload = {};
-
- if (typeof required !== 'undefined') {
- payload['required'] = required;
- }
-
- if (typeof xdefault !== 'undefined') {
- payload['default'] = xdefault;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('patch', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create DateTime Attribute
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @param {boolean} required
- * @param {string} xdefault
- * @param {boolean} array
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- if (typeof required === 'undefined') {
- throw new AppwriteException('Missing required parameter: "required"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
- let payload: Payload = {};
-
- if (typeof key !== 'undefined') {
- payload['key'] = key;
- }
-
- if (typeof required !== 'undefined') {
- payload['required'] = required;
- }
-
- if (typeof xdefault !== 'undefined') {
- payload['default'] = xdefault;
- }
-
- if (typeof array !== 'undefined') {
- payload['array'] = array;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Update DateTime Attribute
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @param {boolean} required
- * @param {string} xdefault
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- if (typeof required === 'undefined') {
- throw new AppwriteException('Missing required parameter: "required"');
- }
-
- if (typeof xdefault === 'undefined') {
- throw new AppwriteException('Missing required parameter: "xdefault"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
- let payload: Payload = {};
-
- if (typeof required !== 'undefined') {
- payload['required'] = required;
- }
-
- if (typeof xdefault !== 'undefined') {
- payload['default'] = xdefault;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('patch', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create Email Attribute
- *
- * Create an email attribute.
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @param {boolean} required
- * @param {string} xdefault
- * @param {boolean} array
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- if (typeof required === 'undefined') {
- throw new AppwriteException('Missing required parameter: "required"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
- let payload: Payload = {};
-
- if (typeof key !== 'undefined') {
- payload['key'] = key;
- }
-
- if (typeof required !== 'undefined') {
- payload['required'] = required;
- }
-
- if (typeof xdefault !== 'undefined') {
- payload['default'] = xdefault;
- }
-
- if (typeof array !== 'undefined') {
- payload['array'] = array;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Update Email Attribute
- *
- * Update an email attribute. Changing the `default` value will not update
- * already existing documents.
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @param {boolean} required
- * @param {string} xdefault
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- if (typeof required === 'undefined') {
- throw new AppwriteException('Missing required parameter: "required"');
- }
-
- if (typeof xdefault === 'undefined') {
- throw new AppwriteException('Missing required parameter: "xdefault"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
- let payload: Payload = {};
-
- if (typeof required !== 'undefined') {
- payload['required'] = required;
- }
-
- if (typeof xdefault !== 'undefined') {
- payload['default'] = xdefault;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('patch', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create Enum Attribute
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @param {string[]} elements
- * @param {boolean} required
- * @param {string} xdefault
- * @param {boolean} array
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- if (typeof elements === 'undefined') {
- throw new AppwriteException('Missing required parameter: "elements"');
- }
-
- if (typeof required === 'undefined') {
- throw new AppwriteException('Missing required parameter: "required"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
- let payload: Payload = {};
-
- if (typeof key !== 'undefined') {
- payload['key'] = key;
- }
-
- if (typeof elements !== 'undefined') {
- payload['elements'] = elements;
- }
-
- if (typeof required !== 'undefined') {
- payload['required'] = required;
- }
-
- if (typeof xdefault !== 'undefined') {
- payload['default'] = xdefault;
- }
-
- if (typeof array !== 'undefined') {
- payload['array'] = array;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Update Enum Attribute
- *
- * Update an enum attribute. Changing the `default` value will not update
- * already existing documents.
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @param {string[]} elements
- * @param {boolean} required
- * @param {string} xdefault
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- if (typeof elements === 'undefined') {
- throw new AppwriteException('Missing required parameter: "elements"');
- }
-
- if (typeof required === 'undefined') {
- throw new AppwriteException('Missing required parameter: "required"');
- }
-
- if (typeof xdefault === 'undefined') {
- throw new AppwriteException('Missing required parameter: "xdefault"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
- let payload: Payload = {};
-
- if (typeof elements !== 'undefined') {
- payload['elements'] = elements;
- }
-
- if (typeof required !== 'undefined') {
- payload['required'] = required;
- }
-
- if (typeof xdefault !== 'undefined') {
- payload['default'] = xdefault;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('patch', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create Float Attribute
- *
- * Create a float attribute. Optionally, minimum and maximum values can be
- * provided.
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @param {boolean} required
- * @param {number} min
- * @param {number} max
- * @param {number} xdefault
- * @param {boolean} array
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- if (typeof required === 'undefined') {
- throw new AppwriteException('Missing required parameter: "required"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
- let payload: Payload = {};
-
- if (typeof key !== 'undefined') {
- payload['key'] = key;
- }
-
- if (typeof required !== 'undefined') {
- payload['required'] = required;
- }
-
- if (typeof min !== 'undefined') {
- payload['min'] = min;
- }
-
- if (typeof max !== 'undefined') {
- payload['max'] = max;
- }
-
- if (typeof xdefault !== 'undefined') {
- payload['default'] = xdefault;
- }
-
- if (typeof array !== 'undefined') {
- payload['array'] = array;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Update Float Attribute
- *
- * Update a float attribute. Changing the `default` value will not update
- * already existing documents.
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @param {boolean} required
- * @param {number} min
- * @param {number} max
- * @param {number} xdefault
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- if (typeof required === 'undefined') {
- throw new AppwriteException('Missing required parameter: "required"');
- }
-
- if (typeof min === 'undefined') {
- throw new AppwriteException('Missing required parameter: "min"');
- }
-
- if (typeof max === 'undefined') {
- throw new AppwriteException('Missing required parameter: "max"');
- }
-
- if (typeof xdefault === 'undefined') {
- throw new AppwriteException('Missing required parameter: "xdefault"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
- let payload: Payload = {};
-
- if (typeof required !== 'undefined') {
- payload['required'] = required;
- }
-
- if (typeof min !== 'undefined') {
- payload['min'] = min;
- }
-
- if (typeof max !== 'undefined') {
- payload['max'] = max;
- }
-
- if (typeof xdefault !== 'undefined') {
- payload['default'] = xdefault;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('patch', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create Integer Attribute
- *
- * Create an integer attribute. Optionally, minimum and maximum values can be
- * provided.
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @param {boolean} required
- * @param {number} min
- * @param {number} max
- * @param {number} xdefault
- * @param {boolean} array
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- if (typeof required === 'undefined') {
- throw new AppwriteException('Missing required parameter: "required"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
- let payload: Payload = {};
-
- if (typeof key !== 'undefined') {
- payload['key'] = key;
- }
-
- if (typeof required !== 'undefined') {
- payload['required'] = required;
- }
-
- if (typeof min !== 'undefined') {
- payload['min'] = min;
- }
-
- if (typeof max !== 'undefined') {
- payload['max'] = max;
- }
-
- if (typeof xdefault !== 'undefined') {
- payload['default'] = xdefault;
- }
-
- if (typeof array !== 'undefined') {
- payload['array'] = array;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Update Integer Attribute
- *
- * Update an integer attribute. Changing the `default` value will not update
- * already existing documents.
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @param {boolean} required
- * @param {number} min
- * @param {number} max
- * @param {number} xdefault
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- if (typeof required === 'undefined') {
- throw new AppwriteException('Missing required parameter: "required"');
- }
-
- if (typeof min === 'undefined') {
- throw new AppwriteException('Missing required parameter: "min"');
- }
-
- if (typeof max === 'undefined') {
- throw new AppwriteException('Missing required parameter: "max"');
- }
-
- if (typeof xdefault === 'undefined') {
- throw new AppwriteException('Missing required parameter: "xdefault"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
- let payload: Payload = {};
-
- if (typeof required !== 'undefined') {
- payload['required'] = required;
- }
-
- if (typeof min !== 'undefined') {
- payload['min'] = min;
- }
-
- if (typeof max !== 'undefined') {
- payload['max'] = max;
- }
-
- if (typeof xdefault !== 'undefined') {
- payload['default'] = xdefault;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('patch', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create IP Address Attribute
- *
- * Create IP address attribute.
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @param {boolean} required
- * @param {string} xdefault
- * @param {boolean} array
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- if (typeof required === 'undefined') {
- throw new AppwriteException('Missing required parameter: "required"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
- let payload: Payload = {};
-
- if (typeof key !== 'undefined') {
- payload['key'] = key;
- }
-
- if (typeof required !== 'undefined') {
- payload['required'] = required;
- }
-
- if (typeof xdefault !== 'undefined') {
- payload['default'] = xdefault;
- }
-
- if (typeof array !== 'undefined') {
- payload['array'] = array;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Update IP Address Attribute
- *
- * Update an ip attribute. Changing the `default` value will not update
- * already existing documents.
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @param {boolean} required
- * @param {string} xdefault
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- if (typeof required === 'undefined') {
- throw new AppwriteException('Missing required parameter: "required"');
- }
-
- if (typeof xdefault === 'undefined') {
- throw new AppwriteException('Missing required parameter: "xdefault"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
- let payload: Payload = {};
-
- if (typeof required !== 'undefined') {
- payload['required'] = required;
- }
-
- if (typeof xdefault !== 'undefined') {
- payload['default'] = xdefault;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('patch', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create Relationship Attribute
- *
- * Create relationship attribute. [Learn more about relationship
- * attributes](/docs/databases-relationships#relationship-attributes).
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} relatedCollectionId
- * @param {string} type
- * @param {boolean} twoWay
- * @param {string} key
- * @param {string} twoWayKey
- * @param {string} onDelete
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createRelationshipAttribute(databaseId: string, collectionId: string, relatedCollectionId: string, type: string, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: string): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof relatedCollectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "relatedCollectionId"');
- }
-
- if (typeof type === 'undefined') {
- throw new AppwriteException('Missing required parameter: "type"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
- let payload: Payload = {};
-
- if (typeof relatedCollectionId !== 'undefined') {
- payload['relatedCollectionId'] = relatedCollectionId;
- }
-
- if (typeof type !== 'undefined') {
- payload['type'] = type;
- }
-
- if (typeof twoWay !== 'undefined') {
- payload['twoWay'] = twoWay;
- }
-
- if (typeof key !== 'undefined') {
- payload['key'] = key;
- }
-
- if (typeof twoWayKey !== 'undefined') {
- payload['twoWayKey'] = twoWayKey;
- }
-
- if (typeof onDelete !== 'undefined') {
- payload['onDelete'] = onDelete;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create String Attribute
- *
- * Create a string attribute.
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @param {number} size
- * @param {boolean} required
- * @param {string} xdefault
- * @param {boolean} array
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- if (typeof size === 'undefined') {
- throw new AppwriteException('Missing required parameter: "size"');
- }
-
- if (typeof required === 'undefined') {
- throw new AppwriteException('Missing required parameter: "required"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
- let payload: Payload = {};
-
- if (typeof key !== 'undefined') {
- payload['key'] = key;
- }
-
- if (typeof size !== 'undefined') {
- payload['size'] = size;
- }
-
- if (typeof required !== 'undefined') {
- payload['required'] = required;
- }
-
- if (typeof xdefault !== 'undefined') {
- payload['default'] = xdefault;
- }
-
- if (typeof array !== 'undefined') {
- payload['array'] = array;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Update String Attribute
- *
- * Update a string attribute. Changing the `default` value will not update
- * already existing documents.
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @param {boolean} required
- * @param {string} xdefault
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- if (typeof required === 'undefined') {
- throw new AppwriteException('Missing required parameter: "required"');
- }
-
- if (typeof xdefault === 'undefined') {
- throw new AppwriteException('Missing required parameter: "xdefault"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
- let payload: Payload = {};
-
- if (typeof required !== 'undefined') {
- payload['required'] = required;
- }
-
- if (typeof xdefault !== 'undefined') {
- payload['default'] = xdefault;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('patch', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create URL Attribute
- *
- * Create a URL attribute.
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @param {boolean} required
- * @param {string} xdefault
- * @param {boolean} array
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- if (typeof required === 'undefined') {
- throw new AppwriteException('Missing required parameter: "required"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
- let payload: Payload = {};
-
- if (typeof key !== 'undefined') {
- payload['key'] = key;
- }
-
- if (typeof required !== 'undefined') {
- payload['required'] = required;
- }
-
- if (typeof xdefault !== 'undefined') {
- payload['default'] = xdefault;
- }
-
- if (typeof array !== 'undefined') {
- payload['array'] = array;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Update URL Attribute
- *
- * Update an url attribute. Changing the `default` value will not update
- * already existing documents.
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @param {boolean} required
- * @param {string} xdefault
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- if (typeof required === 'undefined') {
- throw new AppwriteException('Missing required parameter: "required"');
- }
-
- if (typeof xdefault === 'undefined') {
- throw new AppwriteException('Missing required parameter: "xdefault"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
- let payload: Payload = {};
-
- if (typeof required !== 'undefined') {
- payload['required'] = required;
- }
-
- if (typeof xdefault !== 'undefined') {
- payload['default'] = xdefault;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('patch', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Get Attribute
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getAttribute(databaseId: string, collectionId: string, key: string): Promise<{}> {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Delete Attribute
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async deleteAttribute(databaseId: string, collectionId: string, key: string): Promise<{}> {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('delete', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Update Relationship Attribute
- *
- * Update relationship attribute. [Learn more about relationship
- * attributes](/docs/databases-relationships#relationship-attributes).
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @param {string} onDelete
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: string): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
- let payload: Payload = {};
-
- if (typeof onDelete !== 'undefined') {
- payload['onDelete'] = onDelete;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('patch', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * List Documents
- *
- * Get a list of all the user's documents in a given collection. You can use
- * the query params to filter your results.
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string[]} queries
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async listDocuments(databaseId: string, collectionId: string, queries?: string[]): Promise> {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
- let payload: Payload = {};
-
- if (typeof queries !== 'undefined') {
- payload['queries'] = queries;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create Document
- *
- * Create a new Document. Before using this route, you should create a new
- * collection resource using either a [server
- * integration](/docs/server/databases#databasesCreateCollection) API or
- * directly from your database console.
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} documentId
- * @param {Omit} data
- * @param {string[]} permissions
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createDocument(databaseId: string, collectionId: string, documentId: string, data: Omit, permissions?: string[]): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof documentId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "documentId"');
- }
-
- if (typeof data === 'undefined') {
- throw new AppwriteException('Missing required parameter: "data"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
- let payload: Payload = {};
-
- if (typeof documentId !== 'undefined') {
- payload['documentId'] = documentId;
- }
-
- if (typeof data !== 'undefined') {
- payload['data'] = data;
- }
-
- if (typeof permissions !== 'undefined') {
- payload['permissions'] = permissions;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Get Document
- *
- * Get a document by its unique ID. This endpoint response returns a JSON
- * object with the document data.
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} documentId
- * @param {string[]} queries
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getDocument(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof documentId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "documentId"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
- let payload: Payload = {};
-
- if (typeof queries !== 'undefined') {
- payload['queries'] = queries;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Update Document
- *
- * Update a document by its unique ID. Using the patch method you can pass
- * only specific fields that will get updated.
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} documentId
- * @param {Partial>} data
- * @param {string[]} permissions
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updateDocument(databaseId: string, collectionId: string, documentId: string, data?: Partial>, permissions?: string[]): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof documentId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "documentId"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
- let payload: Payload = {};
-
- if (typeof data !== 'undefined') {
- payload['data'] = data;
- }
-
- if (typeof permissions !== 'undefined') {
- payload['permissions'] = permissions;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('patch', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Delete Document
- *
- * Delete a document by its unique ID.
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} documentId
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<{}> {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof documentId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "documentId"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('delete', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * List Document Logs
- *
- * Get the document activity logs list by its unique ID.
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} documentId
- * @param {string[]} queries
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async listDocumentLogs(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof documentId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "documentId"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/logs'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
- let payload: Payload = {};
-
- if (typeof queries !== 'undefined') {
- payload['queries'] = queries;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * List Indexes
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async listIndexes(databaseId: string, collectionId: string): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Create Index
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @param {string} type
- * @param {string[]} attributes
- * @param {string[]} orders
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createIndex(databaseId: string, collectionId: string, key: string, type: string, attributes: string[], orders?: string[]): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- if (typeof type === 'undefined') {
- throw new AppwriteException('Missing required parameter: "type"');
- }
-
- if (typeof attributes === 'undefined') {
- throw new AppwriteException('Missing required parameter: "attributes"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
- let payload: Payload = {};
-
- if (typeof key !== 'undefined') {
- payload['key'] = key;
- }
-
- if (typeof type !== 'undefined') {
- payload['type'] = type;
- }
-
- if (typeof attributes !== 'undefined') {
- payload['attributes'] = attributes;
- }
-
- if (typeof orders !== 'undefined') {
- payload['orders'] = orders;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Get Index
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getIndex(databaseId: string, collectionId: string, key: string): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Delete Index
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} key
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async deleteIndex(databaseId: string, collectionId: string, key: string): Promise<{}> {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('delete', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * List Collection Logs
- *
- * Get the collection activity logs list by its unique ID.
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string[]} queries
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async listCollectionLogs(databaseId: string, collectionId: string, queries?: string[]): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/logs'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
- let payload: Payload = {};
-
- if (typeof queries !== 'undefined') {
- payload['queries'] = queries;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Get usage stats for a collection
- *
- *
- * @param {string} databaseId
- * @param {string} collectionId
- * @param {string} range
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getCollectionUsage(databaseId: string, collectionId: string, range?: string): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- if (typeof collectionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "collectionId"');
- }
-
- let path = '/databases/{databaseId}/collections/{collectionId}/usage'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
- let payload: Payload = {};
-
- if (typeof range !== 'undefined') {
- payload['range'] = range;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * List Database Logs
- *
- * Get the database activity logs list by its unique ID.
- *
- * @param {string} databaseId
- * @param {string[]} queries
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async listLogs(databaseId: string, queries?: string[]): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- let path = '/databases/{databaseId}/logs'.replace('{databaseId}', databaseId);
- let payload: Payload = {};
-
- if (typeof queries !== 'undefined') {
- payload['queries'] = queries;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * Get usage stats for the database
- *
- *
- * @param {string} databaseId
- * @param {string} range
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getDatabaseUsage(databaseId: string, range?: string): Promise {
- if (typeof databaseId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "databaseId"');
- }
-
- let path = '/databases/{databaseId}/usage'.replace('{databaseId}', databaseId);
- let payload: Payload = {};
-
- if (typeof range !== 'undefined') {
- payload['range'] = range;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
+ /**
+ * List databases
+ *
+ * Get a list of all databases from the current Appwrite project. You can use
+ * the search parameter to filter your results.
+ *
+ * @param {string[]} queries
+ * @param {string} search
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async list(queries?: string[], search?: string): Promise {
+ const apiPath = '/databases';
+ const payload: Payload = {};
+
+ if (typeof queries !== 'undefined') {
+ payload['queries'] = queries;
}
+
+ if (typeof search !== 'undefined') {
+ payload['search'] = search;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create database
+ *
+ * Create a new Database.
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} name
+ * @param {boolean} enabled
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async create(databaseId: string, name: string, enabled?: boolean): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof name === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "name"');
+ }
+
+ const apiPath = '/databases';
+ const payload: Payload = {};
+
+ if (typeof databaseId !== 'undefined') {
+ payload['databaseId'] = databaseId;
+ }
+
+ if (typeof name !== 'undefined') {
+ payload['name'] = name;
+ }
+
+ if (typeof enabled !== 'undefined') {
+ payload['enabled'] = enabled;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get usage stats for the database
+ *
+ *
+ * @param {string} range
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getUsage(range?: string): Promise {
+ const apiPath = '/databases/usage';
+ const payload: Payload = {};
+
+ if (typeof range !== 'undefined') {
+ payload['range'] = range;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get database
+ *
+ * Get a database by its unique ID. This endpoint response returns a JSON
+ * object with the database metadata.
+ *
+ * @param {string} databaseId
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async get(databaseId: string): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update database
+ *
+ * Update a database by its unique ID.
+ *
+ * @param {string} databaseId
+ * @param {string} name
+ * @param {boolean} enabled
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async update(databaseId: string, name: string, enabled?: boolean): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof name === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "name"');
+ }
+
+ const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
+ const payload: Payload = {};
+
+ if (typeof name !== 'undefined') {
+ payload['name'] = name;
+ }
+
+ if (typeof enabled !== 'undefined') {
+ payload['enabled'] = enabled;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('put', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Delete database
+ *
+ * Delete a database by its unique ID. Only API keys with with databases.write
+ * scope can delete a database.
+ *
+ * @param {string} databaseId
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async delete(databaseId: string): Promise<{}> {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('delete', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * List collections
+ *
+ * Get a list of all collections that belong to the provided databaseId. You
+ * can use the search parameter to filter your results.
+ *
+ * @param {string} databaseId
+ * @param {string[]} queries
+ * @param {string} search
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async listCollections(databaseId: string, queries?: string[], search?: string): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
+ const payload: Payload = {};
+
+ if (typeof queries !== 'undefined') {
+ payload['queries'] = queries;
+ }
+
+ if (typeof search !== 'undefined') {
+ payload['search'] = search;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create collection
+ *
+ * Create a new Collection. Before using this route, you should create a new
+ * database resource using either a [server
+ * integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
+ * API or directly from your database console.
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} name
+ * @param {string[]} permissions
+ * @param {boolean} documentSecurity
+ * @param {boolean} enabled
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof name === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "name"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
+ const payload: Payload = {};
+
+ if (typeof collectionId !== 'undefined') {
+ payload['collectionId'] = collectionId;
+ }
+
+ if (typeof name !== 'undefined') {
+ payload['name'] = name;
+ }
+
+ if (typeof permissions !== 'undefined') {
+ payload['permissions'] = permissions;
+ }
+
+ if (typeof documentSecurity !== 'undefined') {
+ payload['documentSecurity'] = documentSecurity;
+ }
+
+ if (typeof enabled !== 'undefined') {
+ payload['enabled'] = enabled;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get collection
+ *
+ * Get a collection by its unique ID. This endpoint response returns a JSON
+ * object with the collection metadata.
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getCollection(databaseId: string, collectionId: string): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update collection
+ *
+ * Update a collection by its unique ID.
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} name
+ * @param {string[]} permissions
+ * @param {boolean} documentSecurity
+ * @param {boolean} enabled
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updateCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof name === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "name"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
+ const payload: Payload = {};
+
+ if (typeof name !== 'undefined') {
+ payload['name'] = name;
+ }
+
+ if (typeof permissions !== 'undefined') {
+ payload['permissions'] = permissions;
+ }
+
+ if (typeof documentSecurity !== 'undefined') {
+ payload['documentSecurity'] = documentSecurity;
+ }
+
+ if (typeof enabled !== 'undefined') {
+ payload['enabled'] = enabled;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('put', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Delete collection
+ *
+ * Delete a collection by its unique ID. Only users with write permissions
+ * have access to delete this resource.
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async deleteCollection(databaseId: string, collectionId: string): Promise<{}> {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('delete', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * List attributes
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string[]} queries
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async listAttributes(databaseId: string, collectionId: string, queries?: string[]): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
+ const payload: Payload = {};
+
+ if (typeof queries !== 'undefined') {
+ payload['queries'] = queries;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create boolean attribute
+ *
+ * Create a boolean attribute.
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @param {boolean} required
+ * @param {boolean} xdefault
+ * @param {boolean} array
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ if (typeof required === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "required"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
+ const payload: Payload = {};
+
+ if (typeof key !== 'undefined') {
+ payload['key'] = key;
+ }
+
+ if (typeof required !== 'undefined') {
+ payload['required'] = required;
+ }
+
+ if (typeof xdefault !== 'undefined') {
+ payload['default'] = xdefault;
+ }
+
+ if (typeof array !== 'undefined') {
+ payload['array'] = array;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update boolean attribute
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @param {boolean} required
+ * @param {boolean} xdefault
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ if (typeof required === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "required"');
+ }
+
+ if (typeof xdefault === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "xdefault"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
+ const payload: Payload = {};
+
+ if (typeof required !== 'undefined') {
+ payload['required'] = required;
+ }
+
+ if (typeof xdefault !== 'undefined') {
+ payload['default'] = xdefault;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('patch', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create datetime attribute
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @param {boolean} required
+ * @param {string} xdefault
+ * @param {boolean} array
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ if (typeof required === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "required"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
+ const payload: Payload = {};
+
+ if (typeof key !== 'undefined') {
+ payload['key'] = key;
+ }
+
+ if (typeof required !== 'undefined') {
+ payload['required'] = required;
+ }
+
+ if (typeof xdefault !== 'undefined') {
+ payload['default'] = xdefault;
+ }
+
+ if (typeof array !== 'undefined') {
+ payload['array'] = array;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update dateTime attribute
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @param {boolean} required
+ * @param {string} xdefault
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ if (typeof required === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "required"');
+ }
+
+ if (typeof xdefault === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "xdefault"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
+ const payload: Payload = {};
+
+ if (typeof required !== 'undefined') {
+ payload['required'] = required;
+ }
+
+ if (typeof xdefault !== 'undefined') {
+ payload['default'] = xdefault;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('patch', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create email attribute
+ *
+ * Create an email attribute.
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @param {boolean} required
+ * @param {string} xdefault
+ * @param {boolean} array
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ if (typeof required === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "required"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
+ const payload: Payload = {};
+
+ if (typeof key !== 'undefined') {
+ payload['key'] = key;
+ }
+
+ if (typeof required !== 'undefined') {
+ payload['required'] = required;
+ }
+
+ if (typeof xdefault !== 'undefined') {
+ payload['default'] = xdefault;
+ }
+
+ if (typeof array !== 'undefined') {
+ payload['array'] = array;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update email attribute
+ *
+ * Update an email attribute. Changing the `default` value will not update
+ * already existing documents.
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @param {boolean} required
+ * @param {string} xdefault
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ if (typeof required === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "required"');
+ }
+
+ if (typeof xdefault === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "xdefault"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
+ const payload: Payload = {};
+
+ if (typeof required !== 'undefined') {
+ payload['required'] = required;
+ }
+
+ if (typeof xdefault !== 'undefined') {
+ payload['default'] = xdefault;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('patch', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create enum attribute
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @param {string[]} elements
+ * @param {boolean} required
+ * @param {string} xdefault
+ * @param {boolean} array
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ if (typeof elements === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "elements"');
+ }
+
+ if (typeof required === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "required"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
+ const payload: Payload = {};
+
+ if (typeof key !== 'undefined') {
+ payload['key'] = key;
+ }
+
+ if (typeof elements !== 'undefined') {
+ payload['elements'] = elements;
+ }
+
+ if (typeof required !== 'undefined') {
+ payload['required'] = required;
+ }
+
+ if (typeof xdefault !== 'undefined') {
+ payload['default'] = xdefault;
+ }
+
+ if (typeof array !== 'undefined') {
+ payload['array'] = array;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update enum attribute
+ *
+ * Update an enum attribute. Changing the `default` value will not update
+ * already existing documents.
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @param {string[]} elements
+ * @param {boolean} required
+ * @param {string} xdefault
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ if (typeof elements === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "elements"');
+ }
+
+ if (typeof required === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "required"');
+ }
+
+ if (typeof xdefault === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "xdefault"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
+ const payload: Payload = {};
+
+ if (typeof elements !== 'undefined') {
+ payload['elements'] = elements;
+ }
+
+ if (typeof required !== 'undefined') {
+ payload['required'] = required;
+ }
+
+ if (typeof xdefault !== 'undefined') {
+ payload['default'] = xdefault;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('patch', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create float attribute
+ *
+ * Create a float attribute. Optionally, minimum and maximum values can be
+ * provided.
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @param {boolean} required
+ * @param {number} min
+ * @param {number} max
+ * @param {number} xdefault
+ * @param {boolean} array
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ if (typeof required === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "required"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
+ const payload: Payload = {};
+
+ if (typeof key !== 'undefined') {
+ payload['key'] = key;
+ }
+
+ if (typeof required !== 'undefined') {
+ payload['required'] = required;
+ }
+
+ if (typeof min !== 'undefined') {
+ payload['min'] = min;
+ }
+
+ if (typeof max !== 'undefined') {
+ payload['max'] = max;
+ }
+
+ if (typeof xdefault !== 'undefined') {
+ payload['default'] = xdefault;
+ }
+
+ if (typeof array !== 'undefined') {
+ payload['array'] = array;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update float attribute
+ *
+ * Update a float attribute. Changing the `default` value will not update
+ * already existing documents.
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @param {boolean} required
+ * @param {number} min
+ * @param {number} max
+ * @param {number} xdefault
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ if (typeof required === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "required"');
+ }
+
+ if (typeof min === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "min"');
+ }
+
+ if (typeof max === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "max"');
+ }
+
+ if (typeof xdefault === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "xdefault"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
+ const payload: Payload = {};
+
+ if (typeof required !== 'undefined') {
+ payload['required'] = required;
+ }
+
+ if (typeof min !== 'undefined') {
+ payload['min'] = min;
+ }
+
+ if (typeof max !== 'undefined') {
+ payload['max'] = max;
+ }
+
+ if (typeof xdefault !== 'undefined') {
+ payload['default'] = xdefault;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('patch', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create integer attribute
+ *
+ * Create an integer attribute. Optionally, minimum and maximum values can be
+ * provided.
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @param {boolean} required
+ * @param {number} min
+ * @param {number} max
+ * @param {number} xdefault
+ * @param {boolean} array
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ if (typeof required === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "required"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
+ const payload: Payload = {};
+
+ if (typeof key !== 'undefined') {
+ payload['key'] = key;
+ }
+
+ if (typeof required !== 'undefined') {
+ payload['required'] = required;
+ }
+
+ if (typeof min !== 'undefined') {
+ payload['min'] = min;
+ }
+
+ if (typeof max !== 'undefined') {
+ payload['max'] = max;
+ }
+
+ if (typeof xdefault !== 'undefined') {
+ payload['default'] = xdefault;
+ }
+
+ if (typeof array !== 'undefined') {
+ payload['array'] = array;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update integer attribute
+ *
+ * Update an integer attribute. Changing the `default` value will not update
+ * already existing documents.
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @param {boolean} required
+ * @param {number} min
+ * @param {number} max
+ * @param {number} xdefault
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ if (typeof required === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "required"');
+ }
+
+ if (typeof min === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "min"');
+ }
+
+ if (typeof max === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "max"');
+ }
+
+ if (typeof xdefault === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "xdefault"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
+ const payload: Payload = {};
+
+ if (typeof required !== 'undefined') {
+ payload['required'] = required;
+ }
+
+ if (typeof min !== 'undefined') {
+ payload['min'] = min;
+ }
+
+ if (typeof max !== 'undefined') {
+ payload['max'] = max;
+ }
+
+ if (typeof xdefault !== 'undefined') {
+ payload['default'] = xdefault;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('patch', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create IP address attribute
+ *
+ * Create IP address attribute.
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @param {boolean} required
+ * @param {string} xdefault
+ * @param {boolean} array
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ if (typeof required === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "required"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
+ const payload: Payload = {};
+
+ if (typeof key !== 'undefined') {
+ payload['key'] = key;
+ }
+
+ if (typeof required !== 'undefined') {
+ payload['required'] = required;
+ }
+
+ if (typeof xdefault !== 'undefined') {
+ payload['default'] = xdefault;
+ }
+
+ if (typeof array !== 'undefined') {
+ payload['array'] = array;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update IP address attribute
+ *
+ * Update an ip attribute. Changing the `default` value will not update
+ * already existing documents.
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @param {boolean} required
+ * @param {string} xdefault
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ if (typeof required === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "required"');
+ }
+
+ if (typeof xdefault === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "xdefault"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
+ const payload: Payload = {};
+
+ if (typeof required !== 'undefined') {
+ payload['required'] = required;
+ }
+
+ if (typeof xdefault !== 'undefined') {
+ payload['default'] = xdefault;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('patch', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create relationship attribute
+ *
+ * Create relationship attribute. [Learn more about relationship
+ * attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} relatedCollectionId
+ * @param {string} type
+ * @param {boolean} twoWay
+ * @param {string} key
+ * @param {string} twoWayKey
+ * @param {string} onDelete
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createRelationshipAttribute(databaseId: string, collectionId: string, relatedCollectionId: string, type: string, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: string): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof relatedCollectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "relatedCollectionId"');
+ }
+
+ if (typeof type === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "type"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
+ const payload: Payload = {};
+
+ if (typeof relatedCollectionId !== 'undefined') {
+ payload['relatedCollectionId'] = relatedCollectionId;
+ }
+
+ if (typeof type !== 'undefined') {
+ payload['type'] = type;
+ }
+
+ if (typeof twoWay !== 'undefined') {
+ payload['twoWay'] = twoWay;
+ }
+
+ if (typeof key !== 'undefined') {
+ payload['key'] = key;
+ }
+
+ if (typeof twoWayKey !== 'undefined') {
+ payload['twoWayKey'] = twoWayKey;
+ }
+
+ if (typeof onDelete !== 'undefined') {
+ payload['onDelete'] = onDelete;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create string attribute
+ *
+ * Create a string attribute.
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @param {number} size
+ * @param {boolean} required
+ * @param {string} xdefault
+ * @param {boolean} array
+ * @param {boolean} encrypt
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ if (typeof size === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "size"');
+ }
+
+ if (typeof required === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "required"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
+ const payload: Payload = {};
+
+ if (typeof key !== 'undefined') {
+ payload['key'] = key;
+ }
+
+ if (typeof size !== 'undefined') {
+ payload['size'] = size;
+ }
+
+ if (typeof required !== 'undefined') {
+ payload['required'] = required;
+ }
+
+ if (typeof xdefault !== 'undefined') {
+ payload['default'] = xdefault;
+ }
+
+ if (typeof array !== 'undefined') {
+ payload['array'] = array;
+ }
+
+ if (typeof encrypt !== 'undefined') {
+ payload['encrypt'] = encrypt;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update string attribute
+ *
+ * Update a string attribute. Changing the `default` value will not update
+ * already existing documents.
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @param {boolean} required
+ * @param {string} xdefault
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ if (typeof required === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "required"');
+ }
+
+ if (typeof xdefault === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "xdefault"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
+ const payload: Payload = {};
+
+ if (typeof required !== 'undefined') {
+ payload['required'] = required;
+ }
+
+ if (typeof xdefault !== 'undefined') {
+ payload['default'] = xdefault;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('patch', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create URL attribute
+ *
+ * Create a URL attribute.
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @param {boolean} required
+ * @param {string} xdefault
+ * @param {boolean} array
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ if (typeof required === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "required"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
+ const payload: Payload = {};
+
+ if (typeof key !== 'undefined') {
+ payload['key'] = key;
+ }
+
+ if (typeof required !== 'undefined') {
+ payload['required'] = required;
+ }
+
+ if (typeof xdefault !== 'undefined') {
+ payload['default'] = xdefault;
+ }
+
+ if (typeof array !== 'undefined') {
+ payload['array'] = array;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update URL attribute
+ *
+ * Update an url attribute. Changing the `default` value will not update
+ * already existing documents.
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @param {boolean} required
+ * @param {string} xdefault
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ if (typeof required === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "required"');
+ }
+
+ if (typeof xdefault === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "xdefault"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
+ const payload: Payload = {};
+
+ if (typeof required !== 'undefined') {
+ payload['required'] = required;
+ }
+
+ if (typeof xdefault !== 'undefined') {
+ payload['default'] = xdefault;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('patch', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get attribute
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getAttribute(databaseId: string, collectionId: string, key: string): Promise<{}> {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Delete attribute
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async deleteAttribute(databaseId: string, collectionId: string, key: string): Promise<{}> {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('delete', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update relationship attribute
+ *
+ * Update relationship attribute. [Learn more about relationship
+ * attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @param {string} onDelete
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: string): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
+ const payload: Payload = {};
+
+ if (typeof onDelete !== 'undefined') {
+ payload['onDelete'] = onDelete;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('patch', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * List documents
+ *
+ * Get a list of all the user's documents in a given collection. You can use
+ * the query params to filter your results.
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string[]} queries
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async listDocuments(databaseId: string, collectionId: string, queries?: string[]): Promise> {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
+ const payload: Payload = {};
+
+ if (typeof queries !== 'undefined') {
+ payload['queries'] = queries;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create document
+ *
+ * Create a new Document. Before using this route, you should create a new
+ * collection resource using either a [server
+ * integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
+ * API or directly from your database console.
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} documentId
+ * @param {Omit} data
+ * @param {string[]} permissions
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createDocument(databaseId: string, collectionId: string, documentId: string, data: Omit, permissions?: string[]): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof documentId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "documentId"');
+ }
+
+ if (typeof data === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "data"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
+ const payload: Payload = {};
+
+ if (typeof documentId !== 'undefined') {
+ payload['documentId'] = documentId;
+ }
+
+ if (typeof data !== 'undefined') {
+ payload['data'] = data;
+ }
+
+ if (typeof permissions !== 'undefined') {
+ payload['permissions'] = permissions;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get document
+ *
+ * Get a document by its unique ID. This endpoint response returns a JSON
+ * object with the document data.
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} documentId
+ * @param {string[]} queries
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getDocument(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof documentId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "documentId"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
+ const payload: Payload = {};
+
+ if (typeof queries !== 'undefined') {
+ payload['queries'] = queries;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update document
+ *
+ * Update a document by its unique ID. Using the patch method you can pass
+ * only specific fields that will get updated.
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} documentId
+ * @param {Partial>} data
+ * @param {string[]} permissions
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updateDocument(databaseId: string, collectionId: string, documentId: string, data?: Partial>, permissions?: string[]): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof documentId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "documentId"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
+ const payload: Payload = {};
+
+ if (typeof data !== 'undefined') {
+ payload['data'] = data;
+ }
+
+ if (typeof permissions !== 'undefined') {
+ payload['permissions'] = permissions;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('patch', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Delete document
+ *
+ * Delete a document by its unique ID.
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} documentId
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<{}> {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof documentId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "documentId"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('delete', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * List document logs
+ *
+ * Get the document activity logs list by its unique ID.
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} documentId
+ * @param {string[]} queries
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async listDocumentLogs(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof documentId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "documentId"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/logs'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
+ const payload: Payload = {};
+
+ if (typeof queries !== 'undefined') {
+ payload['queries'] = queries;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * List indexes
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string[]} queries
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async listIndexes(databaseId: string, collectionId: string, queries?: string[]): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
+ const payload: Payload = {};
+
+ if (typeof queries !== 'undefined') {
+ payload['queries'] = queries;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create index
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @param {string} type
+ * @param {string[]} attributes
+ * @param {string[]} orders
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createIndex(databaseId: string, collectionId: string, key: string, type: string, attributes: string[], orders?: string[]): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ if (typeof type === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "type"');
+ }
+
+ if (typeof attributes === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "attributes"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
+ const payload: Payload = {};
+
+ if (typeof key !== 'undefined') {
+ payload['key'] = key;
+ }
+
+ if (typeof type !== 'undefined') {
+ payload['type'] = type;
+ }
+
+ if (typeof attributes !== 'undefined') {
+ payload['attributes'] = attributes;
+ }
+
+ if (typeof orders !== 'undefined') {
+ payload['orders'] = orders;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get index
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getIndex(databaseId: string, collectionId: string, key: string): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Delete index
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} key
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async deleteIndex(databaseId: string, collectionId: string, key: string): Promise<{}> {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('delete', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * List collection logs
+ *
+ * Get the collection activity logs list by its unique ID.
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string[]} queries
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async listCollectionLogs(databaseId: string, collectionId: string, queries?: string[]): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/logs'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
+ const payload: Payload = {};
+
+ if (typeof queries !== 'undefined') {
+ payload['queries'] = queries;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get usage stats for a collection
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} collectionId
+ * @param {string} range
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getCollectionUsage(databaseId: string, collectionId: string, range?: string): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ if (typeof collectionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "collectionId"');
+ }
+
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/usage'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
+ const payload: Payload = {};
+
+ if (typeof range !== 'undefined') {
+ payload['range'] = range;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * List database logs
+ *
+ * Get the database activity logs list by its unique ID.
+ *
+ * @param {string} databaseId
+ * @param {string[]} queries
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async listLogs(databaseId: string, queries?: string[]): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ const apiPath = '/databases/{databaseId}/logs'.replace('{databaseId}', databaseId);
+ const payload: Payload = {};
+
+ if (typeof queries !== 'undefined') {
+ payload['queries'] = queries;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get usage stats for the database
+ *
+ *
+ * @param {string} databaseId
+ * @param {string} range
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getDatabaseUsage(databaseId: string, range?: string): Promise {
+ if (typeof databaseId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "databaseId"');
+ }
+
+ const apiPath = '/databases/{databaseId}/usage'.replace('{databaseId}', databaseId);
+ const payload: Payload = {};
+
+ if (typeof range !== 'undefined') {
+ payload['range'] = range;
+ }
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
};
diff --git a/src/services/functions.ts b/src/services/functions.ts
index 9ace405..42c0df0 100644
--- a/src/services/functions.ts
+++ b/src/services/functions.ts
@@ -10,797 +10,944 @@ export class Functions extends Service {
super(client);
}
- /**
- * List Functions
- *
- * Get a list of all the project's functions. You can use the query params to
- * filter your results.
- *
- * @param {string[]} queries
- * @param {string} search
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async list(queries?: string[], search?: string): Promise {
- let path = '/functions';
- let payload: Payload = {};
-
- if (typeof queries !== 'undefined') {
- payload['queries'] = queries;
- }
-
- if (typeof search !== 'undefined') {
- payload['search'] = search;
- }
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
+ /**
+ * List functions
+ *
+ * Get a list of all the project's functions. You can use the query params to
+ * filter your results.
+ *
+ * @param {string[]} queries
+ * @param {string} search
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async list(queries?: string[], search?: string): Promise {
+ const apiPath = '/functions';
+ const payload: Payload = {};
+
+ if (typeof queries !== 'undefined') {
+ payload['queries'] = queries;
}
- /**
- * Create Function
- *
- * Create a new function. You can pass a list of
- * [permissions](/docs/permissions) to allow different project users or team
- * with access to execute the function using the client API.
- *
- * @param {string} functionId
- * @param {string} name
- * @param {string} runtime
- * @param {string[]} execute
- * @param {string[]} events
- * @param {string} schedule
- * @param {number} timeout
- * @param {boolean} enabled
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async create(functionId: string, name: string, runtime: string, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean): Promise {
- if (typeof functionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "functionId"');
- }
-
- if (typeof name === 'undefined') {
- throw new AppwriteException('Missing required parameter: "name"');
- }
+ if (typeof search !== 'undefined') {
+ payload['search'] = search;
+ }
- if (typeof runtime === 'undefined') {
- throw new AppwriteException('Missing required parameter: "runtime"');
- }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create function
+ *
+ * Create a new function. You can pass a list of
+ * [permissions](https://appwrite.io/docs/permissions) to allow different
+ * project users or team with access to execute the function using the client
+ * API.
+ *
+ * @param {string} functionId
+ * @param {string} name
+ * @param {string} runtime
+ * @param {string[]} execute
+ * @param {string[]} events
+ * @param {string} schedule
+ * @param {number} timeout
+ * @param {boolean} enabled
+ * @param {boolean} logging
+ * @param {string} entrypoint
+ * @param {string} commands
+ * @param {string} installationId
+ * @param {string} providerRepositoryId
+ * @param {string} providerBranch
+ * @param {boolean} providerSilentMode
+ * @param {string} providerRootDirectory
+ * @param {string} templateRepository
+ * @param {string} templateOwner
+ * @param {string} templateRootDirectory
+ * @param {string} templateBranch
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async create(functionId: string, name: string, runtime: string, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, templateRepository?: string, templateOwner?: string, templateRootDirectory?: string, templateBranch?: string): Promise {
+ if (typeof functionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "functionId"');
+ }
- let path = '/functions';
- let payload: Payload = {};
+ if (typeof name === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "name"');
+ }
- if (typeof functionId !== 'undefined') {
- payload['functionId'] = functionId;
- }
+ if (typeof runtime === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "runtime"');
+ }
- if (typeof name !== 'undefined') {
- payload['name'] = name;
- }
+ const apiPath = '/functions';
+ const payload: Payload = {};
- if (typeof execute !== 'undefined') {
- payload['execute'] = execute;
- }
+ if (typeof functionId !== 'undefined') {
+ payload['functionId'] = functionId;
+ }
- if (typeof runtime !== 'undefined') {
- payload['runtime'] = runtime;
- }
+ if (typeof name !== 'undefined') {
+ payload['name'] = name;
+ }
- if (typeof events !== 'undefined') {
- payload['events'] = events;
- }
+ if (typeof runtime !== 'undefined') {
+ payload['runtime'] = runtime;
+ }
- if (typeof schedule !== 'undefined') {
- payload['schedule'] = schedule;
- }
+ if (typeof execute !== 'undefined') {
+ payload['execute'] = execute;
+ }
- if (typeof timeout !== 'undefined') {
- payload['timeout'] = timeout;
- }
+ if (typeof events !== 'undefined') {
+ payload['events'] = events;
+ }
- if (typeof enabled !== 'undefined') {
- payload['enabled'] = enabled;
- }
+ if (typeof schedule !== 'undefined') {
+ payload['schedule'] = schedule;
+ }
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
+ if (typeof timeout !== 'undefined') {
+ payload['timeout'] = timeout;
}
- /**
- * List runtimes
- *
- * Get a list of all runtimes that are currently active on your instance.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async listRuntimes(): Promise {
- let path = '/functions/runtimes';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
+ if (typeof enabled !== 'undefined') {
+ payload['enabled'] = enabled;
}
- /**
- * Get Functions Usage
- *
- *
- * @param {string} range
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getUsage(range?: string): Promise {
- let path = '/functions/usage';
- let payload: Payload = {};
-
- if (typeof range !== 'undefined') {
- payload['range'] = range;
- }
+ if (typeof logging !== 'undefined') {
+ payload['logging'] = logging;
+ }
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
+ if (typeof entrypoint !== 'undefined') {
+ payload['entrypoint'] = entrypoint;
}
- /**
- * Get Function
- *
- * Get a function by its unique ID.
- *
- * @param {string} functionId
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async get(functionId: string): Promise {
- if (typeof functionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "functionId"');
- }
+ if (typeof commands !== 'undefined') {
+ payload['commands'] = commands;
+ }
- let path = '/functions/{functionId}'.replace('{functionId}', functionId);
- let payload: Payload = {};
+ if (typeof installationId !== 'undefined') {
+ payload['installationId'] = installationId;
+ }
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
+ if (typeof providerRepositoryId !== 'undefined') {
+ payload['providerRepositoryId'] = providerRepositoryId;
}
- /**
- * Update Function
- *
- * Update function by its unique ID.
- *
- * @param {string} functionId
- * @param {string} name
- * @param {string[]} execute
- * @param {string[]} events
- * @param {string} schedule
- * @param {number} timeout
- * @param {boolean} enabled
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async update(functionId: string, name: string, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean): Promise {
- if (typeof functionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "functionId"');
- }
+ if (typeof providerBranch !== 'undefined') {
+ payload['providerBranch'] = providerBranch;
+ }
- if (typeof name === 'undefined') {
- throw new AppwriteException('Missing required parameter: "name"');
- }
+ if (typeof providerSilentMode !== 'undefined') {
+ payload['providerSilentMode'] = providerSilentMode;
+ }
- let path = '/functions/{functionId}'.replace('{functionId}', functionId);
- let payload: Payload = {};
+ if (typeof providerRootDirectory !== 'undefined') {
+ payload['providerRootDirectory'] = providerRootDirectory;
+ }
- if (typeof name !== 'undefined') {
- payload['name'] = name;
- }
+ if (typeof templateRepository !== 'undefined') {
+ payload['templateRepository'] = templateRepository;
+ }
- if (typeof execute !== 'undefined') {
- payload['execute'] = execute;
- }
+ if (typeof templateOwner !== 'undefined') {
+ payload['templateOwner'] = templateOwner;
+ }
- if (typeof events !== 'undefined') {
- payload['events'] = events;
- }
+ if (typeof templateRootDirectory !== 'undefined') {
+ payload['templateRootDirectory'] = templateRootDirectory;
+ }
- if (typeof schedule !== 'undefined') {
- payload['schedule'] = schedule;
- }
+ if (typeof templateBranch !== 'undefined') {
+ payload['templateBranch'] = templateBranch;
+ }
- if (typeof timeout !== 'undefined') {
- payload['timeout'] = timeout;
- }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * List runtimes
+ *
+ * Get a list of all runtimes that are currently active on your instance.
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async listRuntimes(): Promise {
+ const apiPath = '/functions/runtimes';
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get functions usage
+ *
+ *
+ * @param {string} range
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getUsage(range?: string): Promise {
+ const apiPath = '/functions/usage';
+ const payload: Payload = {};
+
+ if (typeof range !== 'undefined') {
+ payload['range'] = range;
+ }
- if (typeof enabled !== 'undefined') {
- payload['enabled'] = enabled;
- }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get function
+ *
+ * Get a function by its unique ID.
+ *
+ * @param {string} functionId
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async get(functionId: string): Promise {
+ if (typeof functionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "functionId"');
+ }
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('put', uri, {
- 'content-type': 'application/json',
- }, payload);
+ const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update function
+ *
+ * Update function by its unique ID.
+ *
+ * @param {string} functionId
+ * @param {string} name
+ * @param {string} runtime
+ * @param {string[]} execute
+ * @param {string[]} events
+ * @param {string} schedule
+ * @param {number} timeout
+ * @param {boolean} enabled
+ * @param {boolean} logging
+ * @param {string} entrypoint
+ * @param {string} commands
+ * @param {string} installationId
+ * @param {string} providerRepositoryId
+ * @param {string} providerBranch
+ * @param {boolean} providerSilentMode
+ * @param {string} providerRootDirectory
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async update(functionId: string, name: string, runtime?: string, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string): Promise {
+ if (typeof functionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "functionId"');
}
- /**
- * Delete Function
- *
- * Delete a function by its unique ID.
- *
- * @param {string} functionId
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async delete(functionId: string): Promise<{}> {
- if (typeof functionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "functionId"');
- }
+ if (typeof name === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "name"');
+ }
- let path = '/functions/{functionId}'.replace('{functionId}', functionId);
- let payload: Payload = {};
+ const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
+ const payload: Payload = {};
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('delete', uri, {
- 'content-type': 'application/json',
- }, payload);
+ if (typeof name !== 'undefined') {
+ payload['name'] = name;
}
- /**
- * List Deployments
- *
- * Get a list of all the project's code deployments. You can use the query
- * params to filter your results.
- *
- * @param {string} functionId
- * @param {string[]} queries
- * @param {string} search
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async listDeployments(functionId: string, queries?: string[], search?: string): Promise {
- if (typeof functionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "functionId"');
- }
+ if (typeof runtime !== 'undefined') {
+ payload['runtime'] = runtime;
+ }
- let path = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
- let payload: Payload = {};
+ if (typeof execute !== 'undefined') {
+ payload['execute'] = execute;
+ }
- if (typeof queries !== 'undefined') {
- payload['queries'] = queries;
- }
+ if (typeof events !== 'undefined') {
+ payload['events'] = events;
+ }
- if (typeof search !== 'undefined') {
- payload['search'] = search;
- }
+ if (typeof schedule !== 'undefined') {
+ payload['schedule'] = schedule;
+ }
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
+ if (typeof timeout !== 'undefined') {
+ payload['timeout'] = timeout;
}
- /**
- * Create Deployment
- *
- * Create a new function code deployment. Use this endpoint to upload a new
- * version of your code function. To execute your newly uploaded code, you'll
- * need to update the function's deployment to use your new deployment UID.
- *
- * This endpoint accepts a tar.gz file compressed with your code. Make sure to
- * include any dependencies your code has within the compressed file. You can
- * learn more about code packaging in the [Appwrite Cloud Functions
- * tutorial](/docs/functions).
- *
- * Use the "command" param to set the entry point used to execute your code.
- *
- * @param {string} functionId
- * @param {string} entrypoint
- * @param {File} code
- * @param {boolean} activate
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createDeployment(functionId: string, entrypoint: string, code: File, activate: boolean, onProgress = (progress: UploadProgress) => {}): Promise {
- if (typeof functionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "functionId"');
- }
+ if (typeof enabled !== 'undefined') {
+ payload['enabled'] = enabled;
+ }
- if (typeof entrypoint === 'undefined') {
- throw new AppwriteException('Missing required parameter: "entrypoint"');
- }
+ if (typeof logging !== 'undefined') {
+ payload['logging'] = logging;
+ }
- if (typeof code === 'undefined') {
- throw new AppwriteException('Missing required parameter: "code"');
- }
+ if (typeof entrypoint !== 'undefined') {
+ payload['entrypoint'] = entrypoint;
+ }
- if (typeof activate === 'undefined') {
- throw new AppwriteException('Missing required parameter: "activate"');
- }
+ if (typeof commands !== 'undefined') {
+ payload['commands'] = commands;
+ }
- let path = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
- let payload: Payload = {};
+ if (typeof installationId !== 'undefined') {
+ payload['installationId'] = installationId;
+ }
- if (typeof entrypoint !== 'undefined') {
- payload['entrypoint'] = entrypoint;
- }
+ if (typeof providerRepositoryId !== 'undefined') {
+ payload['providerRepositoryId'] = providerRepositoryId;
+ }
- if (typeof code !== 'undefined') {
- payload['code'] = code;
- }
+ if (typeof providerBranch !== 'undefined') {
+ payload['providerBranch'] = providerBranch;
+ }
- if (typeof activate !== 'undefined') {
- payload['activate'] = activate;
- }
+ if (typeof providerSilentMode !== 'undefined') {
+ payload['providerSilentMode'] = providerSilentMode;
+ }
- const uri = new URL(this.client.config.endpoint + path);
+ if (typeof providerRootDirectory !== 'undefined') {
+ payload['providerRootDirectory'] = providerRootDirectory;
+ }
- if(!(code instanceof File)) {
- throw new AppwriteException('Parameter "code" has to be a File.');
- }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('put', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Delete function
+ *
+ * Delete a function by its unique ID.
+ *
+ * @param {string} functionId
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async delete(functionId: string): Promise<{}> {
+ if (typeof functionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "functionId"');
+ }
- const size = code.size;
+ const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('delete', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * List deployments
+ *
+ * Get a list of all the project's code deployments. You can use the query
+ * params to filter your results.
+ *
+ * @param {string} functionId
+ * @param {string[]} queries
+ * @param {string} search
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async listDeployments(functionId: string, queries?: string[], search?: string): Promise {
+ if (typeof functionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "functionId"');
+ }
- if (size <= Service.CHUNK_SIZE) {
- return await this.client.call('post', uri, {
+ const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
+ const payload: Payload = {};
- 'content-type': 'multipart/form-data',
- }, payload);
- }
- let id = undefined;
- let response = undefined;
+ if (typeof queries !== 'undefined') {
+ payload['queries'] = queries;
+ }
- const headers: { [header: string]: string } = {
- 'content-type': 'multipart/form-data',
- }
+ if (typeof search !== 'undefined') {
+ payload['search'] = search;
+ }
- let counter = 0;
- const totalCounters = Math.ceil(size / Service.CHUNK_SIZE);
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create deployment
+ *
+ * Create a new function code deployment. Use this endpoint to upload a new
+ * version of your code function. To execute your newly uploaded code, you'll
+ * need to update the function's deployment to use your new deployment UID.
+ *
+ * This endpoint accepts a tar.gz file compressed with your code. Make sure to
+ * include any dependencies your code has within the compressed file. You can
+ * learn more about code packaging in the [Appwrite Cloud Functions
+ * tutorial](https://appwrite.io/docs/functions).
+ *
+ * Use the "command" param to set the entrypoint used to execute your code.
+ *
+ * @param {string} functionId
+ * @param {File} code
+ * @param {boolean} activate
+ * @param {string} entrypoint
+ * @param {string} commands
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createDeployment(functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress = (progress: UploadProgress) => {}): Promise {
+ if (typeof functionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "functionId"');
+ }
- for (counter; counter < totalCounters; counter++) {
- const start = (counter * Service.CHUNK_SIZE);
- const end = Math.min((((counter * Service.CHUNK_SIZE) + Service.CHUNK_SIZE) - 1), size);
+ if (typeof code === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "code"');
+ }
- headers['content-range'] = 'bytes ' + start + '-' + end + '/' + size
+ if (typeof activate === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "activate"');
+ }
- if (id) {
- headers['x-appwrite-id'] = id;
- }
+ const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
+ const payload: Payload = {};
- const stream = code.slice(start, end + 1);
- payload['code'] = new File([stream], code.name);
+ if (typeof entrypoint !== 'undefined') {
+ payload['entrypoint'] = entrypoint;
+ }
- response = await this.client.call('post', uri, headers, payload);
+ if (typeof commands !== 'undefined') {
+ payload['commands'] = commands;
+ }
- if (!id) {
- id = response['$id'];
- }
+ if (typeof code !== 'undefined') {
+ payload['code'] = code;
+ }
- if (onProgress) {
- onProgress({
- $id: response.$id,
- progress: Math.min((counter + 1) * Service.CHUNK_SIZE - 1, size) / size * 100,
- sizeUploaded: end,
- chunksTotal: response.chunksTotal,
- chunksUploaded: response.chunksUploaded
- });
- }
- }
+ if (typeof activate !== 'undefined') {
+ payload['activate'] = activate;
+ }
- return response;
- }
-
- /**
- * Get Deployment
- *
- * Get a code deployment by its unique ID.
- *
- * @param {string} functionId
- * @param {string} deploymentId
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getDeployment(functionId: string, deploymentId: string): Promise {
- if (typeof functionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "functionId"');
- }
+ const uri = new URL(this.client.config.endpoint + apiPath);
- if (typeof deploymentId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "deploymentId"');
- }
+ if(!(code instanceof File)) {
+ throw new AppwriteException('Parameter "code" has to be a File.');
+ }
- let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
- let payload: Payload = {};
+ const size = code.size;
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
+ if (size <= Service.CHUNK_SIZE) {
+ return await this.client.call('post', uri, {
+ 'content-type': 'multipart/form-data',
}, payload);
}
- /**
- * Update Function Deployment
- *
- * Update the function code deployment ID using the unique function ID. Use
- * this endpoint to switch the code deployment that should be executed by the
- * execution endpoint.
- *
- * @param {string} functionId
- * @param {string} deploymentId
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updateDeployment(functionId: string, deploymentId: string): Promise {
- if (typeof functionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "functionId"');
- }
-
- if (typeof deploymentId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "deploymentId"');
- }
-
- let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('patch', uri, {
- 'content-type': 'application/json',
- }, payload);
+ const apiHeaders: { [header: string]: string } = {
+ 'content-type': 'multipart/form-data',
}
- /**
- * Delete Deployment
- *
- * Delete a code deployment by its unique ID.
- *
- * @param {string} functionId
- * @param {string} deploymentId
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async deleteDeployment(functionId: string, deploymentId: string): Promise<{}> {
- if (typeof functionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "functionId"');
- }
+ let offset = 0;
+ let response = undefined;
- if (typeof deploymentId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "deploymentId"');
- }
+ while (offset < size) {
+ let end = Math.min(offset + Service.CHUNK_SIZE - 1, size - 1);
- let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
- let payload: Payload = {};
+ apiHeaders['content-range'] = 'bytes ' + offset + '-' + end + '/' + size;
+ if (response && response.$id) {
+ apiHeaders['x-appwrite-id'] = response.$id;
+ }
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('delete', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
+ const chunk = code.slice(offset, end + 1);
+ payload['code'] = new File([chunk], code.name);
+ response = await this.client.call('post', uri, apiHeaders, payload);
- /**
- * Create Build
- *
- *
- * @param {string} functionId
- * @param {string} deploymentId
- * @param {string} buildId
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createBuild(functionId: string, deploymentId: string, buildId: string): Promise<{}> {
- if (typeof functionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "functionId"');
+ if (onProgress) {
+ onProgress({
+ $id: response.$id,
+ progress: (offset / size) * 100,
+ sizeUploaded: offset,
+ chunksTotal: response.chunksTotal,
+ chunksUploaded: response.chunksUploaded
+ });
}
+ offset += Service.CHUNK_SIZE;
+ }
+ return response;
+ }
+
+ /**
+ * Get deployment
+ *
+ * Get a code deployment by its unique ID.
+ *
+ * @param {string} functionId
+ * @param {string} deploymentId
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getDeployment(functionId: string, deploymentId: string): Promise {
+ if (typeof functionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "functionId"');
+ }
- if (typeof deploymentId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "deploymentId"');
- }
+ if (typeof deploymentId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "deploymentId"');
+ }
- if (typeof buildId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "buildId"');
- }
+ const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update function deployment
+ *
+ * Update the function code deployment ID using the unique function ID. Use
+ * this endpoint to switch the code deployment that should be executed by the
+ * execution endpoint.
+ *
+ * @param {string} functionId
+ * @param {string} deploymentId
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updateDeployment(functionId: string, deploymentId: string): Promise {
+ if (typeof functionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "functionId"');
+ }
- let path = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId);
- let payload: Payload = {};
+ if (typeof deploymentId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "deploymentId"');
+ }
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
+ const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('patch', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Delete deployment
+ *
+ * Delete a code deployment by its unique ID.
+ *
+ * @param {string} functionId
+ * @param {string} deploymentId
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async deleteDeployment(functionId: string, deploymentId: string): Promise<{}> {
+ if (typeof functionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "functionId"');
}
- /**
- * List Executions
- *
- * Get a list of all the current user function execution logs. You can use the
- * query params to filter your results.
- *
- * @param {string} functionId
- * @param {string[]} queries
- * @param {string} search
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async listExecutions(functionId: string, queries?: string[], search?: string): Promise {
- if (typeof functionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "functionId"');
- }
+ if (typeof deploymentId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "deploymentId"');
+ }
- let path = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
- let payload: Payload = {};
+ const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('delete', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create build
+ *
+ * Create a new build for an Appwrite Function deployment. This endpoint can
+ * be used to retry a failed build.
+ *
+ * @param {string} functionId
+ * @param {string} deploymentId
+ * @param {string} buildId
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createBuild(functionId: string, deploymentId: string, buildId: string): Promise<{}> {
+ if (typeof functionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "functionId"');
+ }
- if (typeof queries !== 'undefined') {
- payload['queries'] = queries;
- }
+ if (typeof deploymentId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "deploymentId"');
+ }
- if (typeof search !== 'undefined') {
- payload['search'] = search;
- }
+ if (typeof buildId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "buildId"');
+ }
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
+ const apiPath = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Download Deployment
+ *
+ * Get a Deployment's contents by its unique ID. This endpoint supports range
+ * requests for partial or streaming file download.
+ *
+ * @param {string} functionId
+ * @param {string} deploymentId
+ * @throws {AppwriteException}
+ * @returns {URL}
+ */
+ downloadDeployment(functionId: string, deploymentId: string): URL {
+ if (typeof functionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "functionId"');
}
- /**
- * Create Execution
- *
- * Trigger a function execution. The returned object will return you the
- * current execution status. You can ping the `Get Execution` endpoint to get
- * updates on the current execution status. Once this endpoint is called, your
- * function execution process will start asynchronously.
- *
- * @param {string} functionId
- * @param {string} data
- * @param {boolean} async
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createExecution(functionId: string, data?: string, async?: boolean): Promise {
- if (typeof functionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "functionId"');
- }
+ if (typeof deploymentId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "deploymentId"');
+ }
- let path = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
- let payload: Payload = {};
+ const apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
+ const payload: Payload = {};
- if (typeof data !== 'undefined') {
- payload['data'] = data;
- }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ payload['project'] = this.client.config.project;
- if (typeof async !== 'undefined') {
- payload['async'] = async;
- }
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
+ uri.searchParams.append(key, value);
+ }
+ return uri;
+ }
+
+ /**
+ * List executions
+ *
+ * Get a list of all the current user function execution logs. You can use the
+ * query params to filter your results.
+ *
+ * @param {string} functionId
+ * @param {string[]} queries
+ * @param {string} search
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async listExecutions(functionId: string, queries?: string[], search?: string): Promise {
+ if (typeof functionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "functionId"');
}
- /**
- * Get Execution
- *
- * Get a function execution log by its unique ID.
- *
- * @param {string} functionId
- * @param {string} executionId
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getExecution(functionId: string, executionId: string): Promise {
- if (typeof functionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "functionId"');
- }
+ const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
+ const payload: Payload = {};
- if (typeof executionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "executionId"');
- }
+ if (typeof queries !== 'undefined') {
+ payload['queries'] = queries;
+ }
- let path = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
- let payload: Payload = {};
+ if (typeof search !== 'undefined') {
+ payload['search'] = search;
+ }
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create execution
+ *
+ * Trigger a function execution. The returned object will return you the
+ * current execution status. You can ping the `Get Execution` endpoint to get
+ * updates on the current execution status. Once this endpoint is called, your
+ * function execution process will start asynchronously.
+ *
+ * @param {string} functionId
+ * @param {string} body
+ * @param {boolean} async
+ * @param {string} xpath
+ * @param {string} method
+ * @param {object} headers
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: string, headers?: object): Promise {
+ if (typeof functionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "functionId"');
}
- /**
- * Get Function Usage
- *
- *
- * @param {string} functionId
- * @param {string} range
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getFunctionUsage(functionId: string, range?: string): Promise {
- if (typeof functionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "functionId"');
- }
+ const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
+ const payload: Payload = {};
- let path = '/functions/{functionId}/usage'.replace('{functionId}', functionId);
- let payload: Payload = {};
+ if (typeof body !== 'undefined') {
+ payload['body'] = body;
+ }
- if (typeof range !== 'undefined') {
- payload['range'] = range;
- }
+ if (typeof async !== 'undefined') {
+ payload['async'] = async;
+ }
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
+ if (typeof xpath !== 'undefined') {
+ payload['path'] = xpath;
}
- /**
- * List Variables
- *
- * Get a list of all variables of a specific function.
- *
- * @param {string} functionId
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async listVariables(functionId: string): Promise {
- if (typeof functionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "functionId"');
- }
+ if (typeof method !== 'undefined') {
+ payload['method'] = method;
+ }
- let path = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
- let payload: Payload = {};
+ if (typeof headers !== 'undefined') {
+ payload['headers'] = headers;
+ }
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get execution
+ *
+ * Get a function execution log by its unique ID.
+ *
+ * @param {string} functionId
+ * @param {string} executionId
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getExecution(functionId: string, executionId: string): Promise {
+ if (typeof functionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "functionId"');
}
- /**
- * Create Variable
- *
- * Create a new function variable. These variables can be accessed within
- * function in the `env` object under the request variable.
- *
- * @param {string} functionId
- * @param {string} key
- * @param {string} value
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async createVariable(functionId: string, key: string, value: string): Promise {
- if (typeof functionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "functionId"');
- }
+ if (typeof executionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "executionId"');
+ }
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
+ const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get function usage
+ *
+ *
+ * @param {string} functionId
+ * @param {string} range
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getFunctionUsage(functionId: string, range?: string): Promise {
+ if (typeof functionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "functionId"');
+ }
- if (typeof value === 'undefined') {
- throw new AppwriteException('Missing required parameter: "value"');
- }
+ const apiPath = '/functions/{functionId}/usage'.replace('{functionId}', functionId);
+ const payload: Payload = {};
- let path = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
- let payload: Payload = {};
+ if (typeof range !== 'undefined') {
+ payload['range'] = range;
+ }
- if (typeof key !== 'undefined') {
- payload['key'] = key;
- }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * List variables
+ *
+ * Get a list of all variables of a specific function.
+ *
+ * @param {string} functionId
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async listVariables(functionId: string): Promise {
+ if (typeof functionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "functionId"');
+ }
- if (typeof value !== 'undefined') {
- payload['value'] = value;
- }
+ const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Create variable
+ *
+ * Create a new function environment variable. These variables can be accessed
+ * in the function at runtime as environment variables.
+ *
+ * @param {string} functionId
+ * @param {string} key
+ * @param {string} value
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async createVariable(functionId: string, key: string, value: string): Promise {
+ if (typeof functionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "functionId"');
+ }
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'content-type': 'application/json',
- }, payload);
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
}
- /**
- * Get Variable
- *
- * Get a variable by its unique ID.
- *
- * @param {string} functionId
- * @param {string} variableId
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getVariable(functionId: string, variableId: string): Promise {
- if (typeof functionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "functionId"');
- }
+ if (typeof value === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "value"');
+ }
- if (typeof variableId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "variableId"');
- }
+ const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
+ const payload: Payload = {};
- let path = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
- let payload: Payload = {};
+ if (typeof key !== 'undefined') {
+ payload['key'] = key;
+ }
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
+ if (typeof value !== 'undefined') {
+ payload['value'] = value;
}
- /**
- * Update Variable
- *
- * Update variable by its unique ID.
- *
- * @param {string} functionId
- * @param {string} variableId
- * @param {string} key
- * @param {string} value
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async updateVariable(functionId: string, variableId: string, key: string, value?: string): Promise {
- if (typeof functionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "functionId"');
- }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get variable
+ *
+ * Get a variable by its unique ID.
+ *
+ * @param {string} functionId
+ * @param {string} variableId
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getVariable(functionId: string, variableId: string): Promise {
+ if (typeof functionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "functionId"');
+ }
- if (typeof variableId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "variableId"');
- }
+ if (typeof variableId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "variableId"');
+ }
- if (typeof key === 'undefined') {
- throw new AppwriteException('Missing required parameter: "key"');
- }
+ const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Update variable
+ *
+ * Update variable by its unique ID.
+ *
+ * @param {string} functionId
+ * @param {string} variableId
+ * @param {string} key
+ * @param {string} value
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async updateVariable(functionId: string, variableId: string, key: string, value?: string): Promise {
+ if (typeof functionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "functionId"');
+ }
- let path = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
- let payload: Payload = {};
+ if (typeof variableId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "variableId"');
+ }
- if (typeof key !== 'undefined') {
- payload['key'] = key;
- }
+ if (typeof key === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "key"');
+ }
- if (typeof value !== 'undefined') {
- payload['value'] = value;
- }
+ const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
+ const payload: Payload = {};
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('put', uri, {
- 'content-type': 'application/json',
- }, payload);
+ if (typeof key !== 'undefined') {
+ payload['key'] = key;
}
- /**
- * Delete Variable
- *
- * Delete a variable by its unique ID.
- *
- * @param {string} functionId
- * @param {string} variableId
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async deleteVariable(functionId: string, variableId: string): Promise<{}> {
- if (typeof functionId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "functionId"');
- }
-
- if (typeof variableId === 'undefined') {
- throw new AppwriteException('Missing required parameter: "variableId"');
- }
+ if (typeof value !== 'undefined') {
+ payload['value'] = value;
+ }
- let path = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
- let payload: Payload = {};
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('put', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Delete variable
+ *
+ * Delete a variable by its unique ID.
+ *
+ * @param {string} functionId
+ * @param {string} variableId
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async deleteVariable(functionId: string, variableId: string): Promise<{}> {
+ if (typeof functionId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "functionId"');
+ }
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('delete', uri, {
- 'content-type': 'application/json',
- }, payload);
+ if (typeof variableId === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "variableId"');
}
+
+ const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('delete', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
};
diff --git a/src/services/graphql.ts b/src/services/graphql.ts
index f2b288d..ca03efb 100644
--- a/src/services/graphql.ts
+++ b/src/services/graphql.ts
@@ -10,59 +10,59 @@ export class Graphql extends Service {
super(client);
}
- /**
- * GraphQL Endpoint
- *
- * Execute a GraphQL mutation.
- *
- * @param {object} query
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async query(query: object): Promise<{}> {
- if (typeof query === 'undefined') {
- throw new AppwriteException('Missing required parameter: "query"');
- }
-
- let path = '/graphql';
- let payload: Payload = {};
+ /**
+ * GraphQL endpoint
+ *
+ * Execute a GraphQL mutation.
+ *
+ * @param {object} query
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async query(query: object): Promise<{}> {
+ if (typeof query === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "query"');
+ }
- if (typeof query !== 'undefined') {
- payload['query'] = query;
- }
+ const apiPath = '/graphql';
+ const payload: Payload = {};
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'x-sdk-graphql': 'true',
- 'content-type': 'application/json',
- }, payload);
+ if (typeof query !== 'undefined') {
+ payload['query'] = query;
}
- /**
- * GraphQL Endpoint
- *
- * Execute a GraphQL mutation.
- *
- * @param {object} query
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async mutation(query: object): Promise<{}> {
- if (typeof query === 'undefined') {
- throw new AppwriteException('Missing required parameter: "query"');
- }
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'x-sdk-graphql': 'true',
+ 'content-type': 'application/json',
+ }, payload);
+ }
- let path = '/graphql/mutation';
- let payload: Payload = {};
+ /**
+ * GraphQL endpoint
+ *
+ * Execute a GraphQL mutation.
+ *
+ * @param {object} query
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async mutation(query: object): Promise<{}> {
+ if (typeof query === 'undefined') {
+ throw new AppwriteException('Missing required parameter: "query"');
+ }
- if (typeof query !== 'undefined') {
- payload['query'] = query;
- }
+ const apiPath = '/graphql/mutation';
+ const payload: Payload = {};
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('post', uri, {
- 'x-sdk-graphql': 'true',
- 'content-type': 'application/json',
- }, payload);
+ if (typeof query !== 'undefined') {
+ payload['query'] = query;
}
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('post', uri, {
+ 'x-sdk-graphql': 'true',
+ 'content-type': 'application/json',
+ }, payload);
+ }
};
diff --git a/src/services/health.ts b/src/services/health.ts
index 471f3aa..e9b3867 100644
--- a/src/services/health.ts
+++ b/src/services/health.ts
@@ -10,230 +10,399 @@ export class Health extends Service {
super(client);
}
- /**
- * Get HTTP
- *
- * Check the Appwrite HTTP server is up and responsive.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async get(): Promise {
- let path = '/health';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
+ /**
+ * Get HTTP
+ *
+ * Check the Appwrite HTTP server is up and responsive.
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async get(): Promise {
+ const apiPath = '/health';
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get antivirus
+ *
+ * Check the Appwrite Antivirus server is up and connection is successful.
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getAntivirus(): Promise {
+ const apiPath = '/health/anti-virus';
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get cache
+ *
+ * Check the Appwrite in-memory cache servers are up and connection is
+ * successful.
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getCache(): Promise {
+ const apiPath = '/health/cache';
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get DB
+ *
+ * Check the Appwrite database servers are up and connection is successful.
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getDB(): Promise {
+ const apiPath = '/health/db';
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get pubsub
+ *
+ * Check the Appwrite pub-sub servers are up and connection is successful.
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getPubSub(): Promise {
+ const apiPath = '/health/pubsub';
+ const payload: Payload = {};
- /**
- * Get Antivirus
- *
- * Check the Appwrite Antivirus server is up and connection is successful.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getAntivirus(): Promise {
- let path = '/health/anti-virus';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get queue
+ *
+ * Check the Appwrite queue messaging servers are up and connection is
+ * successful.
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getQueue(): Promise {
+ const apiPath = '/health/queue';
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get builds queue
+ *
+ * Get the number of builds that are waiting to be processed in the Appwrite
+ * internal queue server.
+ *
+ * @param {number} threshold
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getQueueBuilds(threshold?: number): Promise {
+ const apiPath = '/health/queue/builds';
+ const payload: Payload = {};
+
+ if (typeof threshold !== 'undefined') {
+ payload['threshold'] = threshold;
}
- /**
- * Get Cache
- *
- * Check the Appwrite in-memory cache servers are up and connection is
- * successful.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getCache(): Promise {
- let path = '/health/cache';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get certificates queue
+ *
+ * Get the number of certificates that are waiting to be issued against
+ * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue
+ * server.
+ *
+ * @param {number} threshold
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getQueueCertificates(threshold?: number): Promise {
+ const apiPath = '/health/queue/certificates';
+ const payload: Payload = {};
+
+ if (typeof threshold !== 'undefined') {
+ payload['threshold'] = threshold;
}
- /**
- * Get DB
- *
- * Check the Appwrite database servers are up and connection is successful.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getDB(): Promise {
- let path = '/health/db';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get databases queue
+ *
+ * Get the number of database changes that are waiting to be processed in the
+ * Appwrite internal queue server.
+ *
+ * @param {string} name
+ * @param {number} threshold
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getQueueDatabases(name?: string, threshold?: number): Promise {
+ const apiPath = '/health/queue/databases';
+ const payload: Payload = {};
+
+ if (typeof name !== 'undefined') {
+ payload['name'] = name;
}
- /**
- * Get PubSub
- *
- * Check the Appwrite pub-sub servers are up and connection is successful.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getPubSub(): Promise {
- let path = '/health/pubsub';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
+ if (typeof threshold !== 'undefined') {
+ payload['threshold'] = threshold;
}
- /**
- * Get Queue
- *
- * Check the Appwrite queue messaging servers are up and connection is
- * successful.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getQueue(): Promise {
- let path = '/health/queue';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get deletes queue
+ *
+ * Get the number of background destructive changes that are waiting to be
+ * processed in the Appwrite internal queue server.
+ *
+ * @param {number} threshold
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getQueueDeletes(threshold?: number): Promise {
+ const apiPath = '/health/queue/deletes';
+ const payload: Payload = {};
+
+ if (typeof threshold !== 'undefined') {
+ payload['threshold'] = threshold;
}
- /**
- * Get Certificates Queue
- *
- * Get the number of certificates that are waiting to be issued against
- * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue
- * server.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getQueueCertificates(): Promise {
- let path = '/health/queue/certificates';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get functions queue
+ *
+ *
+ * @param {number} threshold
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getQueueFunctions(threshold?: number): Promise {
+ const apiPath = '/health/queue/functions';
+ const payload: Payload = {};
+
+ if (typeof threshold !== 'undefined') {
+ payload['threshold'] = threshold;
}
- /**
- * Get Functions Queue
- *
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getQueueFunctions(): Promise {
- let path = '/health/queue/functions';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get logs queue
+ *
+ * Get the number of logs that are waiting to be processed in the Appwrite
+ * internal queue server.
+ *
+ * @param {number} threshold
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getQueueLogs(threshold?: number): Promise {
+ const apiPath = '/health/queue/logs';
+ const payload: Payload = {};
+
+ if (typeof threshold !== 'undefined') {
+ payload['threshold'] = threshold;
}
- /**
- * Get Logs Queue
- *
- * Get the number of logs that are waiting to be processed in the Appwrite
- * internal queue server.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getQueueLogs(): Promise {
- let path = '/health/queue/logs';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get mails queue
+ *
+ * Get the number of mails that are waiting to be processed in the Appwrite
+ * internal queue server.
+ *
+ * @param {number} threshold
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getQueueMails(threshold?: number): Promise {
+ const apiPath = '/health/queue/mails';
+ const payload: Payload = {};
+
+ if (typeof threshold !== 'undefined') {
+ payload['threshold'] = threshold;
}
- /**
- * Get Webhooks Queue
- *
- * Get the number of webhooks that are waiting to be processed in the Appwrite
- * internal queue server.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getQueueWebhooks(): Promise {
- let path = '/health/queue/webhooks';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get messaging queue
+ *
+ * Get the number of messages that are waiting to be processed in the Appwrite
+ * internal queue server.
+ *
+ * @param {number} threshold
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getQueueMessaging(threshold?: number): Promise {
+ const apiPath = '/health/queue/messaging';
+ const payload: Payload = {};
+
+ if (typeof threshold !== 'undefined') {
+ payload['threshold'] = threshold;
}
- /**
- * Get Local Storage
- *
- * Check the Appwrite local storage device is up and connection is successful.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getStorageLocal(): Promise {
- let path = '/health/storage/local';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get migrations queue
+ *
+ * Get the number of migrations that are waiting to be processed in the
+ * Appwrite internal queue server.
+ *
+ * @param {number} threshold
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getQueueMigrations(threshold?: number): Promise {
+ const apiPath = '/health/queue/migrations';
+ const payload: Payload = {};
+
+ if (typeof threshold !== 'undefined') {
+ payload['threshold'] = threshold;
}
- /**
- * Get Time
- *
- * Check the Appwrite server time is synced with Google remote NTP server. We
- * use this technology to smoothly handle leap seconds with no disruptive
- * events. The [Network Time
- * Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is
- * used by hundreds of millions of computers and devices to synchronize their
- * clocks over the Internet. If your computer sets its own clock, it likely
- * uses NTP.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async getTime(): Promise {
- let path = '/health/time';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get webhooks queue
+ *
+ * Get the number of webhooks that are waiting to be processed in the Appwrite
+ * internal queue server.
+ *
+ * @param {number} threshold
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getQueueWebhooks(threshold?: number): Promise {
+ const apiPath = '/health/queue/webhooks';
+ const payload: Payload = {};
+
+ if (typeof threshold !== 'undefined') {
+ payload['threshold'] = threshold;
}
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get local storage
+ *
+ * Check the Appwrite local storage device is up and connection is successful.
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getStorageLocal(): Promise {
+ const apiPath = '/health/storage/local';
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
+
+ /**
+ * Get time
+ *
+ * Check the Appwrite server time is synced with Google remote NTP server. We
+ * use this technology to smoothly handle leap seconds with no disruptive
+ * events. The [Network Time
+ * Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is
+ * used by hundreds of millions of computers and devices to synchronize their
+ * clocks over the Internet. If your computer sets its own clock, it likely
+ * uses NTP.
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getTime(): Promise {
+ const apiPath = '/health/time';
+ const payload: Payload = {};
+
+ const uri = new URL(this.client.config.endpoint + apiPath);
+ return await this.client.call('get', uri, {
+ 'content-type': 'application/json',
+ }, payload);
+ }
};
diff --git a/src/services/locale.ts b/src/services/locale.ts
index 62a2347..d70b5ed 100644
--- a/src/services/locale.ts
+++ b/src/services/locale.ts
@@ -10,141 +10,160 @@ export class Locale extends Service {
super(client);
}
- /**
- * Get User Locale
- *
- * Get the current user location based on IP. Returns an object with user
- * country code, country name, continent name, continent code, ip address and
- * suggested currency. You can use the locale header to get the data in a
- * supported language.
- *
- * ([IP Geolocation by DB-IP](https://db-ip.com))
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async get(): Promise {
- let path = '/locale';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * List Continents
- *
- * List of all continents. You can use the locale header to get the data in a
- * supported language.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async listContinents(): Promise {
- let path = '/locale/continents';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * List Countries
- *
- * List of all countries. You can use the locale header to get the data in a
- * supported language.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async listCountries(): Promise {
- let path = '/locale/countries';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * List EU Countries
- *
- * List of all countries that are currently members of the EU. You can use the
- * locale header to get the data in a supported language.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async listCountriesEU(): Promise {
- let path = '/locale/countries/eu';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * List Countries Phone Codes
- *
- * List of all countries phone codes. You can use the locale header to get the
- * data in a supported language.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async listCountriesPhones(): Promise {
- let path = '/locale/countries/phones';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * List Currencies
- *
- * List of all currencies, including currency symbol, name, plural, and
- * decimal digits for all major and minor currencies. You can use the locale
- * header to get the data in a supported language.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async listCurrencies(): Promise {
- let path = '/locale/currencies';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
-
- /**
- * List Languages
- *
- * List of all languages classified by ISO 639-1 including 2-letter code, name
- * in English, and name in the respective language.
- *
- * @throws {AppwriteException}
- * @returns {Promise}
- */
- async listLanguages(): Promise {
- let path = '/locale/languages';
- let payload: Payload = {};
-
- const uri = new URL(this.client.config.endpoint + path);
- return await this.client.call('get', uri, {
- 'content-type': 'application/json',
- }, payload);
- }
+ /**
+ * Get user locale
+ *
+ * Get the current user location based on IP. Returns an object with user
+ * country code, country name, continent name, continent code, ip address and
+ * suggested currency. You can use the locale header to get the data in a
+ * supported language.
+ *
+ * ([IP Geolocation by DB-IP](https://db-ip.com))
+ *
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async get(): Promise