diff --git a/README.md b/README.md index 0d80b79..e136170 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Appwrite Node.js SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-node.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.3.2-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.4.0-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.3.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-node/releases).** +**This SDK is compatible with Appwrite server version 1.4.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-node/releases).** > This is the Node.js SDK for integrating with Appwrite from your Node.js server-side code. If you're looking to integrate from the browser, you should check [appwrite/sdk-for-web](https://github.com/appwrite/sdk-for-web) diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md index 4ed86de..f381495 100644 --- a/docs/examples/account/create-phone-verification.md +++ b/docs/examples/account/create-phone-verification.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const account = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md index 2c44558..f4c5ae9 100644 --- a/docs/examples/account/create-recovery.md +++ b/docs/examples/account/create-recovery.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const account = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md index 520af2e..0458562 100644 --- a/docs/examples/account/create-verification.md +++ b/docs/examples/account/create-verification.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const account = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md new file mode 100644 index 0000000..2900aa1 --- /dev/null +++ b/docs/examples/account/delete-identity.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +const client = new sdk.Client(); + +const account = new sdk.Account(client); + +client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token +; + +const promise = account.deleteIdentity('[IDENTITY_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md index fbfa985..74f3869 100644 --- a/docs/examples/account/delete-session.md +++ b/docs/examples/account/delete-session.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const account = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md index 2dce206..0968c30 100644 --- a/docs/examples/account/delete-sessions.md +++ b/docs/examples/account/delete-sessions.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const account = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md index 2b11f4a..8bd5d97 100644 --- a/docs/examples/account/get-prefs.md +++ b/docs/examples/account/get-prefs.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const account = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md index e83d97f..3abb677 100644 --- a/docs/examples/account/get-session.md +++ b/docs/examples/account/get-session.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const account = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md index f1ebc9e..d4f4066 100644 --- a/docs/examples/account/get.md +++ b/docs/examples/account/get.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const account = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md new file mode 100644 index 0000000..fa2013b --- /dev/null +++ b/docs/examples/account/list-identities.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +const client = new sdk.Client(); + +const account = new sdk.Account(client); + +client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token +; + +const promise = account.listIdentities(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index d60bfff..890e0d1 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const account = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md index 3eea51e..68e97ad 100644 --- a/docs/examples/account/list-sessions.md +++ b/docs/examples/account/list-sessions.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const account = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md index b550142..388e258 100644 --- a/docs/examples/account/update-email.md +++ b/docs/examples/account/update-email.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const account = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md index 196a9b2..0984652 100644 --- a/docs/examples/account/update-name.md +++ b/docs/examples/account/update-name.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const account = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index bc4050c..b46500f 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const account = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md index 4bedf42..1aa4042 100644 --- a/docs/examples/account/update-phone-verification.md +++ b/docs/examples/account/update-phone-verification.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const account = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md index 1541fda..37124d8 100644 --- a/docs/examples/account/update-phone.md +++ b/docs/examples/account/update-phone.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const account = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md index f8a2bcb..6948706 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const account = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index 1e1fb8d..74f70f5 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const account = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md index d9e1853..b0b9325 100644 --- a/docs/examples/account/update-session.md +++ b/docs/examples/account/update-session.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const account = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md index adde842..277243b 100644 --- a/docs/examples/account/update-status.md +++ b/docs/examples/account/update-status.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const account = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md index c5b7356..6a7fbbf 100644 --- a/docs/examples/account/update-verification.md +++ b/docs/examples/account/update-verification.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const account = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md index 350d154..c05595a 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const avatars = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index 3f685ff..8fbd37d 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const avatars = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md index 89a496a..2924e39 100644 --- a/docs/examples/avatars/get-favicon.md +++ b/docs/examples/avatars/get-favicon.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const avatars = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index 53fde28..50d611c 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const avatars = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md index 2b07d62..3b2bb51 100644 --- a/docs/examples/avatars/get-image.md +++ b/docs/examples/avatars/get-image.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const avatars = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index fc00f8f..4afda6f 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const avatars = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/avatars/get-q-r.md b/docs/examples/avatars/get-q-r.md index 63cac53..d2d24e2 100644 --- a/docs/examples/avatars/get-q-r.md +++ b/docs/examples/avatars/get-q-r.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const avatars = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md index 616b3fc..12a7010 100644 --- a/docs/examples/databases/create-boolean-attribute.md +++ b/docs/examples/databases/create-boolean-attribute.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md index 098f050..13ec4e0 100644 --- a/docs/examples/databases/create-collection.md +++ b/docs/examples/databases/create-collection.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md index c16bf0a..70609a8 100644 --- a/docs/examples/databases/create-datetime-attribute.md +++ b/docs/examples/databases/create-datetime-attribute.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index cdc7442..f5fa7a5 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md index 890b425..2229dfe 100644 --- a/docs/examples/databases/create-email-attribute.md +++ b/docs/examples/databases/create-email-attribute.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md index 75e4954..cd9daca 100644 --- a/docs/examples/databases/create-enum-attribute.md +++ b/docs/examples/databases/create-enum-attribute.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md index 1a26025..a12c4f4 100644 --- a/docs/examples/databases/create-float-attribute.md +++ b/docs/examples/databases/create-float-attribute.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index 07ff87f..66c3e51 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md index 52acd48..fa693d2 100644 --- a/docs/examples/databases/create-integer-attribute.md +++ b/docs/examples/databases/create-integer-attribute.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md index 8cb193a..1e8985a 100644 --- a/docs/examples/databases/create-ip-attribute.md +++ b/docs/examples/databases/create-ip-attribute.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md index 8a1a41b..f680d1c 100644 --- a/docs/examples/databases/create-relationship-attribute.md +++ b/docs/examples/databases/create-relationship-attribute.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md index e12b71d..bfb4fbf 100644 --- a/docs/examples/databases/create-string-attribute.md +++ b/docs/examples/databases/create-string-attribute.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md index 6738cd7..e6a585f 100644 --- a/docs/examples/databases/create-url-attribute.md +++ b/docs/examples/databases/create-url-attribute.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md index b6fb6c6..4e04f02 100644 --- a/docs/examples/databases/create.md +++ b/docs/examples/databases/create.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md index 312135e..3c65f62 100644 --- a/docs/examples/databases/delete-attribute.md +++ b/docs/examples/databases/delete-attribute.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md index 8b1ee5f..047fa26 100644 --- a/docs/examples/databases/delete-collection.md +++ b/docs/examples/databases/delete-collection.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md index 9229166..a6f3fa5 100644 --- a/docs/examples/databases/delete-document.md +++ b/docs/examples/databases/delete-document.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md index ffa04b4..42d7310 100644 --- a/docs/examples/databases/delete-index.md +++ b/docs/examples/databases/delete-index.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md index f2534e5..3f39965 100644 --- a/docs/examples/databases/delete.md +++ b/docs/examples/databases/delete.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md index d167582..df6c665 100644 --- a/docs/examples/databases/get-attribute.md +++ b/docs/examples/databases/get-attribute.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md index fdaa714..ea4ed42 100644 --- a/docs/examples/databases/get-collection.md +++ b/docs/examples/databases/get-collection.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md index abb57a4..ac07b96 100644 --- a/docs/examples/databases/get-document.md +++ b/docs/examples/databases/get-document.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md index 469f75e..c3a3d16 100644 --- a/docs/examples/databases/get-index.md +++ b/docs/examples/databases/get-index.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md index dc11458..133f496 100644 --- a/docs/examples/databases/get.md +++ b/docs/examples/databases/get.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md index b3e0986..b1a494b 100644 --- a/docs/examples/databases/list-attributes.md +++ b/docs/examples/databases/list-attributes.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md index 37b594f..c1d9fd3 100644 --- a/docs/examples/databases/list-collections.md +++ b/docs/examples/databases/list-collections.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index 89aa4f7..bf0b915 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md index 36954b2..57787f1 100644 --- a/docs/examples/databases/list-indexes.md +++ b/docs/examples/databases/list-indexes.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md index 8e3857e..5652d1e 100644 --- a/docs/examples/databases/list.md +++ b/docs/examples/databases/list.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index 154cea1..3bdfc04 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md index 1205a26..db74a7b 100644 --- a/docs/examples/databases/update-collection.md +++ b/docs/examples/databases/update-collection.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index 9efd01a..8b602d4 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index edd4ea6..ca3cdb8 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index cf01a32..a96e898 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index 8727df0..b0dfbb1 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index ac59098..2c0672d 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index c61722c..8016aac 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index 4573e3c..8eab99a 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md index 65d8624..699148f 100644 --- a/docs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/databases/update-relationship-attribute.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md index e6ca8fc..c7e6fe9 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index 8a3ccaa..d8cb42a 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md index f829bc8..7abe11b 100644 --- a/docs/examples/databases/update.md +++ b/docs/examples/databases/update.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const databases = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/functions/create-build.md b/docs/examples/functions/create-build.md index 5b39dad..fe9751e 100644 --- a/docs/examples/functions/create-build.md +++ b/docs/examples/functions/create-build.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const functions = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md index c48153b..6d14142 100644 --- a/docs/examples/functions/create-deployment.md +++ b/docs/examples/functions/create-deployment.md @@ -7,12 +7,12 @@ const client = new sdk.Client(); const functions = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; -const promise = functions.createDeployment('[FUNCTION_ID]', '[ENTRYPOINT]', InputFile.fromPath('/path/to/file.png', 'file.png'), false); +const promise = functions.createDeployment('[FUNCTION_ID]', InputFile.fromPath('/path/to/file.png', 'file.png'), false); promise.then(function (response) { console.log(response); diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index 35114aa..dc182fd 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const functions = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md index 3d233b8..80f3fd0 100644 --- a/docs/examples/functions/create-variable.md +++ b/docs/examples/functions/create-variable.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const functions = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index 805cfc2..8600f34 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const functions = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md index 536e5c5..5affdf1 100644 --- a/docs/examples/functions/delete-deployment.md +++ b/docs/examples/functions/delete-deployment.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const functions = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/functions/delete-variable.md b/docs/examples/functions/delete-variable.md index 0190ee8..2a075fd 100644 --- a/docs/examples/functions/delete-variable.md +++ b/docs/examples/functions/delete-variable.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const functions = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md index 1362dd5..d17f013 100644 --- a/docs/examples/functions/delete.md +++ b/docs/examples/functions/delete.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const functions = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/functions/download-deployment.md b/docs/examples/functions/download-deployment.md new file mode 100644 index 0000000..d8bd913 --- /dev/null +++ b/docs/examples/functions/download-deployment.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +const client = new sdk.Client(); + +const functions = new sdk.Functions(client); + +client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +const promise = functions.downloadDeployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md index c4256a6..d67ce46 100644 --- a/docs/examples/functions/get-deployment.md +++ b/docs/examples/functions/get-deployment.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const functions = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md index f3370ec..bbf0788 100644 --- a/docs/examples/functions/get-execution.md +++ b/docs/examples/functions/get-execution.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const functions = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md index f3cfbff..11ce7e2 100644 --- a/docs/examples/functions/get-variable.md +++ b/docs/examples/functions/get-variable.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const functions = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md index 5b35a3d..54ea481 100644 --- a/docs/examples/functions/get.md +++ b/docs/examples/functions/get.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const functions = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md index 354c157..4819410 100644 --- a/docs/examples/functions/list-deployments.md +++ b/docs/examples/functions/list-deployments.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const functions = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index 21ee1f6..f9e77a5 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const functions = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md index bab36eb..d471861 100644 --- a/docs/examples/functions/list-runtimes.md +++ b/docs/examples/functions/list-runtimes.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const functions = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md index 4120d96..e193b2b 100644 --- a/docs/examples/functions/list-variables.md +++ b/docs/examples/functions/list-variables.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const functions = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md index 98343cb..4f7b45e 100644 --- a/docs/examples/functions/list.md +++ b/docs/examples/functions/list.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const functions = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/functions/update-deployment.md b/docs/examples/functions/update-deployment.md index f6f2dc2..25f0e79 100644 --- a/docs/examples/functions/update-deployment.md +++ b/docs/examples/functions/update-deployment.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const functions = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md index e4262de..86e9a69 100644 --- a/docs/examples/functions/update-variable.md +++ b/docs/examples/functions/update-variable.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const functions = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index 87ec099..5ab5b1b 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -6,12 +6,12 @@ const client = new sdk.Client(); const functions = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; -const promise = functions.update('[FUNCTION_ID]', '[NAME]'); +const promise = functions.update('[FUNCTION_ID]', '[NAME]', 'node-14.5'); promise.then(function (response) { console.log(response); diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md index 0cf35fc..6f9bed8 100644 --- a/docs/examples/graphql/mutation.md +++ b/docs/examples/graphql/mutation.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const graphql = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md index e2c9466..35cd406 100644 --- a/docs/examples/graphql/query.md +++ b/docs/examples/graphql/query.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const graphql = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/health/get-antivirus.md index 66886e3..b6e5e78 100644 --- a/docs/examples/health/get-antivirus.md +++ b/docs/examples/health/get-antivirus.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const health = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md index af57c75..8171c40 100644 --- a/docs/examples/health/get-cache.md +++ b/docs/examples/health/get-cache.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const health = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/health/get-d-b.md b/docs/examples/health/get-d-b.md index d871648..ef1739f 100644 --- a/docs/examples/health/get-d-b.md +++ b/docs/examples/health/get-d-b.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const health = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md new file mode 100644 index 0000000..b690239 --- /dev/null +++ b/docs/examples/health/get-pub-sub.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +const client = new sdk.Client(); + +const health = new sdk.Health(client); + +client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +const promise = health.getPubSub(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ 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 ef0ecef..38dadde 100644 --- a/docs/examples/health/get-queue-certificates.md +++ b/docs/examples/health/get-queue-certificates.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const health = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md index 6ba0265..bc8668e 100644 --- a/docs/examples/health/get-queue-functions.md +++ b/docs/examples/health/get-queue-functions.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const health = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md index 82f48a7..918a9d9 100644 --- a/docs/examples/health/get-queue-logs.md +++ b/docs/examples/health/get-queue-logs.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const health = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md index e46403c..acf023a 100644 --- a/docs/examples/health/get-queue-webhooks.md +++ b/docs/examples/health/get-queue-webhooks.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const health = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/health/get-queue.md b/docs/examples/health/get-queue.md new file mode 100644 index 0000000..4caafec --- /dev/null +++ b/docs/examples/health/get-queue.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +const client = new sdk.Client(); + +const health = new sdk.Health(client); + +client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +const promise = health.getQueue(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md index 9d65f71..76e5148 100644 --- a/docs/examples/health/get-storage-local.md +++ b/docs/examples/health/get-storage-local.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const health = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md index 143885f..f44836a 100644 --- a/docs/examples/health/get-time.md +++ b/docs/examples/health/get-time.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const health = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/health/get.md b/docs/examples/health/get.md index fc6d1b9..a66b256 100644 --- a/docs/examples/health/get.md +++ b/docs/examples/health/get.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const health = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md index 79ceda7..31d90c6 100644 --- a/docs/examples/locale/get.md +++ b/docs/examples/locale/get.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const locale = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md new file mode 100644 index 0000000..aa95daf --- /dev/null +++ b/docs/examples/locale/list-codes.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +const client = new sdk.Client(); + +const locale = new sdk.Locale(client); + +client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +const promise = locale.listCodes(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md index c08af39..ffe54d3 100644 --- a/docs/examples/locale/list-continents.md +++ b/docs/examples/locale/list-continents.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const locale = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/locale/list-countries-e-u.md b/docs/examples/locale/list-countries-e-u.md index 8b42e20..f9aaff6 100644 --- a/docs/examples/locale/list-countries-e-u.md +++ b/docs/examples/locale/list-countries-e-u.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const locale = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md index a190457..fdd2436 100644 --- a/docs/examples/locale/list-countries-phones.md +++ b/docs/examples/locale/list-countries-phones.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const locale = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md index 4a31181..429e188 100644 --- a/docs/examples/locale/list-countries.md +++ b/docs/examples/locale/list-countries.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const locale = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md index 703068f..12d82fb 100644 --- a/docs/examples/locale/list-currencies.md +++ b/docs/examples/locale/list-currencies.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const locale = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md index ca12a6d..8ea2b40 100644 --- a/docs/examples/locale/list-languages.md +++ b/docs/examples/locale/list-languages.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const locale = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md index 4f355b3..9093b7c 100644 --- a/docs/examples/storage/create-bucket.md +++ b/docs/examples/storage/create-bucket.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const storage = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index 4e3138e..664005e 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -7,7 +7,7 @@ const client = new sdk.Client(); const storage = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md index f755d74..84486c6 100644 --- a/docs/examples/storage/delete-bucket.md +++ b/docs/examples/storage/delete-bucket.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const storage = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md index 4e39b04..c4d451c 100644 --- a/docs/examples/storage/delete-file.md +++ b/docs/examples/storage/delete-file.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const storage = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md index 4a00412..d0fbb94 100644 --- a/docs/examples/storage/get-bucket.md +++ b/docs/examples/storage/get-bucket.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const storage = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index b14988c..1503d10 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const storage = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index f3c46dc..19d3449 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const storage = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index fdaa77e..1affab8 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const storage = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md index 181bfcf..ceba42c 100644 --- a/docs/examples/storage/get-file.md +++ b/docs/examples/storage/get-file.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const storage = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md index f8aae65..9945feb 100644 --- a/docs/examples/storage/list-buckets.md +++ b/docs/examples/storage/list-buckets.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const storage = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index 2cab3df..fea4bae 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const storage = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md index 35f1358..32df1f1 100644 --- a/docs/examples/storage/update-bucket.md +++ b/docs/examples/storage/update-bucket.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const storage = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index 2bca7e9..042a164 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const storage = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index 9a35dd5..34d843d 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const teams = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md index 9d53f88..5552f82 100644 --- a/docs/examples/teams/create.md +++ b/docs/examples/teams/create.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const teams = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md index 4a5576d..ef72e63 100644 --- a/docs/examples/teams/delete-membership.md +++ b/docs/examples/teams/delete-membership.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const teams = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md index 3af8ad3..6f1dfaa 100644 --- a/docs/examples/teams/delete.md +++ b/docs/examples/teams/delete.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const teams = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md index 895bcdd..d31aa9a 100644 --- a/docs/examples/teams/get-membership.md +++ b/docs/examples/teams/get-membership.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const teams = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md index d37bae0..0ac9e95 100644 --- a/docs/examples/teams/get-prefs.md +++ b/docs/examples/teams/get-prefs.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const teams = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md index ef25505..0d34943 100644 --- a/docs/examples/teams/get.md +++ b/docs/examples/teams/get.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const teams = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index f47865f..ca25bcb 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const teams = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index 209b6a1..8610bc7 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const teams = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md index 0020e6f..6c46e78 100644 --- a/docs/examples/teams/update-membership-status.md +++ b/docs/examples/teams/update-membership-status.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const teams = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/teams/update-membership-roles.md b/docs/examples/teams/update-membership.md similarity index 71% rename from docs/examples/teams/update-membership-roles.md rename to docs/examples/teams/update-membership.md index 44deb3b..d5ba30a 100644 --- a/docs/examples/teams/update-membership-roles.md +++ b/docs/examples/teams/update-membership.md @@ -6,12 +6,12 @@ const client = new sdk.Client(); const teams = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; -const promise = teams.updateMembershipRoles('[TEAM_ID]', '[MEMBERSHIP_ID]', []); +const promise = teams.updateMembership('[TEAM_ID]', '[MEMBERSHIP_ID]', []); promise.then(function (response) { console.log(response); diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md index 1676fb6..962e18f 100644 --- a/docs/examples/teams/update-name.md +++ b/docs/examples/teams/update-name.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const teams = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md index 0ec7d10..eeeed6c 100644 --- a/docs/examples/teams/update-prefs.md +++ b/docs/examples/teams/update-prefs.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const teams = new sdk.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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; diff --git a/docs/examples/users/create-argon2user.md b/docs/examples/users/create-argon2user.md index 00eb91d..2762cc0 100644 --- a/docs/examples/users/create-argon2user.md +++ b/docs/examples/users/create-argon2user.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md index 42b3108..7bbdd3b 100644 --- a/docs/examples/users/create-bcrypt-user.md +++ b/docs/examples/users/create-bcrypt-user.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/create-m-d5user.md b/docs/examples/users/create-m-d5user.md index b7a7c0c..0661743 100644 --- a/docs/examples/users/create-m-d5user.md +++ b/docs/examples/users/create-m-d5user.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/create-p-h-pass-user.md b/docs/examples/users/create-p-h-pass-user.md index 477a88e..37bd7e7 100644 --- a/docs/examples/users/create-p-h-pass-user.md +++ b/docs/examples/users/create-p-h-pass-user.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/create-s-h-a-user.md b/docs/examples/users/create-s-h-a-user.md index 482aa0b..1d05025 100644 --- a/docs/examples/users/create-s-h-a-user.md +++ b/docs/examples/users/create-s-h-a-user.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/create-scrypt-modified-user.md b/docs/examples/users/create-scrypt-modified-user.md index c267797..5a0153e 100644 --- a/docs/examples/users/create-scrypt-modified-user.md +++ b/docs/examples/users/create-scrypt-modified-user.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md index bd067e6..83ec8d3 100644 --- a/docs/examples/users/create-scrypt-user.md +++ b/docs/examples/users/create-scrypt-user.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md index 6455ff4..65ab3fa 100644 --- a/docs/examples/users/create.md +++ b/docs/examples/users/create.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md new file mode 100644 index 0000000..c3acfa9 --- /dev/null +++ b/docs/examples/users/delete-identity.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +const client = new sdk.Client(); + +const users = new sdk.Users(client); + +client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +const promise = users.deleteIdentity('[IDENTITY_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/docs/examples/users/delete-session.md b/docs/examples/users/delete-session.md index ed161dc..18617ba 100644 --- a/docs/examples/users/delete-session.md +++ b/docs/examples/users/delete-session.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md index 9b6abfc..c804d7d 100644 --- a/docs/examples/users/delete-sessions.md +++ b/docs/examples/users/delete-sessions.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md index 65ed718..53606a7 100644 --- a/docs/examples/users/delete.md +++ b/docs/examples/users/delete.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md index bac42c8..c60db8a 100644 --- a/docs/examples/users/get-prefs.md +++ b/docs/examples/users/get-prefs.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md index fa1579e..3bad599 100644 --- a/docs/examples/users/get.md +++ b/docs/examples/users/get.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md new file mode 100644 index 0000000..36a71b7 --- /dev/null +++ b/docs/examples/users/list-identities.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +const client = new sdk.Client(); + +const users = new sdk.Users(client); + +client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +const promise = users.listIdentities(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md index c05d2ae..0f76626 100644 --- a/docs/examples/users/list-logs.md +++ b/docs/examples/users/list-logs.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md index 4136e17..81e0c4b 100644 --- a/docs/examples/users/list-memberships.md +++ b/docs/examples/users/list-memberships.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md index f3d11fa..b44341b 100644 --- a/docs/examples/users/list-sessions.md +++ b/docs/examples/users/list-sessions.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md index bddb2e7..a9ba208 100644 --- a/docs/examples/users/list.md +++ b/docs/examples/users/list.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md index c80a781..29c3e26 100644 --- a/docs/examples/users/update-email-verification.md +++ b/docs/examples/users/update-email-verification.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md index 627de27..5cef6fb 100644 --- a/docs/examples/users/update-email.md +++ b/docs/examples/users/update-email.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md new file mode 100644 index 0000000..d727bf1 --- /dev/null +++ b/docs/examples/users/update-labels.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +const client = new sdk.Client(); + +const users = new sdk.Users(client); + +client + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +const promise = users.updateLabels('[USER_ID]', []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md index cd515cb..ea33b7e 100644 --- a/docs/examples/users/update-name.md +++ b/docs/examples/users/update-name.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md index 8d0130b..f08a599 100644 --- a/docs/examples/users/update-password.md +++ b/docs/examples/users/update-password.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md index 7c88651..e6a95f9 100644 --- a/docs/examples/users/update-phone-verification.md +++ b/docs/examples/users/update-phone-verification.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md index 9172414..8db9863 100644 --- a/docs/examples/users/update-phone.md +++ b/docs/examples/users/update-phone.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md index f9e16da..75f1a42 100644 --- a/docs/examples/users/update-prefs.md +++ b/docs/examples/users/update-prefs.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md index 08c79ef..ac52d73 100644 --- a/docs/examples/users/update-status.md +++ b/docs/examples/users/update-status.md @@ -6,7 +6,7 @@ const client = new sdk.Client(); const users = new sdk.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 .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; diff --git a/index.d.ts b/index.d.ts index f69721e..23f928e 100644 --- a/index.d.ts +++ b/index.d.ts @@ -79,6 +79,19 @@ declare module "node-appwrite" { 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 */ export type LogList = { @@ -274,6 +287,19 @@ declare module "node-appwrite" { variables: Variable[]; } /** + * Locale codes list + */ + export type LocaleCodeList = { + /** + * Total number of localeCodes documents that matched your query. + */ + total: number; + /** + * List of localeCodes. + */ + localeCodes: LocaleCode[]; + } + /** * Database */ export type Database = { @@ -293,6 +319,10 @@ declare module "node-appwrite" { * 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 @@ -323,7 +353,7 @@ declare module "node-appwrite" { */ 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; /** @@ -369,6 +399,10 @@ declare module "node-appwrite" { */ status: string; /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** * Is attribute required? */ required: boolean; @@ -402,6 +436,10 @@ declare module "node-appwrite" { */ status: string; /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** * Is attribute required? */ required: boolean; @@ -439,6 +477,10 @@ declare module "node-appwrite" { */ status: string; /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** * Is attribute required? */ required: boolean; @@ -476,6 +518,10 @@ declare module "node-appwrite" { */ status: string; /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** * Is attribute required? */ required: boolean; @@ -505,6 +551,10 @@ declare module "node-appwrite" { */ status: string; /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** * Is attribute required? */ required: boolean; @@ -538,6 +588,10 @@ declare module "node-appwrite" { */ status: string; /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** * Is attribute required? */ required: boolean; @@ -575,6 +629,10 @@ declare module "node-appwrite" { */ status: string; /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** * Is attribute required? */ required: boolean; @@ -608,6 +666,10 @@ declare module "node-appwrite" { */ status: string; /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** * Is attribute required? */ required: boolean; @@ -641,6 +703,10 @@ declare module "node-appwrite" { */ status: string; /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** * Is attribute required? */ required: boolean; @@ -674,6 +740,10 @@ declare module "node-appwrite" { */ status: string; /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** * Is attribute required? */ required: boolean; @@ -723,6 +793,10 @@ declare module "node-appwrite" { */ status: string; /** + * Error message. Displays error generated on failure of creating or deleting an index. + */ + error: string; + /** * Index attributes. */ attributes: string[]; @@ -890,6 +964,10 @@ declare module "node-appwrite" { */ status: boolean; /** + * Labels for the user. + */ + labels: string[]; + /** * Password update time in ISO 8601 format. */ passwordUpdate: string; @@ -913,6 +991,10 @@ declare module "node-appwrite" { * 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 @@ -1128,6 +1210,51 @@ declare module "node-appwrite" { 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 */ export type Token = { @@ -1186,6 +1313,19 @@ declare module "node-appwrite" { 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 */ export type File = { @@ -1398,6 +1538,14 @@ declare module "node-appwrite" { */ 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. */ runtime: string; @@ -1418,17 +1566,41 @@ declare module "node-appwrite" { */ schedule: string; /** - * Function's next scheduled execution time in ISO 8601 format. + * Function execution timeout in seconds. */ - scheduleNext: string; + timeout: number; /** - * Function's previous scheduled execution time in ISO 8601 format. + * The entrypoint file used to execute the deployment. */ - schedulePrevious: string; + entrypoint: string; /** - * Function execution timeout in seconds. + * The build command used to build the deployment. */ - timeout: number; + commands: string; + /** + * Version of Open Runtimes used for the function. + */ + version: string; + /** + * Function VCS (Version Control System) installation id. + */ + installationId: string; + /** + * VCS (Version Control System) Repository ID + */ + providerRepositoryId: string; + /** + * VCS (Version Control System) branch name + */ + providerBranch: string; + /** + * Path to function in VCS (Version Control System) repository + */ + 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; } /** * Runtime @@ -1480,6 +1652,10 @@ declare module "node-appwrite" { */ $updatedAt: string; /** + * Type of deployment. + */ + type: string; + /** * Resource ID. */ resourceId: string; @@ -1504,21 +1680,57 @@ declare module "node-appwrite" { */ activate: boolean; /** - * The deployment status. Possible values are "processing", "building", "pending", "ready", and "failed". + * The deployment status. Possible values are "processing", "building", "waiting", "ready", and "failed". */ status: string; /** - * The build stdout. + * The build logs. */ - buildStdout: string; - /** - * The build stderr. - */ - buildStderr: string; + 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 @@ -1553,23 +1765,39 @@ declare module "node-appwrite" { */ 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; } @@ -1598,9 +1826,13 @@ declare module "node-appwrite" { */ 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 @@ -1721,6 +1953,10 @@ declare module "node-appwrite" { * Health Status */ export type HealthStatus = { + /** + * Name of the service. + */ + name: string; /** * Duration in milliseconds how long the health check took. */ @@ -1747,6 +1983,19 @@ declare module "node-appwrite" { */ diff: number; } + /** + * Headers + */ + export type Headers = { + /** + * Header name. + */ + name: string; + /** + * Header value. + */ + value: string; + } } export class Client { /** @@ -1911,7 +2160,7 @@ declare module "node-appwrite" { /** * Get Account * - * Get currently logged in user data as JSON object. + * Get the currently logged in user. * * @throws {AppwriteException} * @returns {Promise} @@ -1935,11 +2184,31 @@ declare module "node-appwrite" { * @returns {Promise} */ updateEmail(email: string, password: string): Promise>; + /** + * List Identities + * + * Get the list of identities for the currently logged in user. + * + * @param {string} queries + * @throws {AppwriteException} + * @returns {Promise} + */ + listIdentities(queries?: string): Promise; + /** + * Delete Identity + * + * Delete an identity by its unique ID. + * + * @param {string} identityId + * @throws {AppwriteException} + * @returns {Promise} + */ + deleteIdentity(identityId: string): Promise; /** * 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. + * 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} @@ -1987,7 +2256,7 @@ declare module "node-appwrite" { /** * Get Account Preferences * - * Get currently logged in user preferences as a key-value object. + * Get the preferences as a key-value object for the currently logged in user. * * @throws {AppwriteException} * @returns {Promise} @@ -2047,8 +2316,8 @@ declare module "node-appwrite" { /** * List Sessions * - * Get currently logged in user list of active sessions across different - * devices. + * Get the list of active sessions across different devices for the currently + * logged in user. * * @throws {AppwriteException} * @returns {Promise} @@ -2090,10 +2359,10 @@ declare module "node-appwrite" { /** * 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. - * + * 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](/docs/client/account#accountDeleteSessions) instead. * * @param {string} sessionId * @throws {AppwriteException} @@ -2345,10 +2614,11 @@ declare module "node-appwrite" { * * @param {string} databaseId * @param {string} name + * @param {boolean} enabled * @throws {AppwriteException} * @returns {Promise} */ - create(databaseId: string, name: string): Promise; + create(databaseId: string, name: string, enabled?: boolean): Promise; /** * Get Database * @@ -2367,10 +2637,11 @@ declare module "node-appwrite" { * * @param {string} databaseId * @param {string} name + * @param {boolean} enabled * @throws {AppwriteException} * @returns {Promise} */ - update(databaseId: string, name: string): Promise; + update(databaseId: string, name: string, enabled?: boolean): Promise; /** * Delete Database * @@ -2408,10 +2679,11 @@ declare module "node-appwrite" { * @param {string} name * @param {string[]} permissions * @param {boolean} documentSecurity + * @param {boolean} enabled * @throws {AppwriteException} * @returns {Promise} */ - createCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean): Promise; + createCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise; /** * Get Collection * @@ -2456,10 +2728,11 @@ declare module "node-appwrite" { * * @param {string} databaseId * @param {string} collectionId + * @param {string[]} queries * @throws {AppwriteException} * @returns {Promise} */ - listAttributes(databaseId: string, collectionId: string): Promise; + listAttributes(databaseId: string, collectionId: string, queries?: string[]): Promise; /** * Create Boolean Attribute * @@ -2714,10 +2987,11 @@ declare module "node-appwrite" { * @param {boolean} required * @param {string} default * @param {boolean} array + * @param {boolean} encrypt * @throws {AppwriteException} * @returns {Promise} */ - createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean): Promise; + createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise; /** * Update String Attribute * @@ -2877,10 +3151,11 @@ declare module "node-appwrite" { * * @param {string} databaseId * @param {string} collectionId + * @param {string[]} queries * @throws {AppwriteException} * @returns {Promise} */ - listIndexes(databaseId: string, collectionId: string): Promise; + listIndexes(databaseId: string, collectionId: string, queries?: string[]): Promise; /** * Create Index * @@ -2945,10 +3220,22 @@ declare module "node-appwrite" { * @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} */ - create(functionId: string, name: string, runtime: string, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean): Promise; + 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; /** * List runtimes * @@ -2975,15 +3262,24 @@ declare module "node-appwrite" { * * @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} */ - update(functionId: string, name: string, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean): Promise; + 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; /** * Delete Function * @@ -3019,16 +3315,17 @@ declare module "node-appwrite" { * 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. + * Use the "command" param to set the entrypoint used to execute your code. * * @param {string} functionId - * @param {string} entrypoint * @param {InputFile} code * @param {boolean} activate + * @param {string} entrypoint + * @param {string} commands * @throws {AppwriteException} * @returns {Promise} */ - createDeployment(functionId: string, entrypoint: string, code: InputFile, activate: boolean): Promise; + createDeployment(functionId: string, code: InputFile, activate: boolean, entrypoint?: string, commands?: string): Promise; /** * Get Deployment * @@ -3067,6 +3364,9 @@ declare module "node-appwrite" { /** * 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 @@ -3074,6 +3374,15 @@ declare module "node-appwrite" { * @returns {Promise} */ createBuild(functionId: string, deploymentId: string, buildId: string): Promise; + /** + * Download Deployment + * + * @param {string} functionId + * @param {string} deploymentId + * @throws {AppwriteException} + * @returns {Promise} + */ + downloadDeployment(functionId: string, deploymentId: string): Promise; /** * List Executions * @@ -3096,12 +3405,15 @@ declare module "node-appwrite" { * function execution process will start asynchronously. * * @param {string} functionId - * @param {string} data + * @param {string} body * @param {boolean} async + * @param {string} path + * @param {string} method + * @param {object} headers * @throws {AppwriteException} * @returns {Promise} */ - createExecution(functionId: string, data?: string, async?: boolean): Promise; + createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: string, headers?: object): Promise; /** * Get Execution * @@ -3126,8 +3438,8 @@ declare module "node-appwrite" { /** * Create Variable * - * Create a new function variable. These variables can be accessed within - * function in the `env` object under the request 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 @@ -3220,7 +3532,7 @@ declare module "node-appwrite" { /** * Get Cache * - * Check the Appwrite in-memory cache server is up and connection is + * Check the Appwrite in-memory cache servers are up and connection is * successful. * * @throws {AppwriteException} @@ -3230,12 +3542,31 @@ declare module "node-appwrite" { /** * Get DB * - * Check the Appwrite database server is up and connection is successful. + * Check the Appwrite database servers are up and connection is successful. * * @throws {AppwriteException} * @returns {Promise} */ getDB(): Promise; + /** + * Get PubSub + * + * Check the Appwrite pub-sub servers are up and connection is successful. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + getPubSub(): Promise; + /** + * Get Queue + * + * Check the Appwrite queue messaging servers are up and connection is + * successful. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + getQueue(): Promise; /** * Get Certificates Queue * @@ -3316,6 +3647,16 @@ declare module "node-appwrite" { * @returns {Promise} */ get(): Promise; + /** + * List Locale Codes + * + * List of all locale codes in [ISO + * 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). + * + * @throws {AppwriteException} + * @returns {Promise} + */ + listCodes(): Promise; /** * List Continents * @@ -3515,11 +3856,12 @@ declare module "node-appwrite" { * * @param {string} bucketId * @param {string} fileId + * @param {string} name * @param {string[]} permissions * @throws {AppwriteException} * @returns {Promise} */ - updateFile(bucketId: string, fileId: string, permissions?: string[]): Promise; + updateFile(bucketId: string, fileId: string, name?: string, permissions?: string[]): Promise; /** * Delete File * @@ -3708,11 +4050,12 @@ declare module "node-appwrite" { */ getMembership(teamId: string, membershipId: string): Promise; /** - * Update Membership Roles + * Update Membership * * Modify the roles of a team member. Only team members with the owner role * have access to this endpoint. Learn more about [roles and * permissions](/docs/permissions). + * * * @param {string} teamId * @param {string} membershipId @@ -3720,7 +4063,7 @@ declare module "node-appwrite" { * @throws {AppwriteException} * @returns {Promise} */ - updateMembershipRoles(teamId: string, membershipId: string, roles: string[]): Promise; + updateMembership(teamId: string, membershipId: string, roles: string[]): Promise; /** * Delete Team Membership * @@ -3840,6 +4183,27 @@ declare module "node-appwrite" { * @returns {Promise} */ createBcryptUser(userId: string, email: string, password: string, name?: string): Promise>; + /** + * List Identities + * + * Get identities for all users. + * + * @param {string} queries + * @param {string} search + * @throws {AppwriteException} + * @returns {Promise} + */ + listIdentities(queries?: string, search?: string): Promise; + /** + * Delete Identity + * + * Delete an identity by its unique ID. + * + * @param {string} identityId + * @throws {AppwriteException} + * @returns {Promise} + */ + deleteIdentity(identityId: string): Promise; /** * Create User with MD5 Password * @@ -3964,6 +4328,22 @@ declare module "node-appwrite" { * @returns {Promise} */ updateEmail(userId: string, email: string): Promise>; + /** + * Update User Labels + * + * Update the user labels by its unique ID. + * + * Labels can be used to grant access to resources. While teams are a way for + * user's to share access to a resource, labels can be defined by the + * developer to grant access without an invitation. See the [Permissions + * docs](/docs/permissions) for more info. + * + * @param {string} userId + * @param {string[]} labels + * @throws {AppwriteException} + * @returns {Promise} + */ + updateLabels(userId: string, labels: string[]): Promise>; /** * List User Logs * diff --git a/lib/client.js b/lib/client.js index f3b79d4..9dd06f9 100644 --- a/lib/client.js +++ b/lib/client.js @@ -1,3 +1,4 @@ +const os = require('os'); const URL = require('url').URL; const axios = require('axios'); const FormData = require('form-data'); @@ -11,11 +12,12 @@ class Client { this.headers = { 'accept-encoding': '*', 'content-type': '', + 'user-agent' : `AppwriteNodeJSSDK/10.0.0 (${os.type()}; ${os.version()}; ${os.arch()})`, 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '9.0.0', - 'X-Appwrite-Response-Format' : '1.0.0', + 'x-sdk-version': '10.0.0', + 'X-Appwrite-Response-Format' : '1.4.0', }; this.selfSigned = false; } diff --git a/lib/services/account.js b/lib/services/account.js index c870da1..9ffcfa3 100644 --- a/lib/services/account.js +++ b/lib/services/account.js @@ -17,16 +17,16 @@ class Account extends Service { /** * Get Account * - * Get currently logged in user data as JSON object. + * Get the currently logged in user. * * @throws {AppwriteException} * @returns {Promise} */ async get() { - let path = '/account'; + const apiPath = '/account'; let payload = {}; - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -49,7 +49,7 @@ class Account extends Service { * @returns {Promise} */ async updateEmail(email, password) { - let path = '/account/email'; + const apiPath = '/account/email'; let payload = {}; if (typeof email === 'undefined') { throw new AppwriteException('Missing required parameter: "email"'); @@ -68,7 +68,51 @@ class Account extends Service { payload['password'] = password; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { + '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) { + const apiPath = '/account/identities'; + let payload = {}; + + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + + return await this.client.call('get', apiPath, { + 'content-type': 'application/json', + }, payload); + } + + /** + * Delete Identity + * + * Delete an identity by its unique ID. + * + * @param {string} identityId + * @throws {AppwriteException} + * @returns {Promise} + */ + async deleteIdentity(identityId) { + const apiPath = '/account/identities/{identityId}'.replace('{identityId}', identityId); + let payload = {}; + if (typeof identityId === 'undefined') { + throw new AppwriteException('Missing required parameter: "identityId"'); + } + + + return await this.client.call('delete', apiPath, { 'content-type': 'application/json', }, payload); } @@ -76,22 +120,22 @@ class Account extends Service { /** * 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. + * 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) { - let path = '/account/logs'; + const apiPath = '/account/logs'; let payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -106,7 +150,7 @@ class Account extends Service { * @returns {Promise} */ async updateName(name) { - let path = '/account/name'; + const apiPath = '/account/name'; let payload = {}; if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); @@ -117,7 +161,7 @@ class Account extends Service { payload['name'] = name; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -135,7 +179,7 @@ class Account extends Service { * @returns {Promise} */ async updatePassword(password, oldPassword) { - let path = '/account/password'; + const apiPath = '/account/password'; let payload = {}; if (typeof password === 'undefined') { throw new AppwriteException('Missing required parameter: "password"'); @@ -150,7 +194,7 @@ class Account extends Service { payload['oldPassword'] = oldPassword; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -170,7 +214,7 @@ class Account extends Service { * @returns {Promise} */ async updatePhone(phone, password) { - let path = '/account/phone'; + const apiPath = '/account/phone'; let payload = {}; if (typeof phone === 'undefined') { throw new AppwriteException('Missing required parameter: "phone"'); @@ -189,7 +233,7 @@ class Account extends Service { payload['password'] = password; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -197,16 +241,16 @@ class Account extends Service { /** * Get Account Preferences * - * Get currently logged in user preferences as a key-value object. + * Get the preferences as a key-value object for the currently logged in user. * * @throws {AppwriteException} * @returns {Promise} */ async getPrefs() { - let path = '/account/prefs'; + const apiPath = '/account/prefs'; let payload = {}; - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -223,7 +267,7 @@ class Account extends Service { * @returns {Promise} */ async updatePrefs(prefs) { - let path = '/account/prefs'; + const apiPath = '/account/prefs'; let payload = {}; if (typeof prefs === 'undefined') { throw new AppwriteException('Missing required parameter: "prefs"'); @@ -234,7 +278,7 @@ class Account extends Service { payload['prefs'] = prefs; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -257,7 +301,7 @@ class Account extends Service { * @returns {Promise} */ async createRecovery(email, url) { - let path = '/account/recovery'; + const apiPath = '/account/recovery'; let payload = {}; if (typeof email === 'undefined') { throw new AppwriteException('Missing required parameter: "email"'); @@ -276,7 +320,7 @@ class Account extends Service { payload['url'] = url; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -302,7 +346,7 @@ class Account extends Service { * @returns {Promise} */ async updateRecovery(userId, secret, password, passwordAgain) { - let path = '/account/recovery'; + const apiPath = '/account/recovery'; let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -337,7 +381,7 @@ class Account extends Service { payload['passwordAgain'] = passwordAgain; } - return await this.client.call('put', path, { + return await this.client.call('put', apiPath, { 'content-type': 'application/json', }, payload); } @@ -345,17 +389,17 @@ class Account extends Service { /** * List Sessions * - * Get currently logged in user list of active sessions across different - * devices. + * Get the list of active sessions across different devices for the currently + * logged in user. * * @throws {AppwriteException} * @returns {Promise} */ async listSessions() { - let path = '/account/sessions'; + const apiPath = '/account/sessions'; let payload = {}; - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -370,10 +414,10 @@ class Account extends Service { * @returns {Promise} */ async deleteSessions() { - let path = '/account/sessions'; + const apiPath = '/account/sessions'; let payload = {}; - return await this.client.call('delete', path, { + return await this.client.call('delete', apiPath, { 'content-type': 'application/json', }, payload); } @@ -389,14 +433,14 @@ class Account extends Service { * @returns {Promise} */ async getSession(sessionId) { - let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId); + const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId); let payload = {}; if (typeof sessionId === 'undefined') { throw new AppwriteException('Missing required parameter: "sessionId"'); } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -413,14 +457,14 @@ class Account extends Service { * @returns {Promise} */ async updateSession(sessionId) { - let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId); + const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId); let payload = {}; if (typeof sessionId === 'undefined') { throw new AppwriteException('Missing required parameter: "sessionId"'); } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -428,24 +472,24 @@ class Account extends Service { /** * 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. - * + * 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](/docs/client/account#accountDeleteSessions) instead. * * @param {string} sessionId * @throws {AppwriteException} * @returns {Promise} */ async deleteSession(sessionId) { - let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId); + const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId); let payload = {}; if (typeof sessionId === 'undefined') { throw new AppwriteException('Missing required parameter: "sessionId"'); } - return await this.client.call('delete', path, { + return await this.client.call('delete', apiPath, { 'content-type': 'application/json', }, payload); } @@ -461,10 +505,10 @@ class Account extends Service { * @returns {Promise} */ async updateStatus() { - let path = '/account/status'; + const apiPath = '/account/status'; let payload = {}; - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -493,7 +537,7 @@ class Account extends Service { * @returns {Promise} */ async createVerification(url) { - let path = '/account/verification'; + const apiPath = '/account/verification'; let payload = {}; if (typeof url === 'undefined') { throw new AppwriteException('Missing required parameter: "url"'); @@ -504,7 +548,7 @@ class Account extends Service { payload['url'] = url; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -523,7 +567,7 @@ class Account extends Service { * @returns {Promise} */ async updateVerification(userId, secret) { - let path = '/account/verification'; + const apiPath = '/account/verification'; let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -542,7 +586,7 @@ class Account extends Service { payload['secret'] = secret; } - return await this.client.call('put', path, { + return await this.client.call('put', apiPath, { 'content-type': 'application/json', }, payload); } @@ -561,10 +605,10 @@ class Account extends Service { * @returns {Promise} */ async createPhoneVerification() { - let path = '/account/verification/phone'; + const apiPath = '/account/verification/phone'; let payload = {}; - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -583,7 +627,7 @@ class Account extends Service { * @returns {Promise} */ async updatePhoneVerification(userId, secret) { - let path = '/account/verification/phone'; + const apiPath = '/account/verification/phone'; let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -602,7 +646,7 @@ class Account extends Service { payload['secret'] = secret; } - return await this.client.call('put', path, { + return await this.client.call('put', apiPath, { 'content-type': 'application/json', }, payload); } diff --git a/lib/services/avatars.js b/lib/services/avatars.js index 32d662a..1f6d26a 100644 --- a/lib/services/avatars.js +++ b/lib/services/avatars.js @@ -35,7 +35,7 @@ class Avatars extends Service { * @returns {Promise} */ async getBrowser(code, width, height, quality) { - let path = '/avatars/browsers/{code}'.replace('{code}', code); + const apiPath = '/avatars/browsers/{code}'.replace('{code}', code); let payload = {}; if (typeof code === 'undefined') { throw new AppwriteException('Missing required parameter: "code"'); @@ -54,7 +54,7 @@ class Avatars extends Service { payload['quality'] = quality; } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload, 'arraybuffer'); } @@ -80,7 +80,7 @@ class Avatars extends Service { * @returns {Promise} */ async getCreditCard(code, width, height, quality) { - let path = '/avatars/credit-cards/{code}'.replace('{code}', code); + const apiPath = '/avatars/credit-cards/{code}'.replace('{code}', code); let payload = {}; if (typeof code === 'undefined') { throw new AppwriteException('Missing required parameter: "code"'); @@ -99,7 +99,7 @@ class Avatars extends Service { payload['quality'] = quality; } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload, 'arraybuffer'); } @@ -116,7 +116,7 @@ class Avatars extends Service { * @returns {Promise} */ async getFavicon(url) { - let path = '/avatars/favicon'; + const apiPath = '/avatars/favicon'; let payload = {}; if (typeof url === 'undefined') { throw new AppwriteException('Missing required parameter: "url"'); @@ -127,7 +127,7 @@ class Avatars extends Service { payload['url'] = url; } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload, 'arraybuffer'); } @@ -154,7 +154,7 @@ class Avatars extends Service { * @returns {Promise} */ async getFlag(code, width, height, quality) { - let path = '/avatars/flags/{code}'.replace('{code}', code); + const apiPath = '/avatars/flags/{code}'.replace('{code}', code); let payload = {}; if (typeof code === 'undefined') { throw new AppwriteException('Missing required parameter: "code"'); @@ -173,7 +173,7 @@ class Avatars extends Service { payload['quality'] = quality; } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload, 'arraybuffer'); } @@ -199,7 +199,7 @@ class Avatars extends Service { * @returns {Promise} */ async getImage(url, width, height) { - let path = '/avatars/image'; + const apiPath = '/avatars/image'; let payload = {}; if (typeof url === 'undefined') { throw new AppwriteException('Missing required parameter: "url"'); @@ -218,7 +218,7 @@ class Avatars extends Service { payload['height'] = height; } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload, 'arraybuffer'); } @@ -251,7 +251,7 @@ class Avatars extends Service { * @returns {Promise} */ async getInitials(name, width, height, background) { - let path = '/avatars/initials'; + const apiPath = '/avatars/initials'; let payload = {}; if (typeof name !== 'undefined') { @@ -270,7 +270,7 @@ class Avatars extends Service { payload['background'] = background; } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload, 'arraybuffer'); } @@ -290,7 +290,7 @@ class Avatars extends Service { * @returns {Promise} */ async getQR(text, size, margin, download) { - let path = '/avatars/qr'; + const apiPath = '/avatars/qr'; let payload = {}; if (typeof text === 'undefined') { throw new AppwriteException('Missing required parameter: "text"'); @@ -313,7 +313,7 @@ class Avatars extends Service { payload['download'] = download; } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload, 'arraybuffer'); } diff --git a/lib/services/databases.js b/lib/services/databases.js index f14ba54..c50c4b0 100644 --- a/lib/services/databases.js +++ b/lib/services/databases.js @@ -26,7 +26,7 @@ class Databases extends Service { * @returns {Promise} */ async list(queries, search) { - let path = '/databases'; + const apiPath = '/databases'; let payload = {}; if (typeof queries !== 'undefined') { @@ -37,7 +37,7 @@ class Databases extends Service { payload['search'] = search; } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -50,11 +50,12 @@ class Databases extends Service { * * @param {string} databaseId * @param {string} name + * @param {boolean} enabled * @throws {AppwriteException} * @returns {Promise} */ - async create(databaseId, name) { - let path = '/databases'; + async create(databaseId, name, enabled) { + const apiPath = '/databases'; let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -73,7 +74,11 @@ class Databases extends Service { payload['name'] = name; } - return await this.client.call('post', path, { + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -89,14 +94,14 @@ class Databases extends Service { * @returns {Promise} */ async get(databaseId) { - let path = '/databases/{databaseId}'.replace('{databaseId}', databaseId); + const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -108,11 +113,12 @@ class Databases extends Service { * * @param {string} databaseId * @param {string} name + * @param {boolean} enabled * @throws {AppwriteException} * @returns {Promise} */ - async update(databaseId, name) { - let path = '/databases/{databaseId}'.replace('{databaseId}', databaseId); + async update(databaseId, name, enabled) { + const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -127,7 +133,11 @@ class Databases extends Service { payload['name'] = name; } - return await this.client.call('put', path, { + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + + return await this.client.call('put', apiPath, { 'content-type': 'application/json', }, payload); } @@ -143,14 +153,14 @@ class Databases extends Service { * @returns {Promise} */ async delete(databaseId) { - let path = '/databases/{databaseId}'.replace('{databaseId}', databaseId); + const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } - return await this.client.call('delete', path, { + return await this.client.call('delete', apiPath, { 'content-type': 'application/json', }, payload); } @@ -168,7 +178,7 @@ class Databases extends Service { * @returns {Promise} */ async listCollections(databaseId, queries, search) { - let path = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId); + const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -183,7 +193,7 @@ class Databases extends Service { payload['search'] = search; } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -201,11 +211,12 @@ class Databases extends Service { * @param {string} name * @param {string[]} permissions * @param {boolean} documentSecurity + * @param {boolean} enabled * @throws {AppwriteException} * @returns {Promise} */ - async createCollection(databaseId, collectionId, name, permissions, documentSecurity) { - let path = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId); + async createCollection(databaseId, collectionId, name, permissions, documentSecurity, enabled) { + const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -236,7 +247,11 @@ class Databases extends Service { payload['documentSecurity'] = documentSecurity; } - return await this.client.call('post', path, { + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -253,7 +268,7 @@ class Databases extends Service { * @returns {Promise} */ async getCollection(databaseId, collectionId) { - let path = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -264,7 +279,7 @@ class Databases extends Service { } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -284,7 +299,7 @@ class Databases extends Service { * @returns {Promise} */ async updateCollection(databaseId, collectionId, name, permissions, documentSecurity, enabled) { - let path = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -315,7 +330,7 @@ class Databases extends Service { payload['enabled'] = enabled; } - return await this.client.call('put', path, { + return await this.client.call('put', apiPath, { 'content-type': 'application/json', }, payload); } @@ -332,7 +347,7 @@ class Databases extends Service { * @returns {Promise} */ async deleteCollection(databaseId, collectionId) { - let path = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -343,7 +358,7 @@ class Databases extends Service { } - return await this.client.call('delete', path, { + return await this.client.call('delete', apiPath, { 'content-type': 'application/json', }, payload); } @@ -353,11 +368,12 @@ class Databases extends Service { * * @param {string} databaseId * @param {string} collectionId + * @param {string[]} queries * @throws {AppwriteException} * @returns {Promise} */ - async listAttributes(databaseId, collectionId) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + async listAttributes(databaseId, collectionId, queries) { + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -368,7 +384,11 @@ class Databases extends Service { } - return await this.client.call('get', path, { + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -389,7 +409,7 @@ class Databases extends Service { * @returns {Promise} */ async createBooleanAttribute(databaseId, collectionId, key, required, xdefault, array) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -424,7 +444,7 @@ class Databases extends Service { payload['array'] = array; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -441,7 +461,7 @@ class Databases extends Service { * @returns {Promise} */ async updateBooleanAttribute(databaseId, collectionId, key, required, xdefault) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -472,7 +492,7 @@ class Databases extends Service { payload['default'] = xdefault; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -490,7 +510,7 @@ class Databases extends Service { * @returns {Promise} */ async createDatetimeAttribute(databaseId, collectionId, key, required, xdefault, array) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -525,7 +545,7 @@ class Databases extends Service { payload['array'] = array; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -542,7 +562,7 @@ class Databases extends Service { * @returns {Promise} */ async updateDatetimeAttribute(databaseId, collectionId, key, required, xdefault) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -573,7 +593,7 @@ class Databases extends Service { payload['default'] = xdefault; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -594,7 +614,7 @@ class Databases extends Service { * @returns {Promise} */ async createEmailAttribute(databaseId, collectionId, key, required, xdefault, array) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -629,7 +649,7 @@ class Databases extends Service { payload['array'] = array; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -650,7 +670,7 @@ class Databases extends Service { * @returns {Promise} */ async updateEmailAttribute(databaseId, collectionId, key, required, xdefault) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -681,7 +701,7 @@ class Databases extends Service { payload['default'] = xdefault; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -700,7 +720,7 @@ class Databases extends Service { * @returns {Promise} */ async createEnumAttribute(databaseId, collectionId, key, elements, required, xdefault, array) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -743,7 +763,7 @@ class Databases extends Service { payload['array'] = array; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -765,7 +785,7 @@ class Databases extends Service { * @returns {Promise} */ async updateEnumAttribute(databaseId, collectionId, key, elements, required, xdefault) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -804,7 +824,7 @@ class Databases extends Service { payload['default'] = xdefault; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -828,7 +848,7 @@ class Databases extends Service { * @returns {Promise} */ async createFloatAttribute(databaseId, collectionId, key, required, min, max, xdefault, array) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -871,7 +891,7 @@ class Databases extends Service { payload['array'] = array; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -894,7 +914,7 @@ class Databases extends Service { * @returns {Promise} */ async updateFloatAttribute(databaseId, collectionId, key, required, min, max, xdefault) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -941,7 +961,7 @@ class Databases extends Service { payload['default'] = xdefault; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -965,7 +985,7 @@ class Databases extends Service { * @returns {Promise} */ async createIntegerAttribute(databaseId, collectionId, key, required, min, max, xdefault, array) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1008,7 +1028,7 @@ class Databases extends Service { payload['array'] = array; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -1031,7 +1051,7 @@ class Databases extends Service { * @returns {Promise} */ async updateIntegerAttribute(databaseId, collectionId, key, required, min, max, xdefault) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1078,7 +1098,7 @@ class Databases extends Service { payload['default'] = xdefault; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -1099,7 +1119,7 @@ class Databases extends Service { * @returns {Promise} */ async createIpAttribute(databaseId, collectionId, key, required, xdefault, array) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1134,7 +1154,7 @@ class Databases extends Service { payload['array'] = array; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -1155,7 +1175,7 @@ class Databases extends Service { * @returns {Promise} */ async updateIpAttribute(databaseId, collectionId, key, required, xdefault) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1186,7 +1206,7 @@ class Databases extends Service { payload['default'] = xdefault; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -1210,7 +1230,7 @@ class Databases extends Service { * @returns {Promise} */ async createRelationshipAttribute(databaseId, collectionId, relatedCollectionId, type, twoWay, key, twoWayKey, onDelete) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1253,7 +1273,7 @@ class Databases extends Service { payload['onDelete'] = onDelete; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -1271,11 +1291,12 @@ class Databases extends Service { * @param {boolean} required * @param {string} xdefault * @param {boolean} array + * @param {boolean} encrypt * @throws {AppwriteException} * @returns {Promise} */ - async createStringAttribute(databaseId, collectionId, key, size, required, xdefault, array) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + async createStringAttribute(databaseId, collectionId, key, size, required, xdefault, array, encrypt) { + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1318,7 +1339,11 @@ class Databases extends Service { payload['array'] = array; } - return await this.client.call('post', path, { + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } + + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -1339,7 +1364,7 @@ class Databases extends Service { * @returns {Promise} */ async updateStringAttribute(databaseId, collectionId, key, required, xdefault) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1370,7 +1395,7 @@ class Databases extends Service { payload['default'] = xdefault; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -1391,7 +1416,7 @@ class Databases extends Service { * @returns {Promise} */ async createUrlAttribute(databaseId, collectionId, key, required, xdefault, array) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1426,7 +1451,7 @@ class Databases extends Service { payload['array'] = array; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -1447,7 +1472,7 @@ class Databases extends Service { * @returns {Promise} */ async updateUrlAttribute(databaseId, collectionId, key, required, xdefault) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1478,7 +1503,7 @@ class Databases extends Service { payload['default'] = xdefault; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -1493,7 +1518,7 @@ class Databases extends Service { * @returns {Promise} */ async getAttribute(databaseId, collectionId, key) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1508,7 +1533,7 @@ class Databases extends Service { } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -1523,7 +1548,7 @@ class Databases extends Service { * @returns {Promise} */ async deleteAttribute(databaseId, collectionId, key) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1538,7 +1563,7 @@ class Databases extends Service { } - return await this.client.call('delete', path, { + return await this.client.call('delete', apiPath, { 'content-type': 'application/json', }, payload); } @@ -1558,7 +1583,7 @@ class Databases extends Service { * @returns {Promise} */ async updateRelationshipAttribute(databaseId, collectionId, key, onDelete) { - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1577,7 +1602,7 @@ class Databases extends Service { payload['onDelete'] = onDelete; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -1595,7 +1620,7 @@ class Databases extends Service { * @returns {Promise} */ async listDocuments(databaseId, collectionId, queries) { - let path = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1610,7 +1635,7 @@ class Databases extends Service { payload['queries'] = queries; } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -1632,7 +1657,7 @@ class Databases extends Service { * @returns {Promise} */ async createDocument(databaseId, collectionId, documentId, data, permissions) { - let path = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1663,7 +1688,7 @@ class Databases extends Service { payload['permissions'] = permissions; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -1682,7 +1707,7 @@ class Databases extends Service { * @returns {Promise} */ async getDocument(databaseId, collectionId, documentId, queries) { - let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1701,7 +1726,7 @@ class Databases extends Service { payload['queries'] = queries; } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -1721,7 +1746,7 @@ class Databases extends Service { * @returns {Promise} */ async updateDocument(databaseId, collectionId, documentId, data, permissions) { - let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1744,7 +1769,7 @@ class Databases extends Service { payload['permissions'] = permissions; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -1761,7 +1786,7 @@ class Databases extends Service { * @returns {Promise} */ async deleteDocument(databaseId, collectionId, documentId) { - let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1776,7 +1801,7 @@ class Databases extends Service { } - return await this.client.call('delete', path, { + return await this.client.call('delete', apiPath, { 'content-type': 'application/json', }, payload); } @@ -1786,11 +1811,12 @@ class Databases extends Service { * * @param {string} databaseId * @param {string} collectionId + * @param {string[]} queries * @throws {AppwriteException} * @returns {Promise} */ - async listIndexes(databaseId, collectionId) { - let path = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + async listIndexes(databaseId, collectionId, queries) { + const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1801,7 +1827,11 @@ class Databases extends Service { } - return await this.client.call('get', path, { + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -1819,7 +1849,7 @@ class Databases extends Service { * @returns {Promise} */ async createIndex(databaseId, collectionId, key, type, attributes, orders) { - let path = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1858,7 +1888,7 @@ class Databases extends Service { payload['orders'] = orders; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -1873,7 +1903,7 @@ class Databases extends Service { * @returns {Promise} */ async getIndex(databaseId, collectionId, key) { - let path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1888,7 +1918,7 @@ class Databases extends Service { } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -1903,7 +1933,7 @@ class Databases extends Service { * @returns {Promise} */ async deleteIndex(databaseId, collectionId, key) { - let path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); let payload = {}; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1918,7 +1948,7 @@ class Databases extends Service { } - return await this.client.call('delete', path, { + return await this.client.call('delete', apiPath, { 'content-type': 'application/json', }, payload); } diff --git a/lib/services/functions.js b/lib/services/functions.js index 953fb5a..424e280 100644 --- a/lib/services/functions.js +++ b/lib/services/functions.js @@ -26,7 +26,7 @@ class Functions extends Service { * @returns {Promise} */ async list(queries, search) { - let path = '/functions'; + const apiPath = '/functions'; let payload = {}; if (typeof queries !== 'undefined') { @@ -37,7 +37,7 @@ class Functions extends Service { payload['search'] = search; } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -57,11 +57,23 @@ class Functions extends Service { * @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, name, runtime, execute, events, schedule, timeout, enabled) { - let path = '/functions'; + async create(functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, templateRepository, templateOwner, templateRootDirectory, templateBranch) { + const apiPath = '/functions'; let payload = {}; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); @@ -84,14 +96,14 @@ class Functions extends Service { payload['name'] = name; } - if (typeof execute !== 'undefined') { - payload['execute'] = execute; - } - if (typeof runtime !== 'undefined') { payload['runtime'] = runtime; } + if (typeof execute !== 'undefined') { + payload['execute'] = execute; + } + if (typeof events !== 'undefined') { payload['events'] = events; } @@ -108,7 +120,55 @@ class Functions extends Service { payload['enabled'] = enabled; } - return await this.client.call('post', path, { + if (typeof logging !== 'undefined') { + payload['logging'] = logging; + } + + if (typeof entrypoint !== 'undefined') { + payload['entrypoint'] = entrypoint; + } + + if (typeof commands !== 'undefined') { + payload['commands'] = commands; + } + + if (typeof installationId !== 'undefined') { + payload['installationId'] = installationId; + } + + if (typeof providerRepositoryId !== 'undefined') { + payload['providerRepositoryId'] = providerRepositoryId; + } + + if (typeof providerBranch !== 'undefined') { + payload['providerBranch'] = providerBranch; + } + + if (typeof providerSilentMode !== 'undefined') { + payload['providerSilentMode'] = providerSilentMode; + } + + if (typeof providerRootDirectory !== 'undefined') { + payload['providerRootDirectory'] = providerRootDirectory; + } + + if (typeof templateRepository !== 'undefined') { + payload['templateRepository'] = templateRepository; + } + + if (typeof templateOwner !== 'undefined') { + payload['templateOwner'] = templateOwner; + } + + if (typeof templateRootDirectory !== 'undefined') { + payload['templateRootDirectory'] = templateRootDirectory; + } + + if (typeof templateBranch !== 'undefined') { + payload['templateBranch'] = templateBranch; + } + + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -122,10 +182,10 @@ class Functions extends Service { * @returns {Promise} */ async listRuntimes() { - let path = '/functions/runtimes'; + const apiPath = '/functions/runtimes'; let payload = {}; - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -140,14 +200,14 @@ class Functions extends Service { * @returns {Promise} */ async get(functionId) { - let path = '/functions/{functionId}'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId); let payload = {}; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -159,16 +219,25 @@ class Functions extends Service { * * @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, name, execute, events, schedule, timeout, enabled) { - let path = '/functions/{functionId}'.replace('{functionId}', functionId); + async update(functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory) { + const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId); let payload = {}; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); @@ -178,11 +247,19 @@ class Functions extends Service { throw new AppwriteException('Missing required parameter: "name"'); } + if (typeof runtime === 'undefined') { + throw new AppwriteException('Missing required parameter: "runtime"'); + } + if (typeof name !== 'undefined') { payload['name'] = name; } + if (typeof runtime !== 'undefined') { + payload['runtime'] = runtime; + } + if (typeof execute !== 'undefined') { payload['execute'] = execute; } @@ -203,7 +280,39 @@ class Functions extends Service { payload['enabled'] = enabled; } - return await this.client.call('put', path, { + if (typeof logging !== 'undefined') { + payload['logging'] = logging; + } + + if (typeof entrypoint !== 'undefined') { + payload['entrypoint'] = entrypoint; + } + + if (typeof commands !== 'undefined') { + payload['commands'] = commands; + } + + if (typeof installationId !== 'undefined') { + payload['installationId'] = installationId; + } + + if (typeof providerRepositoryId !== 'undefined') { + payload['providerRepositoryId'] = providerRepositoryId; + } + + if (typeof providerBranch !== 'undefined') { + payload['providerBranch'] = providerBranch; + } + + if (typeof providerSilentMode !== 'undefined') { + payload['providerSilentMode'] = providerSilentMode; + } + + if (typeof providerRootDirectory !== 'undefined') { + payload['providerRootDirectory'] = providerRootDirectory; + } + + return await this.client.call('put', apiPath, { 'content-type': 'application/json', }, payload); } @@ -218,14 +327,14 @@ class Functions extends Service { * @returns {Promise} */ async delete(functionId) { - let path = '/functions/{functionId}'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId); let payload = {}; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } - return await this.client.call('delete', path, { + return await this.client.call('delete', apiPath, { 'content-type': 'application/json', }, payload); } @@ -243,7 +352,7 @@ class Functions extends Service { * @returns {Promise} */ async listDeployments(functionId, queries, search) { - let path = '/functions/{functionId}/deployments'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId); let payload = {}; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); @@ -258,7 +367,7 @@ class Functions extends Service { payload['search'] = search; } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -275,26 +384,23 @@ class Functions extends Service { * 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. + * Use the "command" param to set the entrypoint used to execute your code. * * @param {string} functionId - * @param {string} entrypoint * @param {InputFile} code * @param {boolean} activate + * @param {string} entrypoint + * @param {string} commands * @throws {AppwriteException} * @returns {Promise} */ - async createDeployment(functionId, entrypoint, code, activate, onProgress = () => {}) { - let path = '/functions/{functionId}/deployments'.replace('{functionId}', functionId); + async createDeployment(functionId, code, activate, entrypoint, commands, onProgress = () => {}) { + const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId); let payload = {}; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } - if (typeof entrypoint === 'undefined') { - throw new AppwriteException('Missing required parameter: "entrypoint"'); - } - if (typeof code === 'undefined') { throw new AppwriteException('Missing required parameter: "code"'); } @@ -308,6 +414,10 @@ class Functions extends Service { payload['entrypoint'] = entrypoint; } + if (typeof commands !== 'undefined') { + payload['commands'] = commands; + } + if (typeof code !== 'undefined') { payload['code'] = code; } @@ -353,7 +463,7 @@ class Functions extends Service { const stream = Stream.Readable.from(currentChunk); payload['code'] = { type: 'file', file: stream, filename: code.filename }; - response = await selfClient.call('post', path, headers, payload); + response = await selfClient.call('post', apiPath, headers, payload); if (!id) { id = response['$id']; @@ -449,7 +559,7 @@ class Functions extends Service { * @returns {Promise} */ async getDeployment(functionId, deploymentId) { - let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); + const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); let payload = {}; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); @@ -460,7 +570,7 @@ class Functions extends Service { } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -478,7 +588,7 @@ class Functions extends Service { * @returns {Promise} */ async updateDeployment(functionId, deploymentId) { - let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); + const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); let payload = {}; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); @@ -489,7 +599,7 @@ class Functions extends Service { } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -505,7 +615,7 @@ class Functions extends Service { * @returns {Promise} */ async deleteDeployment(functionId, deploymentId) { - let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); + const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); let payload = {}; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); @@ -516,7 +626,7 @@ class Functions extends Service { } - return await this.client.call('delete', path, { + return await this.client.call('delete', apiPath, { 'content-type': 'application/json', }, payload); } @@ -524,6 +634,9 @@ class Functions extends Service { /** * 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 @@ -531,7 +644,7 @@ class Functions extends Service { * @returns {Promise} */ async createBuild(functionId, deploymentId, buildId) { - let path = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId); + const apiPath = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId); let payload = {}; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); @@ -546,11 +659,36 @@ class Functions extends Service { } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } + /** + * Download Deployment + * + * @param {string} functionId + * @param {string} deploymentId + * @throws {AppwriteException} + * @returns {Promise} + */ + async downloadDeployment(functionId, deploymentId) { + const apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); + let payload = {}; + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + + return await this.client.call('get', apiPath, { + 'content-type': 'application/json', + }, payload, 'arraybuffer'); + } + /** * List Executions * @@ -564,7 +702,7 @@ class Functions extends Service { * @returns {Promise} */ async listExecutions(functionId, queries, search) { - let path = '/functions/{functionId}/executions'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId); let payload = {}; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); @@ -579,7 +717,7 @@ class Functions extends Service { payload['search'] = search; } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -593,28 +731,43 @@ class Functions extends Service { * function execution process will start asynchronously. * * @param {string} functionId - * @param {string} data + * @param {string} body * @param {boolean} async + * @param {string} xpath + * @param {string} method + * @param {object} headers * @throws {AppwriteException} * @returns {Promise} */ - async createExecution(functionId, data, async) { - let path = '/functions/{functionId}/executions'.replace('{functionId}', functionId); + async createExecution(functionId, body, async, xpath, method, headers) { + const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId); let payload = {}; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } - if (typeof data !== 'undefined') { - payload['data'] = data; + if (typeof body !== 'undefined') { + payload['body'] = body; } if (typeof async !== 'undefined') { payload['async'] = async; } - return await this.client.call('post', path, { + if (typeof xpath !== 'undefined') { + payload['path'] = xpath; + } + + if (typeof method !== 'undefined') { + payload['method'] = method; + } + + if (typeof headers !== 'undefined') { + payload['headers'] = headers; + } + + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -630,7 +783,7 @@ class Functions extends Service { * @returns {Promise} */ async getExecution(functionId, executionId) { - let path = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId); + const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId); let payload = {}; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); @@ -641,7 +794,7 @@ class Functions extends Service { } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -656,14 +809,14 @@ class Functions extends Service { * @returns {Promise} */ async listVariables(functionId) { - let path = '/functions/{functionId}/variables'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId); let payload = {}; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -671,8 +824,8 @@ class Functions extends Service { /** * Create Variable * - * Create a new function variable. These variables can be accessed within - * function in the `env` object under the request 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 @@ -681,7 +834,7 @@ class Functions extends Service { * @returns {Promise} */ async createVariable(functionId, key, value) { - let path = '/functions/{functionId}/variables'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId); let payload = {}; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); @@ -704,7 +857,7 @@ class Functions extends Service { payload['value'] = value; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -720,7 +873,7 @@ class Functions extends Service { * @returns {Promise} */ async getVariable(functionId, variableId) { - let path = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); + const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); let payload = {}; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); @@ -731,7 +884,7 @@ class Functions extends Service { } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -749,7 +902,7 @@ class Functions extends Service { * @returns {Promise} */ async updateVariable(functionId, variableId, key, value) { - let path = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); + const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); let payload = {}; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); @@ -772,7 +925,7 @@ class Functions extends Service { payload['value'] = value; } - return await this.client.call('put', path, { + return await this.client.call('put', apiPath, { 'content-type': 'application/json', }, payload); } @@ -788,7 +941,7 @@ class Functions extends Service { * @returns {Promise} */ async deleteVariable(functionId, variableId) { - let path = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); + const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); let payload = {}; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); @@ -799,7 +952,7 @@ class Functions extends Service { } - return await this.client.call('delete', path, { + return await this.client.call('delete', apiPath, { 'content-type': 'application/json', }, payload); } diff --git a/lib/services/graphql.js b/lib/services/graphql.js index 3d133e7..abba28c 100644 --- a/lib/services/graphql.js +++ b/lib/services/graphql.js @@ -24,7 +24,7 @@ class Graphql extends Service { * @returns {Promise} */ async query(query) { - let path = '/graphql'; + const apiPath = '/graphql'; let payload = {}; if (typeof query === 'undefined') { throw new AppwriteException('Missing required parameter: "query"'); @@ -35,7 +35,7 @@ class Graphql extends Service { payload['query'] = query; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'x-sdk-graphql': 'true', 'content-type': 'application/json', }, payload); @@ -51,7 +51,7 @@ class Graphql extends Service { * @returns {Promise} */ async mutation(query) { - let path = '/graphql/mutation'; + const apiPath = '/graphql/mutation'; let payload = {}; if (typeof query === 'undefined') { throw new AppwriteException('Missing required parameter: "query"'); @@ -62,7 +62,7 @@ class Graphql extends Service { payload['query'] = query; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'x-sdk-graphql': 'true', 'content-type': 'application/json', }, payload); diff --git a/lib/services/health.js b/lib/services/health.js index 33432ab..b4383bf 100644 --- a/lib/services/health.js +++ b/lib/services/health.js @@ -23,10 +23,10 @@ class Health extends Service { * @returns {Promise} */ async get() { - let path = '/health'; + const apiPath = '/health'; let payload = {}; - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -40,10 +40,10 @@ class Health extends Service { * @returns {Promise} */ async getAntivirus() { - let path = '/health/anti-virus'; + const apiPath = '/health/anti-virus'; let payload = {}; - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -51,17 +51,17 @@ class Health extends Service { /** * Get Cache * - * Check the Appwrite in-memory cache server is up and connection is + * Check the Appwrite in-memory cache servers are up and connection is * successful. * * @throws {AppwriteException} * @returns {Promise} */ async getCache() { - let path = '/health/cache'; + const apiPath = '/health/cache'; let payload = {}; - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -69,16 +69,51 @@ class Health extends Service { /** * Get DB * - * Check the Appwrite database server is up and connection is successful. + * Check the Appwrite database servers are up and connection is successful. * * @throws {AppwriteException} * @returns {Promise} */ async getDB() { - let path = '/health/db'; + const apiPath = '/health/db'; let payload = {}; - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { + '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() { + const apiPath = '/health/pubsub'; + let payload = {}; + + return await this.client.call('get', apiPath, { + '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() { + const apiPath = '/health/queue'; + let payload = {}; + + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -94,10 +129,10 @@ class Health extends Service { * @returns {Promise} */ async getQueueCertificates() { - let path = '/health/queue/certificates'; + const apiPath = '/health/queue/certificates'; let payload = {}; - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -109,10 +144,10 @@ class Health extends Service { * @returns {Promise} */ async getQueueFunctions() { - let path = '/health/queue/functions'; + const apiPath = '/health/queue/functions'; let payload = {}; - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -127,10 +162,10 @@ class Health extends Service { * @returns {Promise} */ async getQueueLogs() { - let path = '/health/queue/logs'; + const apiPath = '/health/queue/logs'; let payload = {}; - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -145,10 +180,10 @@ class Health extends Service { * @returns {Promise} */ async getQueueWebhooks() { - let path = '/health/queue/webhooks'; + const apiPath = '/health/queue/webhooks'; let payload = {}; - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -162,10 +197,10 @@ class Health extends Service { * @returns {Promise} */ async getStorageLocal() { - let path = '/health/storage/local'; + const apiPath = '/health/storage/local'; let payload = {}; - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -185,10 +220,10 @@ class Health extends Service { * @returns {Promise} */ async getTime() { - let path = '/health/time'; + const apiPath = '/health/time'; let payload = {}; - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } diff --git a/lib/services/locale.js b/lib/services/locale.js index 895df95..9c450c4 100644 --- a/lib/services/locale.js +++ b/lib/services/locale.js @@ -28,10 +28,28 @@ class Locale extends Service { * @returns {Promise} */ async get() { - let path = '/locale'; + const apiPath = '/locale'; let payload = {}; - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { + 'content-type': 'application/json', + }, payload); + } + + /** + * List Locale Codes + * + * List of all locale codes in [ISO + * 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). + * + * @throws {AppwriteException} + * @returns {Promise} + */ + async listCodes() { + const apiPath = '/locale/codes'; + let payload = {}; + + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -46,10 +64,10 @@ class Locale extends Service { * @returns {Promise} */ async listContinents() { - let path = '/locale/continents'; + const apiPath = '/locale/continents'; let payload = {}; - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -64,10 +82,10 @@ class Locale extends Service { * @returns {Promise} */ async listCountries() { - let path = '/locale/countries'; + const apiPath = '/locale/countries'; let payload = {}; - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -82,10 +100,10 @@ class Locale extends Service { * @returns {Promise} */ async listCountriesEU() { - let path = '/locale/countries/eu'; + const apiPath = '/locale/countries/eu'; let payload = {}; - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -100,10 +118,10 @@ class Locale extends Service { * @returns {Promise} */ async listCountriesPhones() { - let path = '/locale/countries/phones'; + const apiPath = '/locale/countries/phones'; let payload = {}; - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -119,10 +137,10 @@ class Locale extends Service { * @returns {Promise} */ async listCurrencies() { - let path = '/locale/currencies'; + const apiPath = '/locale/currencies'; let payload = {}; - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -137,10 +155,10 @@ class Locale extends Service { * @returns {Promise} */ async listLanguages() { - let path = '/locale/languages'; + const apiPath = '/locale/languages'; let payload = {}; - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } diff --git a/lib/services/storage.js b/lib/services/storage.js index a023081..aeb3185 100644 --- a/lib/services/storage.js +++ b/lib/services/storage.js @@ -26,7 +26,7 @@ class Storage extends Service { * @returns {Promise} */ async listBuckets(queries, search) { - let path = '/storage/buckets'; + const apiPath = '/storage/buckets'; let payload = {}; if (typeof queries !== 'undefined') { @@ -37,7 +37,7 @@ class Storage extends Service { payload['search'] = search; } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -61,7 +61,7 @@ class Storage extends Service { * @returns {Promise} */ async createBucket(bucketId, name, permissions, fileSecurity, enabled, maximumFileSize, allowedFileExtensions, compression, encryption, antivirus) { - let path = '/storage/buckets'; + const apiPath = '/storage/buckets'; let payload = {}; if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); @@ -112,7 +112,7 @@ class Storage extends Service { payload['antivirus'] = antivirus; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -128,14 +128,14 @@ class Storage extends Service { * @returns {Promise} */ async getBucket(bucketId) { - let path = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); + const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); let payload = {}; if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -159,7 +159,7 @@ class Storage extends Service { * @returns {Promise} */ async updateBucket(bucketId, name, permissions, fileSecurity, enabled, maximumFileSize, allowedFileExtensions, compression, encryption, antivirus) { - let path = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); + const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); let payload = {}; if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); @@ -206,7 +206,7 @@ class Storage extends Service { payload['antivirus'] = antivirus; } - return await this.client.call('put', path, { + return await this.client.call('put', apiPath, { 'content-type': 'application/json', }, payload); } @@ -221,14 +221,14 @@ class Storage extends Service { * @returns {Promise} */ async deleteBucket(bucketId) { - let path = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); + const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); let payload = {}; if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); } - return await this.client.call('delete', path, { + return await this.client.call('delete', apiPath, { 'content-type': 'application/json', }, payload); } @@ -246,7 +246,7 @@ class Storage extends Service { * @returns {Promise} */ async listFiles(bucketId, queries, search) { - let path = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId); + const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId); let payload = {}; if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); @@ -261,7 +261,7 @@ class Storage extends Service { payload['search'] = search; } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -296,7 +296,7 @@ class Storage extends Service { * @returns {Promise} */ async createFile(bucketId, fileId, file, permissions, onProgress = () => {}) { - let path = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId); + const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId); let payload = {}; if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); @@ -336,7 +336,7 @@ class Storage extends Service { if(fileId != 'unique()') { try { - response = await this.client.call('get', path + '/' + fileId, headers); + response = await this.client.call('get', apiPath + '/' + fileId, headers); chunksUploaded = response.chunksUploaded; } catch(e) { } @@ -367,7 +367,7 @@ class Storage extends Service { const stream = Stream.Readable.from(currentChunk); payload['file'] = { type: 'file', file: stream, filename: file.filename }; - response = await selfClient.call('post', path, headers, payload); + response = await selfClient.call('post', apiPath, headers, payload); if (!id) { id = response['$id']; @@ -464,7 +464,7 @@ class Storage extends Service { * @returns {Promise} */ async getFile(bucketId, fileId) { - let path = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); let payload = {}; if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); @@ -475,7 +475,7 @@ class Storage extends Service { } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -488,12 +488,13 @@ class Storage extends Service { * * @param {string} bucketId * @param {string} fileId + * @param {string} name * @param {string[]} permissions * @throws {AppwriteException} * @returns {Promise} */ - async updateFile(bucketId, fileId, permissions) { - let path = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + async updateFile(bucketId, fileId, name, permissions) { + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); let payload = {}; if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); @@ -504,11 +505,15 @@ class Storage extends Service { } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof permissions !== 'undefined') { payload['permissions'] = permissions; } - return await this.client.call('put', path, { + return await this.client.call('put', apiPath, { 'content-type': 'application/json', }, payload); } @@ -525,7 +530,7 @@ class Storage extends Service { * @returns {Promise} */ async deleteFile(bucketId, fileId) { - let path = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); let payload = {}; if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); @@ -536,7 +541,7 @@ class Storage extends Service { } - return await this.client.call('delete', path, { + return await this.client.call('delete', apiPath, { 'content-type': 'application/json', }, payload); } @@ -554,7 +559,7 @@ class Storage extends Service { * @returns {Promise} */ async getFileDownload(bucketId, fileId) { - let path = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); let payload = {}; if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); @@ -565,7 +570,7 @@ class Storage extends Service { } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload, 'arraybuffer'); } @@ -596,7 +601,7 @@ class Storage extends Service { * @returns {Promise} */ async getFilePreview(bucketId, fileId, width, height, gravity, quality, borderWidth, borderColor, borderRadius, opacity, rotation, background, output) { - let path = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); let payload = {}; if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); @@ -651,7 +656,7 @@ class Storage extends Service { payload['output'] = output; } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload, 'arraybuffer'); } @@ -669,7 +674,7 @@ class Storage extends Service { * @returns {Promise} */ async getFileView(bucketId, fileId) { - let path = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); let payload = {}; if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); @@ -680,7 +685,7 @@ class Storage extends Service { } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload, 'arraybuffer'); } diff --git a/lib/services/teams.js b/lib/services/teams.js index c18056e..d6eddb9 100644 --- a/lib/services/teams.js +++ b/lib/services/teams.js @@ -26,7 +26,7 @@ class Teams extends Service { * @returns {Promise} */ async list(queries, search) { - let path = '/teams'; + const apiPath = '/teams'; let payload = {}; if (typeof queries !== 'undefined') { @@ -37,7 +37,7 @@ class Teams extends Service { payload['search'] = search; } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -56,7 +56,7 @@ class Teams extends Service { * @returns {Promise} */ async create(teamId, name, roles) { - let path = '/teams'; + const apiPath = '/teams'; let payload = {}; if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); @@ -79,7 +79,7 @@ class Teams extends Service { payload['roles'] = roles; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -94,14 +94,14 @@ class Teams extends Service { * @returns {Promise} */ async get(teamId) { - let path = '/teams/{teamId}'.replace('{teamId}', teamId); + const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId); let payload = {}; if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -117,7 +117,7 @@ class Teams extends Service { * @returns {Promise} */ async updateName(teamId, name) { - let path = '/teams/{teamId}'.replace('{teamId}', teamId); + const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId); let payload = {}; if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); @@ -132,7 +132,7 @@ class Teams extends Service { payload['name'] = name; } - return await this.client.call('put', path, { + return await this.client.call('put', apiPath, { 'content-type': 'application/json', }, payload); } @@ -148,14 +148,14 @@ class Teams extends Service { * @returns {Promise} */ async delete(teamId) { - let path = '/teams/{teamId}'.replace('{teamId}', teamId); + const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId); let payload = {}; if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } - return await this.client.call('delete', path, { + return await this.client.call('delete', apiPath, { 'content-type': 'application/json', }, payload); } @@ -173,7 +173,7 @@ class Teams extends Service { * @returns {Promise} */ async listMemberships(teamId, queries, search) { - let path = '/teams/{teamId}/memberships'.replace('{teamId}', teamId); + const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', teamId); let payload = {}; if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); @@ -188,7 +188,7 @@ class Teams extends Service { payload['search'] = search; } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -229,7 +229,7 @@ class Teams extends Service { * @returns {Promise} */ async createMembership(teamId, roles, url, email, userId, phone, name) { - let path = '/teams/{teamId}/memberships'.replace('{teamId}', teamId); + const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', teamId); let payload = {}; if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); @@ -268,7 +268,7 @@ class Teams extends Service { payload['name'] = name; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -285,7 +285,7 @@ class Teams extends Service { * @returns {Promise} */ async getMembership(teamId, membershipId) { - let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); + const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); let payload = {}; if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); @@ -296,17 +296,18 @@ class Teams extends Service { } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } /** - * Update Membership Roles + * Update Membership * * Modify the roles of a team member. Only team members with the owner role * have access to this endpoint. Learn more about [roles and * permissions](/docs/permissions). + * * * @param {string} teamId * @param {string} membershipId @@ -314,8 +315,8 @@ class Teams extends Service { * @throws {AppwriteException} * @returns {Promise} */ - async updateMembershipRoles(teamId, membershipId, roles) { - let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); + async updateMembership(teamId, membershipId, roles) { + const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); let payload = {}; if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); @@ -334,7 +335,7 @@ class Teams extends Service { payload['roles'] = roles; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -352,7 +353,7 @@ class Teams extends Service { * @returns {Promise} */ async deleteMembership(teamId, membershipId) { - let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); + const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); let payload = {}; if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); @@ -363,7 +364,7 @@ class Teams extends Service { } - return await this.client.call('delete', path, { + return await this.client.call('delete', apiPath, { 'content-type': 'application/json', }, payload); } @@ -387,7 +388,7 @@ class Teams extends Service { * @returns {Promise} */ async updateMembershipStatus(teamId, membershipId, userId, secret) { - let path = '/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); + const apiPath = '/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); let payload = {}; if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); @@ -414,7 +415,7 @@ class Teams extends Service { payload['secret'] = secret; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -431,14 +432,14 @@ class Teams extends Service { * @returns {Promise} */ async getPrefs(teamId) { - let path = '/teams/{teamId}/prefs'.replace('{teamId}', teamId); + const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId); let payload = {}; if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -456,7 +457,7 @@ class Teams extends Service { * @returns {Promise} */ async updatePrefs(teamId, prefs) { - let path = '/teams/{teamId}/prefs'.replace('{teamId}', teamId); + const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId); let payload = {}; if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); @@ -471,7 +472,7 @@ class Teams extends Service { payload['prefs'] = prefs; } - return await this.client.call('put', path, { + return await this.client.call('put', apiPath, { 'content-type': 'application/json', }, payload); } diff --git a/lib/services/users.js b/lib/services/users.js index c839822..0ee4f6c 100644 --- a/lib/services/users.js +++ b/lib/services/users.js @@ -26,7 +26,7 @@ class Users extends Service { * @returns {Promise} */ async list(queries, search) { - let path = '/users'; + const apiPath = '/users'; let payload = {}; if (typeof queries !== 'undefined') { @@ -37,7 +37,7 @@ class Users extends Service { payload['search'] = search; } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -56,7 +56,7 @@ class Users extends Service { * @returns {Promise} */ async create(userId, email, phone, password, name) { - let path = '/users'; + const apiPath = '/users'; let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -83,7 +83,7 @@ class Users extends Service { payload['name'] = name; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -104,7 +104,7 @@ class Users extends Service { * @returns {Promise} */ async createArgon2User(userId, email, password, name) { - let path = '/users/argon2'; + const apiPath = '/users/argon2'; let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -135,7 +135,7 @@ class Users extends Service { payload['name'] = name; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -156,7 +156,7 @@ class Users extends Service { * @returns {Promise} */ async createBcryptUser(userId, email, password, name) { - let path = '/users/bcrypt'; + const apiPath = '/users/bcrypt'; let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -187,7 +187,56 @@ class Users extends Service { payload['name'] = name; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { + 'content-type': 'application/json', + }, payload); + } + + /** + * List Identities + * + * Get identities for all users. + * + * @param {string} queries + * @param {string} search + * @throws {AppwriteException} + * @returns {Promise} + */ + async listIdentities(queries, search) { + const apiPath = '/users/identities'; + let payload = {}; + + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + + if (typeof search !== 'undefined') { + payload['search'] = search; + } + + return await this.client.call('get', apiPath, { + 'content-type': 'application/json', + }, payload); + } + + /** + * Delete Identity + * + * Delete an identity by its unique ID. + * + * @param {string} identityId + * @throws {AppwriteException} + * @returns {Promise} + */ + async deleteIdentity(identityId) { + const apiPath = '/users/identities/{identityId}'.replace('{identityId}', identityId); + let payload = {}; + if (typeof identityId === 'undefined') { + throw new AppwriteException('Missing required parameter: "identityId"'); + } + + + return await this.client.call('delete', apiPath, { 'content-type': 'application/json', }, payload); } @@ -208,7 +257,7 @@ class Users extends Service { * @returns {Promise} */ async createMD5User(userId, email, password, name) { - let path = '/users/md5'; + const apiPath = '/users/md5'; let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -239,7 +288,7 @@ class Users extends Service { payload['name'] = name; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -260,7 +309,7 @@ class Users extends Service { * @returns {Promise} */ async createPHPassUser(userId, email, password, name) { - let path = '/users/phpass'; + const apiPath = '/users/phpass'; let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -291,7 +340,7 @@ class Users extends Service { payload['name'] = name; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -317,7 +366,7 @@ class Users extends Service { * @returns {Promise} */ async createScryptUser(userId, email, password, passwordSalt, passwordCpu, passwordMemory, passwordParallel, passwordLength, name) { - let path = '/users/scrypt'; + const apiPath = '/users/scrypt'; let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -388,7 +437,7 @@ class Users extends Service { payload['name'] = name; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -412,7 +461,7 @@ class Users extends Service { * @returns {Promise} */ async createScryptModifiedUser(userId, email, password, passwordSalt, passwordSaltSeparator, passwordSignerKey, name) { - let path = '/users/scrypt-modified'; + const apiPath = '/users/scrypt-modified'; let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -467,7 +516,7 @@ class Users extends Service { payload['name'] = name; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -489,7 +538,7 @@ class Users extends Service { * @returns {Promise} */ async createSHAUser(userId, email, password, passwordVersion, name) { - let path = '/users/sha'; + const apiPath = '/users/sha'; let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -524,7 +573,7 @@ class Users extends Service { payload['name'] = name; } - return await this.client.call('post', path, { + return await this.client.call('post', apiPath, { 'content-type': 'application/json', }, payload); } @@ -539,14 +588,14 @@ class Users extends Service { * @returns {Promise} */ async get(userId) { - let path = '/users/{userId}'.replace('{userId}', userId); + const apiPath = '/users/{userId}'.replace('{userId}', userId); let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -565,14 +614,14 @@ class Users extends Service { * @returns {Promise} */ async delete(userId) { - let path = '/users/{userId}'.replace('{userId}', userId); + const apiPath = '/users/{userId}'.replace('{userId}', userId); let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } - return await this.client.call('delete', path, { + return await this.client.call('delete', apiPath, { 'content-type': 'application/json', }, payload); } @@ -588,7 +637,7 @@ class Users extends Service { * @returns {Promise} */ async updateEmail(userId, email) { - let path = '/users/{userId}/email'.replace('{userId}', userId); + const apiPath = '/users/{userId}/email'.replace('{userId}', userId); let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -603,7 +652,43 @@ class Users extends Service { payload['email'] = email; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { + 'content-type': 'application/json', + }, payload); + } + + /** + * Update User Labels + * + * Update the user labels by its unique ID. + * + * Labels can be used to grant access to resources. While teams are a way for + * user's to share access to a resource, labels can be defined by the + * developer to grant access without an invitation. See the [Permissions + * docs](/docs/permissions) for more info. + * + * @param {string} userId + * @param {string[]} labels + * @throws {AppwriteException} + * @returns {Promise} + */ + async updateLabels(userId, labels) { + const apiPath = '/users/{userId}/labels'.replace('{userId}', userId); + let payload = {}; + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + if (typeof labels === 'undefined') { + throw new AppwriteException('Missing required parameter: "labels"'); + } + + + if (typeof labels !== 'undefined') { + payload['labels'] = labels; + } + + return await this.client.call('put', apiPath, { 'content-type': 'application/json', }, payload); } @@ -619,7 +704,7 @@ class Users extends Service { * @returns {Promise} */ async listLogs(userId, queries) { - let path = '/users/{userId}/logs'.replace('{userId}', userId); + const apiPath = '/users/{userId}/logs'.replace('{userId}', userId); let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -630,7 +715,7 @@ class Users extends Service { payload['queries'] = queries; } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -645,14 +730,14 @@ class Users extends Service { * @returns {Promise} */ async listMemberships(userId) { - let path = '/users/{userId}/memberships'.replace('{userId}', userId); + const apiPath = '/users/{userId}/memberships'.replace('{userId}', userId); let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -668,7 +753,7 @@ class Users extends Service { * @returns {Promise} */ async updateName(userId, name) { - let path = '/users/{userId}/name'.replace('{userId}', userId); + const apiPath = '/users/{userId}/name'.replace('{userId}', userId); let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -683,7 +768,7 @@ class Users extends Service { payload['name'] = name; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -699,7 +784,7 @@ class Users extends Service { * @returns {Promise} */ async updatePassword(userId, password) { - let path = '/users/{userId}/password'.replace('{userId}', userId); + const apiPath = '/users/{userId}/password'.replace('{userId}', userId); let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -714,7 +799,7 @@ class Users extends Service { payload['password'] = password; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -730,7 +815,7 @@ class Users extends Service { * @returns {Promise} */ async updatePhone(userId, number) { - let path = '/users/{userId}/phone'.replace('{userId}', userId); + const apiPath = '/users/{userId}/phone'.replace('{userId}', userId); let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -745,7 +830,7 @@ class Users extends Service { payload['number'] = number; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -760,14 +845,14 @@ class Users extends Service { * @returns {Promise} */ async getPrefs(userId) { - let path = '/users/{userId}/prefs'.replace('{userId}', userId); + const apiPath = '/users/{userId}/prefs'.replace('{userId}', userId); let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -785,7 +870,7 @@ class Users extends Service { * @returns {Promise} */ async updatePrefs(userId, prefs) { - let path = '/users/{userId}/prefs'.replace('{userId}', userId); + const apiPath = '/users/{userId}/prefs'.replace('{userId}', userId); let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -800,7 +885,7 @@ class Users extends Service { payload['prefs'] = prefs; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -815,14 +900,14 @@ class Users extends Service { * @returns {Promise} */ async listSessions(userId) { - let path = '/users/{userId}/sessions'.replace('{userId}', userId); + const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId); let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } - return await this.client.call('get', path, { + return await this.client.call('get', apiPath, { 'content-type': 'application/json', }, payload); } @@ -837,14 +922,14 @@ class Users extends Service { * @returns {Promise} */ async deleteSessions(userId) { - let path = '/users/{userId}/sessions'.replace('{userId}', userId); + const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId); let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } - return await this.client.call('delete', path, { + return await this.client.call('delete', apiPath, { 'content-type': 'application/json', }, payload); } @@ -860,7 +945,7 @@ class Users extends Service { * @returns {Promise} */ async deleteSession(userId, sessionId) { - let path = '/users/{userId}/sessions/{sessionId}'.replace('{userId}', userId).replace('{sessionId}', sessionId); + const apiPath = '/users/{userId}/sessions/{sessionId}'.replace('{userId}', userId).replace('{sessionId}', sessionId); let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -871,7 +956,7 @@ class Users extends Service { } - return await this.client.call('delete', path, { + return await this.client.call('delete', apiPath, { 'content-type': 'application/json', }, payload); } @@ -888,7 +973,7 @@ class Users extends Service { * @returns {Promise} */ async updateStatus(userId, status) { - let path = '/users/{userId}/status'.replace('{userId}', userId); + const apiPath = '/users/{userId}/status'.replace('{userId}', userId); let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -903,7 +988,7 @@ class Users extends Service { payload['status'] = status; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -919,7 +1004,7 @@ class Users extends Service { * @returns {Promise} */ async updateEmailVerification(userId, emailVerification) { - let path = '/users/{userId}/verification'.replace('{userId}', userId); + const apiPath = '/users/{userId}/verification'.replace('{userId}', userId); let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -934,7 +1019,7 @@ class Users extends Service { payload['emailVerification'] = emailVerification; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } @@ -950,7 +1035,7 @@ class Users extends Service { * @returns {Promise} */ async updatePhoneVerification(userId, phoneVerification) { - let path = '/users/{userId}/verification/phone'.replace('{userId}', userId); + const apiPath = '/users/{userId}/verification/phone'.replace('{userId}', userId); let payload = {}; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -965,7 +1050,7 @@ class Users extends Service { payload['phoneVerification'] = phoneVerification; } - return await this.client.call('patch', path, { + return await this.client.call('patch', apiPath, { 'content-type': 'application/json', }, payload); } diff --git a/package.json b/package.json index b0b58a3..ece91fe 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "node-appwrite", "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": "9.0.0", + "version": "10.0.0", "license": "BSD-3-Clause", "main": "./index.js", "types": "./index.d.ts", @@ -14,7 +14,7 @@ "@types/node": "^18.16.1" }, "dependencies": { - "axios": "^1.3.6", + "axios": "^1.4.0", "form-data": "^4.0.0" } }