diff --git a/README.md b/README.md index 2981c4b..cea81f3 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Appwrite Console SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-console.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.4.13-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.5.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) @@ -33,7 +33,7 @@ import { Client, Account } from "@appwrite.io/console"; To install with a CDN (content delivery network) add the following scripts to the bottom of your tag, but before you use any Appwrite services: ```html - + ``` diff --git a/docs/examples/account/add-authenticator.md b/docs/examples/account/add-authenticator.md index 8201ae2..a939451 100644 --- a/docs/examples/account/add-authenticator.md +++ b/docs/examples/account/add-authenticator.md @@ -1,18 +1,13 @@ -import { Client, AuthenticatorType, Account } from "@appwrite.io/console"; +import { Client, Account, AuthenticatorType } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.addAuthenticator(AuthenticatorType.Totp); +const result = await account.addAuthenticator( + AuthenticatorType.Totp // type +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md index 762955e..c3efd84 100644 --- a/docs/examples/account/create-anonymous-session.md +++ b/docs/examples/account/create-anonymous-session.md @@ -1,18 +1,11 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.createAnonymousSession(); +const result = await account.createAnonymousSession(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md index c19d7bb..09004c1 100644 --- a/docs/examples/account/create-email-password-session.md +++ b/docs/examples/account/create-email-password-session.md @@ -1,18 +1,14 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.createEmailPasswordSession('email@example.com', 'password'); +const result = await account.createEmailPasswordSession( + 'email@example.com', // email + 'password' // password +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/create-email-token.md b/docs/examples/account/create-email-token.md index 7ad1bf1..276d5c3 100644 --- a/docs/examples/account/create-email-token.md +++ b/docs/examples/account/create-email-token.md @@ -1,18 +1,15 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.createEmailToken('[USER_ID]', 'email@example.com'); +const result = await account.createEmailToken( + '[USER_ID]', // userId + 'email@example.com', // email + false // phrase (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/create-j-w-t.md b/docs/examples/account/create-j-w-t.md index 0168840..72ecc6a 100644 --- a/docs/examples/account/create-j-w-t.md +++ b/docs/examples/account/create-j-w-t.md @@ -1,18 +1,11 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.createJWT(); +const result = await account.createJWT(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/create-magic-u-r-l-token.md b/docs/examples/account/create-magic-u-r-l-token.md index 44cf168..62d631b 100644 --- a/docs/examples/account/create-magic-u-r-l-token.md +++ b/docs/examples/account/create-magic-u-r-l-token.md @@ -1,18 +1,16 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.createMagicURLToken('[USER_ID]', 'email@example.com'); +const result = await account.createMagicURLToken( + '[USER_ID]', // userId + 'email@example.com', // email + 'https://example.com', // url (optional) + false // phrase (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/create-o-auth2session.md b/docs/examples/account/create-o-auth2session.md index 16f3534..fca1a3d 100644 --- a/docs/examples/account/create-o-auth2session.md +++ b/docs/examples/account/create-o-auth2session.md @@ -1,14 +1,16 @@ -import { Client, OAuthProvider, Account } from "@appwrite.io/console"; +import { Client, Account, OAuthProvider } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -// Go to OAuth provider login page -account.createOAuth2Session(OAuthProvider.Amazon); +account.createOAuth2Session( + OAuthProvider.Amazon, // provider + 'https://example.com', // success (optional) + 'https://example.com', // failure (optional) + false, // token (optional) + [] // scopes (optional) +); diff --git a/docs/examples/account/create-phone-token.md b/docs/examples/account/create-phone-token.md index 268345c..0d0c6ad 100644 --- a/docs/examples/account/create-phone-token.md +++ b/docs/examples/account/create-phone-token.md @@ -1,18 +1,14 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.createPhoneToken('[USER_ID]', '+12065550100'); +const result = await account.createPhoneToken( + '[USER_ID]', // userId + '+12065550100' // phone +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md index 6c87726..7a1320c 100644 --- a/docs/examples/account/create-phone-verification.md +++ b/docs/examples/account/create-phone-verification.md @@ -1,18 +1,11 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.createPhoneVerification(); +const result = await account.createPhoneVerification(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/create-push-target.md b/docs/examples/account/create-push-target.md index 04ab79c..eb76f83 100644 --- a/docs/examples/account/create-push-target.md +++ b/docs/examples/account/create-push-target.md @@ -1,18 +1,15 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.createPushTarget('[TARGET_ID]', '[IDENTIFIER]'); +const result = await account.createPushTarget( + '[TARGET_ID]', // targetId + '[IDENTIFIER]', // identifier + '[PROVIDER_ID]' // providerId (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md index 5872147..137e7c7 100644 --- a/docs/examples/account/create-recovery.md +++ b/docs/examples/account/create-recovery.md @@ -1,18 +1,14 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.createRecovery('email@example.com', 'https://example.com'); +const result = await account.createRecovery( + 'email@example.com', // email + 'https://example.com' // url +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/create-session.md b/docs/examples/account/create-session.md index 346db4e..c410f05 100644 --- a/docs/examples/account/create-session.md +++ b/docs/examples/account/create-session.md @@ -1,18 +1,14 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.createSession('[USER_ID]', '[SECRET]'); +const result = await account.createSession( + '[USER_ID]', // userId + '[SECRET]' // secret +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md index e7d8018..34bacb0 100644 --- a/docs/examples/account/create-verification.md +++ b/docs/examples/account/create-verification.md @@ -1,18 +1,13 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.createVerification('https://example.com'); +const result = await account.createVerification( + 'https://example.com' // url +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md index 5ffb8cc..4598db5 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -1,18 +1,16 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.create('[USER_ID]', 'email@example.com', ''); +const result = await account.create( + '[USER_ID]', // userId + 'email@example.com', // email + '', // password + '[NAME]' // name (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/create2f-a-challenge.md b/docs/examples/account/create2f-a-challenge.md index a54d0ce..a10dded 100644 --- a/docs/examples/account/create2f-a-challenge.md +++ b/docs/examples/account/create2f-a-challenge.md @@ -1,18 +1,13 @@ -import { Client, AuthenticationFactor, Account } from "@appwrite.io/console"; +import { Client, Account, AuthenticationFactor } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.create2FAChallenge(AuthenticationFactor.Totp); +const result = await account.create2FAChallenge( + AuthenticationFactor.Totp // factor +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/delete-authenticator.md b/docs/examples/account/delete-authenticator.md index 686f395..7a3e2f9 100644 --- a/docs/examples/account/delete-authenticator.md +++ b/docs/examples/account/delete-authenticator.md @@ -1,18 +1,14 @@ -import { Client, AuthenticatorType, Account } from "@appwrite.io/console"; +import { Client, Account, AuthenticatorType } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.deleteAuthenticator(AuthenticatorType.Totp, '[OTP]'); +const result = await account.deleteAuthenticator( + AuthenticatorType.Totp, // type + '[OTP]' // otp +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md index bc49834..5f3735f 100644 --- a/docs/examples/account/delete-identity.md +++ b/docs/examples/account/delete-identity.md @@ -1,18 +1,13 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.deleteIdentity('[IDENTITY_ID]'); +const result = await account.deleteIdentity( + '[IDENTITY_ID]' // identityId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/delete-push-target.md b/docs/examples/account/delete-push-target.md index 6a0be85..dca74a5 100644 --- a/docs/examples/account/delete-push-target.md +++ b/docs/examples/account/delete-push-target.md @@ -1,18 +1,13 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.deletePushTarget('[TARGET_ID]'); +const result = await account.deletePushTarget( + '[TARGET_ID]' // targetId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md index 2c46cff..99c010d 100644 --- a/docs/examples/account/delete-session.md +++ b/docs/examples/account/delete-session.md @@ -1,18 +1,13 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.deleteSession('[SESSION_ID]'); +const result = await account.deleteSession( + '[SESSION_ID]' // sessionId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md index 301e916..76dd399 100644 --- a/docs/examples/account/delete-sessions.md +++ b/docs/examples/account/delete-sessions.md @@ -1,18 +1,11 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.deleteSessions(); +const result = await account.deleteSessions(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/delete.md b/docs/examples/account/delete.md index 1f7ffa6..2f8cfac 100644 --- a/docs/examples/account/delete.md +++ b/docs/examples/account/delete.md @@ -1,18 +1,11 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.delete(); +const result = await account.delete(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md index 8a406ba..2a56a09 100644 --- a/docs/examples/account/get-prefs.md +++ b/docs/examples/account/get-prefs.md @@ -1,18 +1,11 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.getPrefs(); +const result = await account.getPrefs(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md index e6a228f..f044ea0 100644 --- a/docs/examples/account/get-session.md +++ b/docs/examples/account/get-session.md @@ -1,18 +1,13 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.getSession('[SESSION_ID]'); +const result = await account.getSession( + '[SESSION_ID]' // sessionId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md index b48905b..d8ef1be 100644 --- a/docs/examples/account/get.md +++ b/docs/examples/account/get.md @@ -1,18 +1,11 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.get(); +const result = await account.get(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/list-factors.md b/docs/examples/account/list-factors.md index b01a79d..79e1549 100644 --- a/docs/examples/account/list-factors.md +++ b/docs/examples/account/list-factors.md @@ -1,18 +1,11 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.listFactors(); +const result = await account.listFactors(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md index 72ea751..ad308c6 100644 --- a/docs/examples/account/list-identities.md +++ b/docs/examples/account/list-identities.md @@ -1,18 +1,13 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.listIdentities(); +const result = await account.listIdentities( + [] // queries (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index 261772c..15c5054 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -1,18 +1,13 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.listLogs(); +const result = await account.listLogs( + [] // queries (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md index 7377a47..b0b48c5 100644 --- a/docs/examples/account/list-sessions.md +++ b/docs/examples/account/list-sessions.md @@ -1,18 +1,11 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.listSessions(); +const result = await account.listSessions(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/update-challenge.md b/docs/examples/account/update-challenge.md index a9998b2..8be9cf2 100644 --- a/docs/examples/account/update-challenge.md +++ b/docs/examples/account/update-challenge.md @@ -1,18 +1,14 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.updateChallenge('[CHALLENGE_ID]', '[OTP]'); +const result = await account.updateChallenge( + '[CHALLENGE_ID]', // challengeId + '[OTP]' // otp +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md index 486890d..eecb26f 100644 --- a/docs/examples/account/update-email.md +++ b/docs/examples/account/update-email.md @@ -1,18 +1,14 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.updateEmail('email@example.com', 'password'); +const result = await account.updateEmail( + 'email@example.com', // email + 'password' // password +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/update-m-f-a.md b/docs/examples/account/update-m-f-a.md index d9ff2bc..a039ee6 100644 --- a/docs/examples/account/update-m-f-a.md +++ b/docs/examples/account/update-m-f-a.md @@ -1,18 +1,13 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.updateMFA(false); +const result = await account.updateMFA( + false // mfa +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/update-magic-u-r-l-session.md b/docs/examples/account/update-magic-u-r-l-session.md index 334e786..5f39688 100644 --- a/docs/examples/account/update-magic-u-r-l-session.md +++ b/docs/examples/account/update-magic-u-r-l-session.md @@ -1,18 +1,14 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.updateMagicURLSession('[USER_ID]', '[SECRET]'); +const result = await account.updateMagicURLSession( + '[USER_ID]', // userId + '[SECRET]' // secret +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md index be9004a..06aa720 100644 --- a/docs/examples/account/update-name.md +++ b/docs/examples/account/update-name.md @@ -1,18 +1,13 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.updateName('[NAME]'); +const result = await account.updateName( + '[NAME]' // name +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index 8c0a0d3..1d79729 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -1,18 +1,14 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.updatePassword(''); +const result = await account.updatePassword( + '', // password + 'password' // oldPassword (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md index d2e863c..90c6c15 100644 --- a/docs/examples/account/update-phone-verification.md +++ b/docs/examples/account/update-phone-verification.md @@ -1,18 +1,14 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.updatePhoneVerification('[USER_ID]', '[SECRET]'); +const result = await account.updatePhoneVerification( + '[USER_ID]', // userId + '[SECRET]' // secret +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md index f98e1c0..82c1e9f 100644 --- a/docs/examples/account/update-phone.md +++ b/docs/examples/account/update-phone.md @@ -1,18 +1,14 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.updatePhone('+12065550100', 'password'); +const result = await account.updatePhone( + '+12065550100', // phone + 'password' // password +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md index da7510e..c5113b2 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -1,18 +1,13 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.updatePrefs({}); +const result = await account.updatePrefs( + {} // prefs +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/update-push-target.md b/docs/examples/account/update-push-target.md index a1893d9..3e031d7 100644 --- a/docs/examples/account/update-push-target.md +++ b/docs/examples/account/update-push-target.md @@ -1,18 +1,14 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.updatePushTarget('[TARGET_ID]', '[IDENTIFIER]'); +const result = await account.updatePushTarget( + '[TARGET_ID]', // targetId + '[IDENTIFIER]' // identifier +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index e06e08a..9fc912d 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -1,18 +1,15 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.updateRecovery('[USER_ID]', '[SECRET]', ''); +const result = await account.updateRecovery( + '[USER_ID]', // userId + '[SECRET]', // secret + '' // password +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md index 5aab8d4..6619d74 100644 --- a/docs/examples/account/update-session.md +++ b/docs/examples/account/update-session.md @@ -1,18 +1,13 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.updateSession('[SESSION_ID]'); +const result = await account.updateSession( + '[SESSION_ID]' // sessionId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md index 99bff11..ef3d940 100644 --- a/docs/examples/account/update-status.md +++ b/docs/examples/account/update-status.md @@ -1,18 +1,11 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.updateStatus(); +const result = await account.updateStatus(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md index 9825125..b53b553 100644 --- a/docs/examples/account/update-verification.md +++ b/docs/examples/account/update-verification.md @@ -1,18 +1,14 @@ -import { Client, Account } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.updateVerification('[USER_ID]', '[SECRET]'); +const result = await account.updateVerification( + '[USER_ID]', // userId + '[SECRET]' // secret +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/account/verify-authenticator.md b/docs/examples/account/verify-authenticator.md index 2ff3395..f38ac6a 100644 --- a/docs/examples/account/verify-authenticator.md +++ b/docs/examples/account/verify-authenticator.md @@ -1,18 +1,14 @@ -import { Client, AuthenticatorType, Account } from "@appwrite.io/console"; +import { Client, Account, AuthenticatorType } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const account = new Account(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = account.verifyAuthenticator(AuthenticatorType.Totp, '[OTP]'); +const result = await account.verifyAuthenticator( + AuthenticatorType.Totp, // type + '[OTP]' // otp +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/assistant/chat.md b/docs/examples/assistant/chat.md index c515d0f..581c8d8 100644 --- a/docs/examples/assistant/chat.md +++ b/docs/examples/assistant/chat.md @@ -1,18 +1,13 @@ -import { Client, Assistant } from "@appwrite.io/console"; +import { Client, Assistant } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const assistant = new Assistant(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = assistant.chat('[PROMPT]'); +const result = await assistant.chat( + '[PROMPT]' // prompt +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md index 6fd5134..421edc4 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -1,14 +1,16 @@ -import { Client, Browser, Avatars } from "@appwrite.io/console"; +import { Client, Avatars, Browser } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const avatars = new Avatars(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const result = avatars.getBrowser(Browser.AvantBrowser); +const result = avatars.getBrowser( + Browser.AvantBrowser, // code + 0, // width (optional) + 0, // height (optional) + 0 // quality (optional) +); -console.log(result); // Resource URL \ No newline at end of file +console.log(result); diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index 922edbf..8eec98f 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -1,14 +1,16 @@ -import { Client, CreditCard, Avatars } from "@appwrite.io/console"; +import { Client, Avatars, CreditCard } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const avatars = new Avatars(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const result = avatars.getCreditCard(CreditCard.AmericanExpress); +const result = avatars.getCreditCard( + CreditCard.AmericanExpress, // code + 0, // width (optional) + 0, // height (optional) + 0 // quality (optional) +); -console.log(result); // Resource URL \ No newline at end of file +console.log(result); diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md index c60916a..330ebb6 100644 --- a/docs/examples/avatars/get-favicon.md +++ b/docs/examples/avatars/get-favicon.md @@ -1,14 +1,13 @@ -import { Client, Avatars } from "@appwrite.io/console"; +import { Client, Avatars } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const avatars = new Avatars(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const result = avatars.getFavicon('https://example.com'); +const result = avatars.getFavicon( + 'https://example.com' // url +); -console.log(result); // Resource URL \ No newline at end of file +console.log(result); diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index 1d5adfc..efb0331 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -1,14 +1,16 @@ -import { Client, Flag, Avatars } from "@appwrite.io/console"; +import { Client, Avatars, Flag } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const avatars = new Avatars(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const result = avatars.getFlag(Flag.Afghanistan); +const result = avatars.getFlag( + Flag.Afghanistan, // code + 0, // width (optional) + 0, // height (optional) + 0 // quality (optional) +); -console.log(result); // Resource URL \ No newline at end of file +console.log(result); diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md index 986e59a..f8e2f38 100644 --- a/docs/examples/avatars/get-image.md +++ b/docs/examples/avatars/get-image.md @@ -1,14 +1,15 @@ -import { Client, Avatars } from "@appwrite.io/console"; +import { Client, Avatars } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const avatars = new Avatars(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const result = avatars.getImage('https://example.com'); +const result = avatars.getImage( + 'https://example.com', // url + 0, // width (optional) + 0 // height (optional) +); -console.log(result); // Resource URL \ No newline at end of file +console.log(result); diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index 7ee58ec..f723ce6 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -1,14 +1,16 @@ -import { Client, Avatars } from "@appwrite.io/console"; +import { Client, Avatars } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const avatars = new Avatars(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const result = avatars.getInitials(); +const result = avatars.getInitials( + '[NAME]', // name (optional) + 0, // width (optional) + 0, // height (optional) + '' // background (optional) +); -console.log(result); // Resource URL \ No newline at end of file +console.log(result); diff --git a/docs/examples/avatars/get-q-r.md b/docs/examples/avatars/get-q-r.md index d4129da..edd6d1c 100644 --- a/docs/examples/avatars/get-q-r.md +++ b/docs/examples/avatars/get-q-r.md @@ -1,14 +1,16 @@ -import { Client, Avatars } from "@appwrite.io/console"; +import { Client, Avatars } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const avatars = new Avatars(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const result = avatars.getQR('[TEXT]'); +const result = avatars.getQR( + '[TEXT]', // text + 1, // size (optional) + 0, // margin (optional) + false // download (optional) +); -console.log(result); // Resource URL \ No newline at end of file +console.log(result); diff --git a/docs/examples/console/variables.md b/docs/examples/console/variables.md index f5184ac..1891b4d 100644 --- a/docs/examples/console/variables.md +++ b/docs/examples/console/variables.md @@ -1,18 +1,11 @@ -import { Client, Console } from "@appwrite.io/console"; +import { Client, Console } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const console = new Console(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = console.variables(); +const result = await console.variables(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md index 97b4ba0..286bb08 100644 --- a/docs/examples/databases/create-boolean-attribute.md +++ b/docs/examples/databases/create-boolean-attribute.md @@ -1,18 +1,18 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.createBooleanAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false); +const result = await databases.createBooleanAttribute( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '', // key + false, // required + false, // default (optional) + false // array (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md index f9cdff5..090d7fe 100644 --- a/docs/examples/databases/create-collection.md +++ b/docs/examples/databases/create-collection.md @@ -1,18 +1,18 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.createCollection('[DATABASE_ID]', '[COLLECTION_ID]', '[NAME]'); +const result = await databases.createCollection( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '[NAME]', // name + ["read("any")"], // permissions (optional) + false, // documentSecurity (optional) + false // enabled (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md index 0f1c372..5b6f435 100644 --- a/docs/examples/databases/create-datetime-attribute.md +++ b/docs/examples/databases/create-datetime-attribute.md @@ -1,18 +1,18 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.createDatetimeAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false); +const result = await databases.createDatetimeAttribute( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '', // key + false, // required + '', // default (optional) + false // array (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index ee3acb8..1099fec 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -1,18 +1,17 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.createDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]', {}); +const result = await databases.createDocument( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '[DOCUMENT_ID]', // documentId + {}, // data + ["read("any")"] // permissions (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md index d901bff..994647d 100644 --- a/docs/examples/databases/create-email-attribute.md +++ b/docs/examples/databases/create-email-attribute.md @@ -1,18 +1,18 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.createEmailAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false); +const result = await databases.createEmailAttribute( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '', // key + false, // required + 'email@example.com', // default (optional) + false // array (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md index 3dcd15d..bb997ca 100644 --- a/docs/examples/databases/create-enum-attribute.md +++ b/docs/examples/databases/create-enum-attribute.md @@ -1,18 +1,19 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.createEnumAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', [], false); +const result = await databases.createEnumAttribute( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '', // key + [], // elements + false, // required + '[DEFAULT]', // default (optional) + false // array (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md index 7587467..4b0762c 100644 --- a/docs/examples/databases/create-float-attribute.md +++ b/docs/examples/databases/create-float-attribute.md @@ -1,18 +1,20 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.createFloatAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false); +const result = await databases.createFloatAttribute( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '', // key + false, // required + null, // min (optional) + null, // max (optional) + null, // default (optional) + false // array (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index 4e5fdce..9a3ebb9 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -1,18 +1,18 @@ -import { Client, IndexType, Databases } from "@appwrite.io/console"; +import { Client, Databases, IndexType } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.createIndex('[DATABASE_ID]', '[COLLECTION_ID]', '', IndexType.Key, []); +const result = await databases.createIndex( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '', // key + IndexType.Key, // type + [], // attributes + [] // orders (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md index 20a302f..368cb2e 100644 --- a/docs/examples/databases/create-integer-attribute.md +++ b/docs/examples/databases/create-integer-attribute.md @@ -1,18 +1,20 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.createIntegerAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false); +const result = await databases.createIntegerAttribute( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '', // key + false, // required + null, // min (optional) + null, // max (optional) + null, // default (optional) + false // array (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md index dcce5d7..cd1f951 100644 --- a/docs/examples/databases/create-ip-attribute.md +++ b/docs/examples/databases/create-ip-attribute.md @@ -1,18 +1,18 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.createIpAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false); +const result = await databases.createIpAttribute( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '', // key + false, // required + '', // default (optional) + false // array (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md index 175c744..6c8b57a 100644 --- a/docs/examples/databases/create-relationship-attribute.md +++ b/docs/examples/databases/create-relationship-attribute.md @@ -1,18 +1,20 @@ -import { Client, RelationshipType, Databases } from "@appwrite.io/console"; +import { Client, Databases, RelationshipType, RelationMutate } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.createRelationshipAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '[RELATED_COLLECTION_ID]', RelationshipType.OneToOne); +const result = await databases.createRelationshipAttribute( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '[RELATED_COLLECTION_ID]', // relatedCollectionId + RelationshipType.OneToOne, // type + false, // twoWay (optional) + '', // key (optional) + '', // twoWayKey (optional) + RelationMutate.Cascade // onDelete (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md index d035dcb..d80d2dd 100644 --- a/docs/examples/databases/create-string-attribute.md +++ b/docs/examples/databases/create-string-attribute.md @@ -1,18 +1,20 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.createStringAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', 1, false); +const result = await databases.createStringAttribute( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '', // key + 1, // size + false, // required + '[DEFAULT]', // default (optional) + false, // array (optional) + false // encrypt (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md index fbc5d77..4369a56 100644 --- a/docs/examples/databases/create-url-attribute.md +++ b/docs/examples/databases/create-url-attribute.md @@ -1,18 +1,18 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.createUrlAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false); +const result = await databases.createUrlAttribute( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '', // key + false, // required + 'https://example.com', // default (optional) + false // array (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md index eb4d64e..a0d448e 100644 --- a/docs/examples/databases/create.md +++ b/docs/examples/databases/create.md @@ -1,18 +1,15 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.create('[DATABASE_ID]', '[NAME]'); +const result = await databases.create( + '[DATABASE_ID]', // databaseId + '[NAME]', // name + false // enabled (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md index 34998c3..ae35ad6 100644 --- a/docs/examples/databases/delete-attribute.md +++ b/docs/examples/databases/delete-attribute.md @@ -1,18 +1,15 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.deleteAttribute('[DATABASE_ID]', '[COLLECTION_ID]', ''); +const result = await databases.deleteAttribute( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '' // key +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md index f0590fa..06e5c2c 100644 --- a/docs/examples/databases/delete-collection.md +++ b/docs/examples/databases/delete-collection.md @@ -1,18 +1,14 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.deleteCollection('[DATABASE_ID]', '[COLLECTION_ID]'); +const result = await databases.deleteCollection( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]' // collectionId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md index d0de981..e67ac3a 100644 --- a/docs/examples/databases/delete-document.md +++ b/docs/examples/databases/delete-document.md @@ -1,18 +1,15 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.deleteDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]'); +const result = await databases.deleteDocument( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '[DOCUMENT_ID]' // documentId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md index 63682e0..16d5f55 100644 --- a/docs/examples/databases/delete-index.md +++ b/docs/examples/databases/delete-index.md @@ -1,18 +1,15 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.deleteIndex('[DATABASE_ID]', '[COLLECTION_ID]', ''); +const result = await databases.deleteIndex( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '' // key +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md index 6482bf2..ec5955a 100644 --- a/docs/examples/databases/delete.md +++ b/docs/examples/databases/delete.md @@ -1,18 +1,13 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.delete('[DATABASE_ID]'); +const result = await databases.delete( + '[DATABASE_ID]' // databaseId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md index 6032f08..7936aaf 100644 --- a/docs/examples/databases/get-attribute.md +++ b/docs/examples/databases/get-attribute.md @@ -1,18 +1,15 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.getAttribute('[DATABASE_ID]', '[COLLECTION_ID]', ''); +const result = await databases.getAttribute( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '' // key +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/get-collection-usage.md b/docs/examples/databases/get-collection-usage.md index 3db5b8a..614112e 100644 --- a/docs/examples/databases/get-collection-usage.md +++ b/docs/examples/databases/get-collection-usage.md @@ -1,18 +1,15 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases, DatabaseUsageRange } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.getCollectionUsage('[DATABASE_ID]', '[COLLECTION_ID]'); +const result = await databases.getCollectionUsage( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + DatabaseUsageRange.TwentyFourHours // range (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md index e003749..314cbf0 100644 --- a/docs/examples/databases/get-collection.md +++ b/docs/examples/databases/get-collection.md @@ -1,18 +1,14 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.getCollection('[DATABASE_ID]', '[COLLECTION_ID]'); +const result = await databases.getCollection( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]' // collectionId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/get-database-usage.md b/docs/examples/databases/get-database-usage.md index 0bb393b..c1f5902 100644 --- a/docs/examples/databases/get-database-usage.md +++ b/docs/examples/databases/get-database-usage.md @@ -1,18 +1,14 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases, DatabaseUsageRange } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.getDatabaseUsage('[DATABASE_ID]'); +const result = await databases.getDatabaseUsage( + '[DATABASE_ID]', // databaseId + DatabaseUsageRange.TwentyFourHours // range (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md index dc63e74..8c64be3 100644 --- a/docs/examples/databases/get-document.md +++ b/docs/examples/databases/get-document.md @@ -1,18 +1,16 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.getDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]'); +const result = await databases.getDocument( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '[DOCUMENT_ID]', // documentId + [] // queries (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md index cd610c9..29b8770 100644 --- a/docs/examples/databases/get-index.md +++ b/docs/examples/databases/get-index.md @@ -1,18 +1,15 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.getIndex('[DATABASE_ID]', '[COLLECTION_ID]', ''); +const result = await databases.getIndex( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '' // key +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/get-usage.md b/docs/examples/databases/get-usage.md index b20f03e..3d75f6a 100644 --- a/docs/examples/databases/get-usage.md +++ b/docs/examples/databases/get-usage.md @@ -1,18 +1,13 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases, DatabaseUsageRange } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.getUsage(); +const result = await databases.getUsage( + DatabaseUsageRange.TwentyFourHours // range (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md index 467f460..3a53bbb 100644 --- a/docs/examples/databases/get.md +++ b/docs/examples/databases/get.md @@ -1,18 +1,13 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.get('[DATABASE_ID]'); +const result = await databases.get( + '[DATABASE_ID]' // databaseId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md index 2411153..f4a49d8 100644 --- a/docs/examples/databases/list-attributes.md +++ b/docs/examples/databases/list-attributes.md @@ -1,18 +1,15 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.listAttributes('[DATABASE_ID]', '[COLLECTION_ID]'); +const result = await databases.listAttributes( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + [] // queries (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/list-collection-logs.md b/docs/examples/databases/list-collection-logs.md index b2670a4..1ba52af 100644 --- a/docs/examples/databases/list-collection-logs.md +++ b/docs/examples/databases/list-collection-logs.md @@ -1,18 +1,15 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.listCollectionLogs('[DATABASE_ID]', '[COLLECTION_ID]'); +const result = await databases.listCollectionLogs( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + [] // queries (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md index 7aa5658..24f33f9 100644 --- a/docs/examples/databases/list-collections.md +++ b/docs/examples/databases/list-collections.md @@ -1,18 +1,15 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.listCollections('[DATABASE_ID]'); +const result = await databases.listCollections( + '[DATABASE_ID]', // databaseId + [], // queries (optional) + '[SEARCH]' // search (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/list-document-logs.md b/docs/examples/databases/list-document-logs.md index 6b3126e..46d9ca6 100644 --- a/docs/examples/databases/list-document-logs.md +++ b/docs/examples/databases/list-document-logs.md @@ -1,18 +1,16 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.listDocumentLogs('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]'); +const result = await databases.listDocumentLogs( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '[DOCUMENT_ID]', // documentId + [] // queries (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index 981339e..ca0ab26 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -1,18 +1,15 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.listDocuments('[DATABASE_ID]', '[COLLECTION_ID]'); +const result = await databases.listDocuments( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + [] // queries (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md index dd225db..f2b3cd8 100644 --- a/docs/examples/databases/list-indexes.md +++ b/docs/examples/databases/list-indexes.md @@ -1,18 +1,15 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.listIndexes('[DATABASE_ID]', '[COLLECTION_ID]'); +const result = await databases.listIndexes( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + [] // queries (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/list-logs.md b/docs/examples/databases/list-logs.md index 8b07bc7..4521ddd 100644 --- a/docs/examples/databases/list-logs.md +++ b/docs/examples/databases/list-logs.md @@ -1,18 +1,14 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.listLogs('[DATABASE_ID]'); +const result = await databases.listLogs( + '[DATABASE_ID]', // databaseId + [] // queries (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md index 14d5b89..e3a50f1 100644 --- a/docs/examples/databases/list.md +++ b/docs/examples/databases/list.md @@ -1,18 +1,14 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.list(); +const result = await databases.list( + [], // queries (optional) + '[SEARCH]' // search (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index e9c1c38..4197724 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -1,18 +1,17 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.updateBooleanAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false, false); +const result = await databases.updateBooleanAttribute( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '', // key + false, // required + false // default +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md index 996af31..d5a5c9a 100644 --- a/docs/examples/databases/update-collection.md +++ b/docs/examples/databases/update-collection.md @@ -1,18 +1,18 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.updateCollection('[DATABASE_ID]', '[COLLECTION_ID]', '[NAME]'); +const result = await databases.updateCollection( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '[NAME]', // name + ["read("any")"], // permissions (optional) + false, // documentSecurity (optional) + false // enabled (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index ea2d105..3ea1d91 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -1,18 +1,17 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.updateDatetimeAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false, ''); +const result = await databases.updateDatetimeAttribute( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '', // key + false, // required + '' // default +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index f8ca035..f633d2e 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -1,18 +1,17 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.updateDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]'); +const result = await databases.updateDocument( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '[DOCUMENT_ID]', // documentId + {}, // data (optional) + ["read("any")"] // permissions (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index 165ee7f..db5a323 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -1,18 +1,17 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.updateEmailAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false, 'email@example.com'); +const result = await databases.updateEmailAttribute( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '', // key + false, // required + 'email@example.com' // default +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index 63ff1c4..70e36ef 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -1,18 +1,18 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.updateEnumAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', [], false, '[DEFAULT]'); +const result = await databases.updateEnumAttribute( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '', // key + [], // elements + false, // required + '[DEFAULT]' // default +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index 2d263c7..c9a4b8f 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -1,18 +1,19 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.updateFloatAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false, null, null, null); +const result = await databases.updateFloatAttribute( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '', // key + false, // required + null, // min + null, // max + null // default +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index 016274a..dbcfb30 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -1,18 +1,19 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.updateIntegerAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false, null, null, null); +const result = await databases.updateIntegerAttribute( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '', // key + false, // required + null, // min + null, // max + null // default +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index ba36d2b..c3cdf1d 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -1,18 +1,17 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.updateIpAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false, ''); +const result = await databases.updateIpAttribute( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '', // key + false, // required + '' // default +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md index c65974c..e5b1177 100644 --- a/docs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/databases/update-relationship-attribute.md @@ -1,18 +1,16 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases, RelationMutate } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.updateRelationshipAttribute('[DATABASE_ID]', '[COLLECTION_ID]', ''); +const result = await databases.updateRelationshipAttribute( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '', // key + RelationMutate.Cascade // onDelete (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md index 1af8b3d..d4ec38a 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -1,18 +1,17 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.updateStringAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false, '[DEFAULT]'); +const result = await databases.updateStringAttribute( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '', // key + false, // required + '[DEFAULT]' // default +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index 2472f06..7ea466e 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -1,18 +1,17 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.updateUrlAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false, 'https://example.com'); +const result = await databases.updateUrlAttribute( + '[DATABASE_ID]', // databaseId + '[COLLECTION_ID]', // collectionId + '', // key + false, // required + 'https://example.com' // default +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md index ae39a8d..ddaec96 100644 --- a/docs/examples/databases/update.md +++ b/docs/examples/databases/update.md @@ -1,18 +1,15 @@ -import { Client, Databases } from "@appwrite.io/console"; +import { Client, Databases } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const databases = new Databases(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = databases.update('[DATABASE_ID]', '[NAME]'); +const result = await databases.update( + '[DATABASE_ID]', // databaseId + '[NAME]', // name + false // enabled (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/functions/create-build.md b/docs/examples/functions/create-build.md index 6ed3356..fccaae3 100644 --- a/docs/examples/functions/create-build.md +++ b/docs/examples/functions/create-build.md @@ -1,18 +1,15 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Functions } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = functions.createBuild('[FUNCTION_ID]', '[DEPLOYMENT_ID]', '[BUILD_ID]'); +const result = await functions.createBuild( + '[FUNCTION_ID]', // functionId + '[DEPLOYMENT_ID]', // deploymentId + '[BUILD_ID]' // buildId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md index e8a0bb3..3f2c20b 100644 --- a/docs/examples/functions/create-deployment.md +++ b/docs/examples/functions/create-deployment.md @@ -1,18 +1,17 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Functions } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = functions.createDeployment('[FUNCTION_ID]', document.getElementById('uploader').files[0], false); +const result = await functions.createDeployment( + '[FUNCTION_ID]', // functionId + document.getElementById('uploader').files[0], // code + false, // activate + '[ENTRYPOINT]', // entrypoint (optional) + '[COMMANDS]' // commands (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index 511f98b..63ca0e5 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -1,18 +1,18 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Functions, ExecutionMethod } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = functions.createExecution('[FUNCTION_ID]'); +const result = await functions.createExecution( + '[FUNCTION_ID]', // functionId + '[BODY]', // body (optional) + false, // async (optional) + '[PATH]', // path (optional) + ExecutionMethod.GET, // method (optional) + {} // headers (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md index d3c89ac..37ac9ae 100644 --- a/docs/examples/functions/create-variable.md +++ b/docs/examples/functions/create-variable.md @@ -1,18 +1,15 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Functions } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = functions.createVariable('[FUNCTION_ID]', '[KEY]', '[VALUE]'); +const result = await functions.createVariable( + '[FUNCTION_ID]', // functionId + '[KEY]', // key + '[VALUE]' // value +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index 9dad8b2..e36c912 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -1,18 +1,32 @@ -import { Client, , Functions } from "@appwrite.io/console"; +import { Client, Functions, } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = functions.create('[FUNCTION_ID]', '[NAME]', .Node180); +const result = await functions.create( + '[FUNCTION_ID]', // functionId + '[NAME]', // name + .Node145, // runtime + ["any"], // execute (optional) + [], // events (optional) + '', // schedule (optional) + 1, // timeout (optional) + false, // enabled (optional) + false, // logging (optional) + '[ENTRYPOINT]', // entrypoint (optional) + '[COMMANDS]', // commands (optional) + '[INSTALLATION_ID]', // installationId (optional) + '[PROVIDER_REPOSITORY_ID]', // providerRepositoryId (optional) + '[PROVIDER_BRANCH]', // providerBranch (optional) + false, // providerSilentMode (optional) + '[PROVIDER_ROOT_DIRECTORY]', // providerRootDirectory (optional) + '[TEMPLATE_REPOSITORY]', // templateRepository (optional) + '[TEMPLATE_OWNER]', // templateOwner (optional) + '[TEMPLATE_ROOT_DIRECTORY]', // templateRootDirectory (optional) + '[TEMPLATE_BRANCH]' // templateBranch (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md index 62bcfb2..feaaf2a 100644 --- a/docs/examples/functions/delete-deployment.md +++ b/docs/examples/functions/delete-deployment.md @@ -1,18 +1,14 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Functions } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = functions.deleteDeployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]'); +const result = await functions.deleteDeployment( + '[FUNCTION_ID]', // functionId + '[DEPLOYMENT_ID]' // deploymentId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/functions/delete-variable.md b/docs/examples/functions/delete-variable.md index 4b3ec56..2918f45 100644 --- a/docs/examples/functions/delete-variable.md +++ b/docs/examples/functions/delete-variable.md @@ -1,18 +1,14 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Functions } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = functions.deleteVariable('[FUNCTION_ID]', '[VARIABLE_ID]'); +const result = await functions.deleteVariable( + '[FUNCTION_ID]', // functionId + '[VARIABLE_ID]' // variableId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md index 18eaa5e..010b0cb 100644 --- a/docs/examples/functions/delete.md +++ b/docs/examples/functions/delete.md @@ -1,18 +1,13 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Functions } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = functions.delete('[FUNCTION_ID]'); +const result = await functions.delete( + '[FUNCTION_ID]' // functionId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/functions/download-deployment.md b/docs/examples/functions/download-deployment.md index 3b0076d..bfb206a 100644 --- a/docs/examples/functions/download-deployment.md +++ b/docs/examples/functions/download-deployment.md @@ -1,14 +1,14 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Functions } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const result = functions.downloadDeployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]'); +const result = functions.downloadDeployment( + '[FUNCTION_ID]', // functionId + '[DEPLOYMENT_ID]' // deploymentId +); -console.log(result); // Resource URL \ No newline at end of file +console.log(result); diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md index adf50aa..2838cc9 100644 --- a/docs/examples/functions/get-deployment.md +++ b/docs/examples/functions/get-deployment.md @@ -1,18 +1,14 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Functions } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = functions.getDeployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]'); +const result = await functions.getDeployment( + '[FUNCTION_ID]', // functionId + '[DEPLOYMENT_ID]' // deploymentId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md index ee0685d..e127a53 100644 --- a/docs/examples/functions/get-execution.md +++ b/docs/examples/functions/get-execution.md @@ -1,18 +1,14 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Functions } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = functions.getExecution('[FUNCTION_ID]', '[EXECUTION_ID]'); +const result = await functions.getExecution( + '[FUNCTION_ID]', // functionId + '[EXECUTION_ID]' // executionId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/functions/get-function-usage.md b/docs/examples/functions/get-function-usage.md index 65f252c..5969317 100644 --- a/docs/examples/functions/get-function-usage.md +++ b/docs/examples/functions/get-function-usage.md @@ -1,18 +1,14 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Functions, FunctionUsageRange } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = functions.getFunctionUsage('[FUNCTION_ID]'); +const result = await functions.getFunctionUsage( + '[FUNCTION_ID]', // functionId + FunctionUsageRange.TwentyFourHours // range (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/functions/get-usage.md b/docs/examples/functions/get-usage.md index 8a4d5d9..c222f0e 100644 --- a/docs/examples/functions/get-usage.md +++ b/docs/examples/functions/get-usage.md @@ -1,18 +1,13 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Functions, FunctionUsageRange } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = functions.getUsage(); +const result = await functions.getUsage( + FunctionUsageRange.TwentyFourHours // range (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md index dc5652c..ec24ed4 100644 --- a/docs/examples/functions/get-variable.md +++ b/docs/examples/functions/get-variable.md @@ -1,18 +1,14 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Functions } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = functions.getVariable('[FUNCTION_ID]', '[VARIABLE_ID]'); +const result = await functions.getVariable( + '[FUNCTION_ID]', // functionId + '[VARIABLE_ID]' // variableId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md index 4a4fb4b..311417b 100644 --- a/docs/examples/functions/get.md +++ b/docs/examples/functions/get.md @@ -1,18 +1,13 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Functions } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = functions.get('[FUNCTION_ID]'); +const result = await functions.get( + '[FUNCTION_ID]' // functionId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md index 334c27e..9afe3b8 100644 --- a/docs/examples/functions/list-deployments.md +++ b/docs/examples/functions/list-deployments.md @@ -1,18 +1,15 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Functions } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = functions.listDeployments('[FUNCTION_ID]'); +const result = await functions.listDeployments( + '[FUNCTION_ID]', // functionId + [], // queries (optional) + '[SEARCH]' // search (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index 233b0e0..7d941c2 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -1,18 +1,15 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Functions } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = functions.listExecutions('[FUNCTION_ID]'); +const result = await functions.listExecutions( + '[FUNCTION_ID]', // functionId + [], // queries (optional) + '[SEARCH]' // search (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md index f6b5477..9935779 100644 --- a/docs/examples/functions/list-runtimes.md +++ b/docs/examples/functions/list-runtimes.md @@ -1,18 +1,11 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Functions } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = functions.listRuntimes(); +const result = await functions.listRuntimes(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md index 63f57bb..0b257f0 100644 --- a/docs/examples/functions/list-variables.md +++ b/docs/examples/functions/list-variables.md @@ -1,18 +1,13 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Functions } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = functions.listVariables('[FUNCTION_ID]'); +const result = await functions.listVariables( + '[FUNCTION_ID]' // functionId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md index 9776f0a..1a7787c 100644 --- a/docs/examples/functions/list.md +++ b/docs/examples/functions/list.md @@ -1,18 +1,14 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Functions } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = functions.list(); +const result = await functions.list( + [], // queries (optional) + '[SEARCH]' // search (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/functions/update-deployment.md b/docs/examples/functions/update-deployment.md index d273e08..1bf9909 100644 --- a/docs/examples/functions/update-deployment.md +++ b/docs/examples/functions/update-deployment.md @@ -1,18 +1,14 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Functions } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = functions.updateDeployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]'); +const result = await functions.updateDeployment( + '[FUNCTION_ID]', // functionId + '[DEPLOYMENT_ID]' // deploymentId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md index 7d23ca4..c8ab9ba 100644 --- a/docs/examples/functions/update-variable.md +++ b/docs/examples/functions/update-variable.md @@ -1,18 +1,16 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Functions } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = functions.updateVariable('[FUNCTION_ID]', '[VARIABLE_ID]', '[KEY]'); +const result = await functions.updateVariable( + '[FUNCTION_ID]', // functionId + '[VARIABLE_ID]', // variableId + '[KEY]', // key + '[VALUE]' // value (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index 219b940..9a5eb77 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -1,18 +1,28 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Functions, } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const functions = new Functions(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = functions.update('[FUNCTION_ID]', '[NAME]'); +const result = await functions.update( + '[FUNCTION_ID]', // functionId + '[NAME]', // name + .Node145, // runtime (optional) + ["any"], // execute (optional) + [], // events (optional) + '', // schedule (optional) + 1, // timeout (optional) + false, // enabled (optional) + false, // logging (optional) + '[ENTRYPOINT]', // entrypoint (optional) + '[COMMANDS]', // commands (optional) + '[INSTALLATION_ID]', // installationId (optional) + '[PROVIDER_REPOSITORY_ID]', // providerRepositoryId (optional) + '[PROVIDER_BRANCH]', // providerBranch (optional) + false, // providerSilentMode (optional) + '[PROVIDER_ROOT_DIRECTORY]' // providerRootDirectory (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md index a989b53..d3e9676 100644 --- a/docs/examples/graphql/mutation.md +++ b/docs/examples/graphql/mutation.md @@ -1,18 +1,13 @@ -import { Client, Graphql } from "@appwrite.io/console"; +import { Client, Graphql } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const graphql = new Graphql(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = graphql.mutation({}); +const result = await graphql.mutation( + {} // query +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md index 6537364..a06a916 100644 --- a/docs/examples/graphql/query.md +++ b/docs/examples/graphql/query.md @@ -1,18 +1,13 @@ -import { Client, Graphql } from "@appwrite.io/console"; +import { Client, Graphql } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const graphql = new Graphql(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = graphql.query({}); +const result = await graphql.query( + {} // query +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/health/get-antivirus.md index c0543a3..4d7b1cb 100644 --- a/docs/examples/health/get-antivirus.md +++ b/docs/examples/health/get-antivirus.md @@ -1,18 +1,11 @@ -import { Client, Health } from "@appwrite.io/console"; +import { Client, Health } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const health = new Health(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = health.getAntivirus(); +const result = await health.getAntivirus(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md index e18e4d3..34ca3ce 100644 --- a/docs/examples/health/get-cache.md +++ b/docs/examples/health/get-cache.md @@ -1,18 +1,11 @@ -import { Client, Health } from "@appwrite.io/console"; +import { Client, Health } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const health = new Health(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = health.getCache(); +const result = await health.getCache(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/health/get-certificate.md b/docs/examples/health/get-certificate.md index aa36f85..08f90b8 100644 --- a/docs/examples/health/get-certificate.md +++ b/docs/examples/health/get-certificate.md @@ -1,18 +1,13 @@ -import { Client, Health } from "@appwrite.io/console"; +import { Client, Health } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const health = new Health(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = health.getCertificate(); +const result = await health.getCertificate( + '' // domain (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/health/get-d-b.md b/docs/examples/health/get-d-b.md index 2be965c..f001519 100644 --- a/docs/examples/health/get-d-b.md +++ b/docs/examples/health/get-d-b.md @@ -1,18 +1,11 @@ -import { Client, Health } from "@appwrite.io/console"; +import { Client, Health } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const health = new Health(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = health.getDB(); +const result = await health.getDB(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md index 534c728..b1768a7 100644 --- a/docs/examples/health/get-failed-jobs.md +++ b/docs/examples/health/get-failed-jobs.md @@ -1,18 +1,14 @@ -import { Client, , Health } from "@appwrite.io/console"; +import { Client, Health, } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const health = new Health(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = health.getFailedJobs(.V1Database); +const result = await health.getFailedJobs( + .V1Database, // name + null // threshold (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md index acd95e0..fd27735 100644 --- a/docs/examples/health/get-pub-sub.md +++ b/docs/examples/health/get-pub-sub.md @@ -1,18 +1,11 @@ -import { Client, Health } from "@appwrite.io/console"; +import { Client, Health } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const health = new Health(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = health.getPubSub(); +const result = await health.getPubSub(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/health/get-queue-builds.md index b31b18b..00c702e 100644 --- a/docs/examples/health/get-queue-builds.md +++ b/docs/examples/health/get-queue-builds.md @@ -1,18 +1,13 @@ -import { Client, Health } from "@appwrite.io/console"; +import { Client, Health } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const health = new Health(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = health.getQueueBuilds(); +const result = await health.getQueueBuilds( + null // threshold (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/health/get-queue-certificates.md b/docs/examples/health/get-queue-certificates.md index 3ddcf68..aafe14a 100644 --- a/docs/examples/health/get-queue-certificates.md +++ b/docs/examples/health/get-queue-certificates.md @@ -1,18 +1,13 @@ -import { Client, Health } from "@appwrite.io/console"; +import { Client, Health } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const health = new Health(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = health.getQueueCertificates(); +const result = await health.getQueueCertificates( + null // threshold (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md index 738fca0..797be48 100644 --- a/docs/examples/health/get-queue-databases.md +++ b/docs/examples/health/get-queue-databases.md @@ -1,18 +1,14 @@ -import { Client, Health } from "@appwrite.io/console"; +import { Client, Health } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const health = new Health(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = health.getQueueDatabases(); +const result = await health.getQueueDatabases( + '[NAME]', // name (optional) + null // threshold (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md index f039393..2e7fcbc 100644 --- a/docs/examples/health/get-queue-deletes.md +++ b/docs/examples/health/get-queue-deletes.md @@ -1,18 +1,13 @@ -import { Client, Health } from "@appwrite.io/console"; +import { Client, Health } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const health = new Health(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = health.getQueueDeletes(); +const result = await health.getQueueDeletes( + null // threshold (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md index 4169c8d..7afce2b 100644 --- a/docs/examples/health/get-queue-functions.md +++ b/docs/examples/health/get-queue-functions.md @@ -1,18 +1,13 @@ -import { Client, Health } from "@appwrite.io/console"; +import { Client, Health } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const health = new Health(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = health.getQueueFunctions(); +const result = await health.getQueueFunctions( + null // threshold (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md index 759bb6e..4c3477b 100644 --- a/docs/examples/health/get-queue-logs.md +++ b/docs/examples/health/get-queue-logs.md @@ -1,18 +1,13 @@ -import { Client, Health } from "@appwrite.io/console"; +import { Client, Health } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const health = new Health(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = health.getQueueLogs(); +const result = await health.getQueueLogs( + null // threshold (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md index 86c4744..c4ff788 100644 --- a/docs/examples/health/get-queue-mails.md +++ b/docs/examples/health/get-queue-mails.md @@ -1,18 +1,13 @@ -import { Client, Health } from "@appwrite.io/console"; +import { Client, Health } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const health = new Health(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = health.getQueueMails(); +const result = await health.getQueueMails( + null // threshold (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md index bfc1c2e..33f68de 100644 --- a/docs/examples/health/get-queue-messaging.md +++ b/docs/examples/health/get-queue-messaging.md @@ -1,18 +1,13 @@ -import { Client, Health } from "@appwrite.io/console"; +import { Client, Health } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const health = new Health(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = health.getQueueMessaging(); +const result = await health.getQueueMessaging( + null // threshold (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md index 48c0ef5..d2c873f 100644 --- a/docs/examples/health/get-queue-migrations.md +++ b/docs/examples/health/get-queue-migrations.md @@ -1,18 +1,13 @@ -import { Client, Health } from "@appwrite.io/console"; +import { Client, Health } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const health = new Health(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = health.getQueueMigrations(); +const result = await health.getQueueMigrations( + null // threshold (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md index ea6776e..0fce435 100644 --- a/docs/examples/health/get-queue-webhooks.md +++ b/docs/examples/health/get-queue-webhooks.md @@ -1,18 +1,13 @@ -import { Client, Health } from "@appwrite.io/console"; +import { Client, Health } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const health = new Health(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = health.getQueueWebhooks(); +const result = await health.getQueueWebhooks( + null // threshold (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/health/get-queue.md b/docs/examples/health/get-queue.md index cb0fa68..755624e 100644 --- a/docs/examples/health/get-queue.md +++ b/docs/examples/health/get-queue.md @@ -1,18 +1,11 @@ -import { Client, Health } from "@appwrite.io/console"; +import { Client, Health } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const health = new Health(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = health.getQueue(); +const result = await health.getQueue(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md index fde282e..280d5fe 100644 --- a/docs/examples/health/get-storage-local.md +++ b/docs/examples/health/get-storage-local.md @@ -1,18 +1,11 @@ -import { Client, Health } from "@appwrite.io/console"; +import { Client, Health } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const health = new Health(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = health.getStorageLocal(); +const result = await health.getStorageLocal(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md index fc08f67..696d7ac 100644 --- a/docs/examples/health/get-time.md +++ b/docs/examples/health/get-time.md @@ -1,18 +1,11 @@ -import { Client, Health } from "@appwrite.io/console"; +import { Client, Health } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const health = new Health(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = health.getTime(); +const result = await health.getTime(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/health/get.md b/docs/examples/health/get.md index 0f372ee..85a6fd9 100644 --- a/docs/examples/health/get.md +++ b/docs/examples/health/get.md @@ -1,18 +1,11 @@ -import { Client, Health } from "@appwrite.io/console"; +import { Client, Health } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const health = new Health(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = health.get(); +const result = await health.get(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md index 9a60c74..387aedc 100644 --- a/docs/examples/locale/get.md +++ b/docs/examples/locale/get.md @@ -1,18 +1,11 @@ -import { Client, Locale } from "@appwrite.io/console"; +import { Client, Locale } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const locale = new Locale(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = locale.get(); +const result = await locale.get(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md index 4630335..d426e06 100644 --- a/docs/examples/locale/list-codes.md +++ b/docs/examples/locale/list-codes.md @@ -1,18 +1,11 @@ -import { Client, Locale } from "@appwrite.io/console"; +import { Client, Locale } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const locale = new Locale(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = locale.listCodes(); +const result = await locale.listCodes(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md index d330f8f..544550a 100644 --- a/docs/examples/locale/list-continents.md +++ b/docs/examples/locale/list-continents.md @@ -1,18 +1,11 @@ -import { Client, Locale } from "@appwrite.io/console"; +import { Client, Locale } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const locale = new Locale(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = locale.listContinents(); +const result = await locale.listContinents(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/locale/list-countries-e-u.md b/docs/examples/locale/list-countries-e-u.md index 3a4e4aa..a675d30 100644 --- a/docs/examples/locale/list-countries-e-u.md +++ b/docs/examples/locale/list-countries-e-u.md @@ -1,18 +1,11 @@ -import { Client, Locale } from "@appwrite.io/console"; +import { Client, Locale } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const locale = new Locale(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = locale.listCountriesEU(); +const result = await locale.listCountriesEU(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md index f6c579f..938b248 100644 --- a/docs/examples/locale/list-countries-phones.md +++ b/docs/examples/locale/list-countries-phones.md @@ -1,18 +1,11 @@ -import { Client, Locale } from "@appwrite.io/console"; +import { Client, Locale } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const locale = new Locale(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = locale.listCountriesPhones(); +const result = await locale.listCountriesPhones(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md index 2fad4e8..e3f84b0 100644 --- a/docs/examples/locale/list-countries.md +++ b/docs/examples/locale/list-countries.md @@ -1,18 +1,11 @@ -import { Client, Locale } from "@appwrite.io/console"; +import { Client, Locale } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const locale = new Locale(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = locale.listCountries(); +const result = await locale.listCountries(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md index 85b3c86..8ffe9ad 100644 --- a/docs/examples/locale/list-currencies.md +++ b/docs/examples/locale/list-currencies.md @@ -1,18 +1,11 @@ -import { Client, Locale } from "@appwrite.io/console"; +import { Client, Locale } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const locale = new Locale(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = locale.listCurrencies(); +const result = await locale.listCurrencies(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md index af18b78..c9a74bf 100644 --- a/docs/examples/locale/list-languages.md +++ b/docs/examples/locale/list-languages.md @@ -1,18 +1,11 @@ -import { Client, Locale } from "@appwrite.io/console"; +import { Client, Locale } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const locale = new Locale(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = locale.listLanguages(); +const result = await locale.listLanguages(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/create-a-p-n-s-provider.md b/docs/examples/messaging/create-a-p-n-s-provider.md deleted file mode 100644 index d329d26..0000000 --- a/docs/examples/messaging/create-a-p-n-s-provider.md +++ /dev/null @@ -1,18 +0,0 @@ -import { Client, Messaging } from "@appwrite.io/console"; - -const client = new Client(); - -const messaging = new Messaging(client); - -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.createAPNSProvider('[PROVIDER_ID]', '[NAME]'); - -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md new file mode 100644 index 0000000..ef586bb --- /dev/null +++ b/docs/examples/messaging/create-apns-provider.md @@ -0,0 +1,19 @@ +import { Client, Messaging } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.createApnsProvider( + '[PROVIDER_ID]', // providerId + '[NAME]', // name + '[AUTH_KEY]', // authKey (optional) + '[AUTH_KEY_ID]', // authKeyId (optional) + '[TEAM_ID]', // teamId (optional) + '[BUNDLE_ID]', // bundleId (optional) + false // enabled (optional) +); + +console.log(response); diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md index 2446f07..536fdb2 100644 --- a/docs/examples/messaging/create-email.md +++ b/docs/examples/messaging/create-email.md @@ -1,18 +1,24 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging, MessageStatus } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.createEmail('[MESSAGE_ID]', '[SUBJECT]', '[CONTENT]'); +const result = await messaging.createEmail( + '[MESSAGE_ID]', // messageId + '[SUBJECT]', // subject + '[CONTENT]', // content + [], // topics (optional) + [], // users (optional) + [], // targets (optional) + [], // cc (optional) + [], // bcc (optional) + [], // attachments (optional) + MessageStatus.Draft, // status (optional) + false, // html (optional) + '' // scheduledAt (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/create-f-c-m-provider.md b/docs/examples/messaging/create-f-c-m-provider.md deleted file mode 100644 index a4774c7..0000000 --- a/docs/examples/messaging/create-f-c-m-provider.md +++ /dev/null @@ -1,18 +0,0 @@ -import { Client, Messaging } from "@appwrite.io/console"; - -const client = new Client(); - -const messaging = new Messaging(client); - -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.createFCMProvider('[PROVIDER_ID]', '[NAME]'); - -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md new file mode 100644 index 0000000..5a59ac7 --- /dev/null +++ b/docs/examples/messaging/create-fcm-provider.md @@ -0,0 +1,16 @@ +import { Client, Messaging } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.createFcmProvider( + '[PROVIDER_ID]', // providerId + '[NAME]', // name + {}, // serviceAccountJSON (optional) + false // enabled (optional) +); + +console.log(response); diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md index 74e01fe..d81fbc9 100644 --- a/docs/examples/messaging/create-mailgun-provider.md +++ b/docs/examples/messaging/create-mailgun-provider.md @@ -1,18 +1,22 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.createMailgunProvider('[PROVIDER_ID]', '[NAME]'); +const result = await messaging.createMailgunProvider( + '[PROVIDER_ID]', // providerId + '[NAME]', // name + '[API_KEY]', // apiKey (optional) + '[DOMAIN]', // domain (optional) + false, // isEuRegion (optional) + '[FROM_NAME]', // fromName (optional) + 'email@example.com', // fromEmail (optional) + '[REPLY_TO_NAME]', // replyToName (optional) + 'email@example.com', // replyToEmail (optional) + false // enabled (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/create-msg91provider.md b/docs/examples/messaging/create-msg91provider.md index 4c4836a..5be2510 100644 --- a/docs/examples/messaging/create-msg91provider.md +++ b/docs/examples/messaging/create-msg91provider.md @@ -1,18 +1,18 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.createMsg91Provider('[PROVIDER_ID]', '[NAME]'); +const result = await messaging.createMsg91Provider( + '[PROVIDER_ID]', // providerId + '[NAME]', // name + '+12065550100', // from (optional) + '[SENDER_ID]', // senderId (optional) + '[AUTH_KEY]', // authKey (optional) + false // enabled (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md index 7551a4a..e5de584 100644 --- a/docs/examples/messaging/create-push.md +++ b/docs/examples/messaging/create-push.md @@ -1,18 +1,28 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging, MessageStatus } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.createPush('[MESSAGE_ID]', '[TITLE]', '[BODY]'); +const result = await messaging.createPush( + '[MESSAGE_ID]', // messageId + '[TITLE]', // title + '[BODY]', // body + [], // topics (optional) + [], // users (optional) + [], // targets (optional) + {}, // data (optional) + '[ACTION]', // action (optional) + '[ID1:ID2]', // image (optional) + '[ICON]', // icon (optional) + '[SOUND]', // sound (optional) + '[COLOR]', // color (optional) + '[TAG]', // tag (optional) + '[BADGE]', // badge (optional) + MessageStatus.Draft, // status (optional) + '' // scheduledAt (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/create-s-m-s.md b/docs/examples/messaging/create-s-m-s.md deleted file mode 100644 index d29de0d..0000000 --- a/docs/examples/messaging/create-s-m-s.md +++ /dev/null @@ -1,18 +0,0 @@ -import { Client, Messaging } from "@appwrite.io/console"; - -const client = new Client(); - -const messaging = new Messaging(client); - -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.createSMS('[MESSAGE_ID]', '[CONTENT]'); - -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file diff --git a/docs/examples/messaging/create-s-m-t-p-provider.md b/docs/examples/messaging/create-s-m-t-p-provider.md deleted file mode 100644 index d463ba3..0000000 --- a/docs/examples/messaging/create-s-m-t-p-provider.md +++ /dev/null @@ -1,18 +0,0 @@ -import { Client, Messaging } from "@appwrite.io/console"; - -const client = new Client(); - -const messaging = new Messaging(client); - -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.createSMTPProvider('[PROVIDER_ID]', '[NAME]', '[HOST]'); - -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file diff --git a/docs/examples/messaging/create-sendgrid-provider.md b/docs/examples/messaging/create-sendgrid-provider.md index 093692b..7f9acef 100644 --- a/docs/examples/messaging/create-sendgrid-provider.md +++ b/docs/examples/messaging/create-sendgrid-provider.md @@ -1,18 +1,20 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.createSendgridProvider('[PROVIDER_ID]', '[NAME]'); +const result = await messaging.createSendgridProvider( + '[PROVIDER_ID]', // providerId + '[NAME]', // name + '[API_KEY]', // apiKey (optional) + '[FROM_NAME]', // fromName (optional) + 'email@example.com', // fromEmail (optional) + '[REPLY_TO_NAME]', // replyToName (optional) + 'email@example.com', // replyToEmail (optional) + false // enabled (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md new file mode 100644 index 0000000..d3a06a3 --- /dev/null +++ b/docs/examples/messaging/create-sms.md @@ -0,0 +1,19 @@ +import { Client, Messaging, MessageStatus } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.createSms( + '[MESSAGE_ID]', // messageId + '[CONTENT]', // content + [], // topics (optional) + [], // users (optional) + [], // targets (optional) + MessageStatus.Draft, // status (optional) + '' // scheduledAt (optional) +); + +console.log(response); diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md new file mode 100644 index 0000000..64e2cb6 --- /dev/null +++ b/docs/examples/messaging/create-smtp-provider.md @@ -0,0 +1,26 @@ +import { Client, Messaging, } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.createSmtpProvider( + '[PROVIDER_ID]', // providerId + '[NAME]', // name + '[HOST]', // host + 1, // port (optional) + '[USERNAME]', // username (optional) + '[PASSWORD]', // password (optional) + .None, // encryption (optional) + false, // autoTLS (optional) + '[MAILER]', // mailer (optional) + '[FROM_NAME]', // fromName (optional) + 'email@example.com', // fromEmail (optional) + '[REPLY_TO_NAME]', // replyToName (optional) + 'email@example.com', // replyToEmail (optional) + false // enabled (optional) +); + +console.log(response); diff --git a/docs/examples/messaging/create-subscriber.md b/docs/examples/messaging/create-subscriber.md index 0ae0075..7ad2feb 100644 --- a/docs/examples/messaging/create-subscriber.md +++ b/docs/examples/messaging/create-subscriber.md @@ -1,18 +1,15 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.createSubscriber('[TOPIC_ID]', '[SUBSCRIBER_ID]', '[TARGET_ID]'); +const result = await messaging.createSubscriber( + '[TOPIC_ID]', // topicId + '[SUBSCRIBER_ID]', // subscriberId + '[TARGET_ID]' // targetId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/create-telesign-provider.md b/docs/examples/messaging/create-telesign-provider.md index 980a0ce..8ef4bc4 100644 --- a/docs/examples/messaging/create-telesign-provider.md +++ b/docs/examples/messaging/create-telesign-provider.md @@ -1,18 +1,18 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.createTelesignProvider('[PROVIDER_ID]', '[NAME]'); +const result = await messaging.createTelesignProvider( + '[PROVIDER_ID]', // providerId + '[NAME]', // name + '+12065550100', // from (optional) + '[CUSTOMER_ID]', // customerId (optional) + '[API_KEY]', // apiKey (optional) + false // enabled (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/create-textmagic-provider.md b/docs/examples/messaging/create-textmagic-provider.md index 354b648..b2e6c48 100644 --- a/docs/examples/messaging/create-textmagic-provider.md +++ b/docs/examples/messaging/create-textmagic-provider.md @@ -1,18 +1,18 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.createTextmagicProvider('[PROVIDER_ID]', '[NAME]'); +const result = await messaging.createTextmagicProvider( + '[PROVIDER_ID]', // providerId + '[NAME]', // name + '+12065550100', // from (optional) + '[USERNAME]', // username (optional) + '[API_KEY]', // apiKey (optional) + false // enabled (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md index 3abe5cf..0f284d8 100644 --- a/docs/examples/messaging/create-topic.md +++ b/docs/examples/messaging/create-topic.md @@ -1,18 +1,15 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.createTopic('[TOPIC_ID]', '[NAME]'); +const result = await messaging.createTopic( + '[TOPIC_ID]', // topicId + '[NAME]', // name + ["any"] // subscribe (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/create-twilio-provider.md b/docs/examples/messaging/create-twilio-provider.md index edda071..91d51f4 100644 --- a/docs/examples/messaging/create-twilio-provider.md +++ b/docs/examples/messaging/create-twilio-provider.md @@ -1,18 +1,18 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.createTwilioProvider('[PROVIDER_ID]', '[NAME]'); +const result = await messaging.createTwilioProvider( + '[PROVIDER_ID]', // providerId + '[NAME]', // name + '+12065550100', // from (optional) + '[ACCOUNT_SID]', // accountSid (optional) + '[AUTH_TOKEN]', // authToken (optional) + false // enabled (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/create-vonage-provider.md b/docs/examples/messaging/create-vonage-provider.md index 60e4513..5f7e1c9 100644 --- a/docs/examples/messaging/create-vonage-provider.md +++ b/docs/examples/messaging/create-vonage-provider.md @@ -1,18 +1,18 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.createVonageProvider('[PROVIDER_ID]', '[NAME]'); +const result = await messaging.createVonageProvider( + '[PROVIDER_ID]', // providerId + '[NAME]', // name + '+12065550100', // from (optional) + '[API_KEY]', // apiKey (optional) + '[API_SECRET]', // apiSecret (optional) + false // enabled (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/delete-provider.md b/docs/examples/messaging/delete-provider.md index 0f36983..469ab0d 100644 --- a/docs/examples/messaging/delete-provider.md +++ b/docs/examples/messaging/delete-provider.md @@ -1,18 +1,13 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.deleteProvider('[PROVIDER_ID]'); +const result = await messaging.deleteProvider( + '[PROVIDER_ID]' // providerId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/delete-subscriber.md b/docs/examples/messaging/delete-subscriber.md index 008e4a2..d35bfc6 100644 --- a/docs/examples/messaging/delete-subscriber.md +++ b/docs/examples/messaging/delete-subscriber.md @@ -1,18 +1,14 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.deleteSubscriber('[TOPIC_ID]', '[SUBSCRIBER_ID]'); +const result = await messaging.deleteSubscriber( + '[TOPIC_ID]', // topicId + '[SUBSCRIBER_ID]' // subscriberId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/delete-topic.md b/docs/examples/messaging/delete-topic.md index 43a7038..6a897f4 100644 --- a/docs/examples/messaging/delete-topic.md +++ b/docs/examples/messaging/delete-topic.md @@ -1,18 +1,13 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.deleteTopic('[TOPIC_ID]'); +const result = await messaging.deleteTopic( + '[TOPIC_ID]' // topicId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/delete.md b/docs/examples/messaging/delete.md index 44d0e9e..c3ab377 100644 --- a/docs/examples/messaging/delete.md +++ b/docs/examples/messaging/delete.md @@ -1,18 +1,13 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.delete('[MESSAGE_ID]'); +const result = await messaging.delete( + '[MESSAGE_ID]' // messageId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/get-message.md b/docs/examples/messaging/get-message.md index 3db2c79..9210a9c 100644 --- a/docs/examples/messaging/get-message.md +++ b/docs/examples/messaging/get-message.md @@ -1,18 +1,13 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.getMessage('[MESSAGE_ID]'); +const result = await messaging.getMessage( + '[MESSAGE_ID]' // messageId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/get-provider.md b/docs/examples/messaging/get-provider.md index 730cd68..4cfbc8b 100644 --- a/docs/examples/messaging/get-provider.md +++ b/docs/examples/messaging/get-provider.md @@ -1,18 +1,13 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.getProvider('[PROVIDER_ID]'); +const result = await messaging.getProvider( + '[PROVIDER_ID]' // providerId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/get-subscriber.md b/docs/examples/messaging/get-subscriber.md index d2b1427..7aa9676 100644 --- a/docs/examples/messaging/get-subscriber.md +++ b/docs/examples/messaging/get-subscriber.md @@ -1,18 +1,14 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.getSubscriber('[TOPIC_ID]', '[SUBSCRIBER_ID]'); +const result = await messaging.getSubscriber( + '[TOPIC_ID]', // topicId + '[SUBSCRIBER_ID]' // subscriberId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/get-topic.md b/docs/examples/messaging/get-topic.md index 5e27b78..5dd1259 100644 --- a/docs/examples/messaging/get-topic.md +++ b/docs/examples/messaging/get-topic.md @@ -1,18 +1,13 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.getTopic('[TOPIC_ID]'); +const result = await messaging.getTopic( + '[TOPIC_ID]' // topicId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md index d961a4a..0cea52f 100644 --- a/docs/examples/messaging/list-message-logs.md +++ b/docs/examples/messaging/list-message-logs.md @@ -1,18 +1,14 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.listMessageLogs('[MESSAGE_ID]'); +const result = await messaging.listMessageLogs( + '[MESSAGE_ID]', // messageId + [] // queries (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md index 307f89a..c61362e 100644 --- a/docs/examples/messaging/list-messages.md +++ b/docs/examples/messaging/list-messages.md @@ -1,18 +1,14 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.listMessages(); +const result = await messaging.listMessages( + [], // queries (optional) + '[SEARCH]' // search (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md index 91ac169..0fd5942 100644 --- a/docs/examples/messaging/list-provider-logs.md +++ b/docs/examples/messaging/list-provider-logs.md @@ -1,18 +1,14 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.listProviderLogs('[PROVIDER_ID]'); +const result = await messaging.listProviderLogs( + '[PROVIDER_ID]', // providerId + [] // queries (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md index 3582cf4..c605d92 100644 --- a/docs/examples/messaging/list-providers.md +++ b/docs/examples/messaging/list-providers.md @@ -1,18 +1,14 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.listProviders(); +const result = await messaging.listProviders( + [], // queries (optional) + '[SEARCH]' // search (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md index 8d43783..b0c04a0 100644 --- a/docs/examples/messaging/list-subscriber-logs.md +++ b/docs/examples/messaging/list-subscriber-logs.md @@ -1,18 +1,14 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.listSubscriberLogs('[SUBSCRIBER_ID]'); +const result = await messaging.listSubscriberLogs( + '[SUBSCRIBER_ID]', // subscriberId + [] // queries (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md index c9b258f..6f13bcd 100644 --- a/docs/examples/messaging/list-subscribers.md +++ b/docs/examples/messaging/list-subscribers.md @@ -1,18 +1,15 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.listSubscribers('[TOPIC_ID]'); +const result = await messaging.listSubscribers( + '[TOPIC_ID]', // topicId + [], // queries (optional) + '[SEARCH]' // search (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md index 1503fa2..a365136 100644 --- a/docs/examples/messaging/list-targets.md +++ b/docs/examples/messaging/list-targets.md @@ -1,18 +1,14 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.listTargets('[MESSAGE_ID]'); +const result = await messaging.listTargets( + '[MESSAGE_ID]', // messageId + [] // queries (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md index b7b0890..485a481 100644 --- a/docs/examples/messaging/list-topic-logs.md +++ b/docs/examples/messaging/list-topic-logs.md @@ -1,18 +1,14 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.listTopicLogs('[TOPIC_ID]'); +const result = await messaging.listTopicLogs( + '[TOPIC_ID]', // topicId + [] // queries (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md index f969c7c..138ec57 100644 --- a/docs/examples/messaging/list-topics.md +++ b/docs/examples/messaging/list-topics.md @@ -1,18 +1,14 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.listTopics(); +const result = await messaging.listTopics( + [], // queries (optional) + '[SEARCH]' // search (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/update-a-p-n-s-provider.md b/docs/examples/messaging/update-a-p-n-s-provider.md index 940deb6..24e3a59 100644 --- a/docs/examples/messaging/update-a-p-n-s-provider.md +++ b/docs/examples/messaging/update-a-p-n-s-provider.md @@ -1,18 +1,19 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.updateAPNSProvider('[PROVIDER_ID]'); +const result = await messaging.updateAPNSProvider( + '[PROVIDER_ID]', // providerId + '[NAME]', // name (optional) + false, // enabled (optional) + '[AUTH_KEY]', // authKey (optional) + '[AUTH_KEY_ID]', // authKeyId (optional) + '[TEAM_ID]', // teamId (optional) + '[BUNDLE_ID]' // bundleId (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md index 04a6866..e667b2f 100644 --- a/docs/examples/messaging/update-email.md +++ b/docs/examples/messaging/update-email.md @@ -1,18 +1,23 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging, MessageStatus } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.updateEmail('[MESSAGE_ID]'); +const result = await messaging.updateEmail( + '[MESSAGE_ID]', // messageId + [], // topics (optional) + [], // users (optional) + [], // targets (optional) + '[SUBJECT]', // subject (optional) + '[CONTENT]', // content (optional) + MessageStatus.Draft, // status (optional) + false, // html (optional) + [], // cc (optional) + [], // bcc (optional) + '' // scheduledAt (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/update-f-c-m-provider.md b/docs/examples/messaging/update-f-c-m-provider.md index f4e27ad..e734ce6 100644 --- a/docs/examples/messaging/update-f-c-m-provider.md +++ b/docs/examples/messaging/update-f-c-m-provider.md @@ -1,18 +1,16 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.updateFCMProvider('[PROVIDER_ID]'); +const result = await messaging.updateFCMProvider( + '[PROVIDER_ID]', // providerId + '[NAME]', // name (optional) + false, // enabled (optional) + {} // serviceAccountJSON (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md index 3362af6..2091937 100644 --- a/docs/examples/messaging/update-mailgun-provider.md +++ b/docs/examples/messaging/update-mailgun-provider.md @@ -1,18 +1,22 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.updateMailgunProvider('[PROVIDER_ID]'); +const result = await messaging.updateMailgunProvider( + '[PROVIDER_ID]', // providerId + '[NAME]', // name (optional) + '[API_KEY]', // apiKey (optional) + '[DOMAIN]', // domain (optional) + false, // isEuRegion (optional) + false, // enabled (optional) + '[FROM_NAME]', // fromName (optional) + 'email@example.com', // fromEmail (optional) + '[REPLY_TO_NAME]', // replyToName (optional) + '[REPLY_TO_EMAIL]' // replyToEmail (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/update-msg91provider.md b/docs/examples/messaging/update-msg91provider.md index 8afc241..196c749 100644 --- a/docs/examples/messaging/update-msg91provider.md +++ b/docs/examples/messaging/update-msg91provider.md @@ -1,18 +1,18 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.updateMsg91Provider('[PROVIDER_ID]'); +const result = await messaging.updateMsg91Provider( + '[PROVIDER_ID]', // providerId + '[NAME]', // name (optional) + false, // enabled (optional) + '[SENDER_ID]', // senderId (optional) + '[AUTH_KEY]', // authKey (optional) + '[FROM]' // from (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md index 8aed4aa..bcf29f2 100644 --- a/docs/examples/messaging/update-push.md +++ b/docs/examples/messaging/update-push.md @@ -1,18 +1,28 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging, MessageStatus } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.updatePush('[MESSAGE_ID]'); +const result = await messaging.updatePush( + '[MESSAGE_ID]', // messageId + [], // topics (optional) + [], // users (optional) + [], // targets (optional) + '[TITLE]', // title (optional) + '[BODY]', // body (optional) + {}, // data (optional) + '[ACTION]', // action (optional) + '[ID1:ID2]', // image (optional) + '[ICON]', // icon (optional) + '[SOUND]', // sound (optional) + '[COLOR]', // color (optional) + '[TAG]', // tag (optional) + null, // badge (optional) + MessageStatus.Draft, // status (optional) + '' // scheduledAt (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/update-s-m-s.md b/docs/examples/messaging/update-s-m-s.md deleted file mode 100644 index b43057a..0000000 --- a/docs/examples/messaging/update-s-m-s.md +++ /dev/null @@ -1,18 +0,0 @@ -import { Client, Messaging } from "@appwrite.io/console"; - -const client = new Client(); - -const messaging = new Messaging(client); - -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.updateSMS('[MESSAGE_ID]'); - -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file diff --git a/docs/examples/messaging/update-s-m-t-p-provider.md b/docs/examples/messaging/update-s-m-t-p-provider.md deleted file mode 100644 index 163512e..0000000 --- a/docs/examples/messaging/update-s-m-t-p-provider.md +++ /dev/null @@ -1,18 +0,0 @@ -import { Client, Messaging } from "@appwrite.io/console"; - -const client = new Client(); - -const messaging = new Messaging(client); - -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.updateSMTPProvider('[PROVIDER_ID]'); - -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file diff --git a/docs/examples/messaging/update-sendgrid-provider.md b/docs/examples/messaging/update-sendgrid-provider.md index 77012db..b7df476 100644 --- a/docs/examples/messaging/update-sendgrid-provider.md +++ b/docs/examples/messaging/update-sendgrid-provider.md @@ -1,18 +1,20 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.updateSendgridProvider('[PROVIDER_ID]'); +const result = await messaging.updateSendgridProvider( + '[PROVIDER_ID]', // providerId + '[NAME]', // name (optional) + false, // enabled (optional) + '[API_KEY]', // apiKey (optional) + '[FROM_NAME]', // fromName (optional) + 'email@example.com', // fromEmail (optional) + '[REPLY_TO_NAME]', // replyToName (optional) + '[REPLY_TO_EMAIL]' // replyToEmail (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md new file mode 100644 index 0000000..8adba2f --- /dev/null +++ b/docs/examples/messaging/update-sms.md @@ -0,0 +1,19 @@ +import { Client, Messaging, MessageStatus } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.updateSms( + '[MESSAGE_ID]', // messageId + [], // topics (optional) + [], // users (optional) + [], // targets (optional) + '[CONTENT]', // content (optional) + MessageStatus.Draft, // status (optional) + '' // scheduledAt (optional) +); + +console.log(response); diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md new file mode 100644 index 0000000..9632f8e --- /dev/null +++ b/docs/examples/messaging/update-smtp-provider.md @@ -0,0 +1,26 @@ +import { Client, Messaging, } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.updateSmtpProvider( + '[PROVIDER_ID]', // providerId + '[NAME]', // name (optional) + '[HOST]', // host (optional) + 1, // port (optional) + '[USERNAME]', // username (optional) + '[PASSWORD]', // password (optional) + .None, // encryption (optional) + false, // autoTLS (optional) + '[MAILER]', // mailer (optional) + '[FROM_NAME]', // fromName (optional) + 'email@example.com', // fromEmail (optional) + '[REPLY_TO_NAME]', // replyToName (optional) + '[REPLY_TO_EMAIL]', // replyToEmail (optional) + false // enabled (optional) +); + +console.log(response); diff --git a/docs/examples/messaging/update-telesign-provider.md b/docs/examples/messaging/update-telesign-provider.md index 7eb3fb9..d9d6d97 100644 --- a/docs/examples/messaging/update-telesign-provider.md +++ b/docs/examples/messaging/update-telesign-provider.md @@ -1,18 +1,18 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.updateTelesignProvider('[PROVIDER_ID]'); +const result = await messaging.updateTelesignProvider( + '[PROVIDER_ID]', // providerId + '[NAME]', // name (optional) + false, // enabled (optional) + '[CUSTOMER_ID]', // customerId (optional) + '[API_KEY]', // apiKey (optional) + '[FROM]' // from (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/update-textmagic-provider.md b/docs/examples/messaging/update-textmagic-provider.md index a790800..bcaa39f 100644 --- a/docs/examples/messaging/update-textmagic-provider.md +++ b/docs/examples/messaging/update-textmagic-provider.md @@ -1,18 +1,18 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.updateTextmagicProvider('[PROVIDER_ID]'); +const result = await messaging.updateTextmagicProvider( + '[PROVIDER_ID]', // providerId + '[NAME]', // name (optional) + false, // enabled (optional) + '[USERNAME]', // username (optional) + '[API_KEY]', // apiKey (optional) + '[FROM]' // from (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md index 64ffb09..8f9c64a 100644 --- a/docs/examples/messaging/update-topic.md +++ b/docs/examples/messaging/update-topic.md @@ -1,18 +1,14 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.updateTopic('[TOPIC_ID]'); +const result = await messaging.updateTopic( + '[TOPIC_ID]', // topicId + '[NAME]' // name (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/update-twilio-provider.md b/docs/examples/messaging/update-twilio-provider.md index 81490c2..39ddafb 100644 --- a/docs/examples/messaging/update-twilio-provider.md +++ b/docs/examples/messaging/update-twilio-provider.md @@ -1,18 +1,18 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.updateTwilioProvider('[PROVIDER_ID]'); +const result = await messaging.updateTwilioProvider( + '[PROVIDER_ID]', // providerId + '[NAME]', // name (optional) + false, // enabled (optional) + '[ACCOUNT_SID]', // accountSid (optional) + '[AUTH_TOKEN]', // authToken (optional) + '[FROM]' // from (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/messaging/update-vonage-provider.md b/docs/examples/messaging/update-vonage-provider.md index ac65e1b..cc0c933 100644 --- a/docs/examples/messaging/update-vonage-provider.md +++ b/docs/examples/messaging/update-vonage-provider.md @@ -1,18 +1,18 @@ -import { Client, Messaging } from "@appwrite.io/console"; +import { Client, Messaging } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const messaging = new Messaging(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = messaging.updateVonageProvider('[PROVIDER_ID]'); +const result = await messaging.updateVonageProvider( + '[PROVIDER_ID]', // providerId + '[NAME]', // name (optional) + false, // enabled (optional) + '[API_KEY]', // apiKey (optional) + '[API_SECRET]', // apiSecret (optional) + '[FROM]' // from (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/migrations/create-appwrite-migration.md b/docs/examples/migrations/create-appwrite-migration.md index f93c813..196c127 100644 --- a/docs/examples/migrations/create-appwrite-migration.md +++ b/docs/examples/migrations/create-appwrite-migration.md @@ -1,18 +1,16 @@ -import { Client, Migrations } from "@appwrite.io/console"; +import { Client, Migrations } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const migrations = new Migrations(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = migrations.createAppwriteMigration([], 'https://example.com', '[PROJECT_ID]', '[API_KEY]'); +const result = await migrations.createAppwriteMigration( + [], // resources + 'https://example.com', // endpoint + '[PROJECT_ID]', // projectId + '[API_KEY]' // apiKey +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/migrations/create-firebase-migration.md b/docs/examples/migrations/create-firebase-migration.md index 0f2f962..98a8692 100644 --- a/docs/examples/migrations/create-firebase-migration.md +++ b/docs/examples/migrations/create-firebase-migration.md @@ -1,18 +1,14 @@ -import { Client, Migrations } from "@appwrite.io/console"; +import { Client, Migrations } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const migrations = new Migrations(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = migrations.createFirebaseMigration([], '[SERVICE_ACCOUNT]'); +const result = await migrations.createFirebaseMigration( + [], // resources + '[SERVICE_ACCOUNT]' // serviceAccount +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/migrations/create-firebase-o-auth-migration.md b/docs/examples/migrations/create-firebase-o-auth-migration.md index 002b066..46fba36 100644 --- a/docs/examples/migrations/create-firebase-o-auth-migration.md +++ b/docs/examples/migrations/create-firebase-o-auth-migration.md @@ -1,18 +1,14 @@ -import { Client, Migrations } from "@appwrite.io/console"; +import { Client, Migrations } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const migrations = new Migrations(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = migrations.createFirebaseOAuthMigration([], '[PROJECT_ID]'); +const result = await migrations.createFirebaseOAuthMigration( + [], // resources + '[PROJECT_ID]' // projectId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/migrations/create-n-host-migration.md b/docs/examples/migrations/create-n-host-migration.md index bc65c5f..cff794f 100644 --- a/docs/examples/migrations/create-n-host-migration.md +++ b/docs/examples/migrations/create-n-host-migration.md @@ -1,18 +1,20 @@ -import { Client, Migrations } from "@appwrite.io/console"; +import { Client, Migrations } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const migrations = new Migrations(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = migrations.createNHostMigration([], '[SUBDOMAIN]', '[REGION]', '[ADMIN_SECRET]', '[DATABASE]', '[USERNAME]', '[PASSWORD]'); +const result = await migrations.createNHostMigration( + [], // resources + '[SUBDOMAIN]', // subdomain + '[REGION]', // region + '[ADMIN_SECRET]', // adminSecret + '[DATABASE]', // database + '[USERNAME]', // username + '[PASSWORD]', // password + null // port (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/migrations/create-supabase-migration.md b/docs/examples/migrations/create-supabase-migration.md index ea51756..a98a407 100644 --- a/docs/examples/migrations/create-supabase-migration.md +++ b/docs/examples/migrations/create-supabase-migration.md @@ -1,18 +1,19 @@ -import { Client, Migrations } from "@appwrite.io/console"; +import { Client, Migrations } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const migrations = new Migrations(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = migrations.createSupabaseMigration([], 'https://example.com', '[API_KEY]', '[DATABASE_HOST]', '[USERNAME]', '[PASSWORD]'); +const result = await migrations.createSupabaseMigration( + [], // resources + 'https://example.com', // endpoint + '[API_KEY]', // apiKey + '[DATABASE_HOST]', // databaseHost + '[USERNAME]', // username + '[PASSWORD]', // password + null // port (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/migrations/delete-firebase-auth.md b/docs/examples/migrations/delete-firebase-auth.md index 16c4e30..5707be7 100644 --- a/docs/examples/migrations/delete-firebase-auth.md +++ b/docs/examples/migrations/delete-firebase-auth.md @@ -1,18 +1,11 @@ -import { Client, Migrations } from "@appwrite.io/console"; +import { Client, Migrations } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const migrations = new Migrations(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = migrations.deleteFirebaseAuth(); +const result = await migrations.deleteFirebaseAuth(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/migrations/delete.md b/docs/examples/migrations/delete.md index bb11ef3..a3f0d0f 100644 --- a/docs/examples/migrations/delete.md +++ b/docs/examples/migrations/delete.md @@ -1,18 +1,13 @@ -import { Client, Migrations } from "@appwrite.io/console"; +import { Client, Migrations } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const migrations = new Migrations(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = migrations.delete('[MIGRATION_ID]'); +const result = await migrations.delete( + '[MIGRATION_ID]' // migrationId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/migrations/get-appwrite-report.md b/docs/examples/migrations/get-appwrite-report.md index 4c8d695..8e6fa65 100644 --- a/docs/examples/migrations/get-appwrite-report.md +++ b/docs/examples/migrations/get-appwrite-report.md @@ -1,18 +1,16 @@ -import { Client, Migrations } from "@appwrite.io/console"; +import { Client, Migrations } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const migrations = new Migrations(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = migrations.getAppwriteReport([], 'https://example.com', '[PROJECT_ID]', '[KEY]'); +const result = await migrations.getAppwriteReport( + [], // resources + 'https://example.com', // endpoint + '[PROJECT_ID]', // projectID + '[KEY]' // key +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/migrations/get-firebase-report-o-auth.md b/docs/examples/migrations/get-firebase-report-o-auth.md index 3f49a2c..d1779ba 100644 --- a/docs/examples/migrations/get-firebase-report-o-auth.md +++ b/docs/examples/migrations/get-firebase-report-o-auth.md @@ -1,18 +1,14 @@ -import { Client, Migrations } from "@appwrite.io/console"; +import { Client, Migrations } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const migrations = new Migrations(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = migrations.getFirebaseReportOAuth([], '[PROJECT_ID]'); +const result = await migrations.getFirebaseReportOAuth( + [], // resources + '[PROJECT_ID]' // projectId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/migrations/get-firebase-report.md b/docs/examples/migrations/get-firebase-report.md index c0d0bdb..ea4f7c7 100644 --- a/docs/examples/migrations/get-firebase-report.md +++ b/docs/examples/migrations/get-firebase-report.md @@ -1,18 +1,14 @@ -import { Client, Migrations } from "@appwrite.io/console"; +import { Client, Migrations } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const migrations = new Migrations(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = migrations.getFirebaseReport([], '[SERVICE_ACCOUNT]'); +const result = await migrations.getFirebaseReport( + [], // resources + '[SERVICE_ACCOUNT]' // serviceAccount +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/migrations/get-n-host-report.md b/docs/examples/migrations/get-n-host-report.md index c8e2aea..e904950 100644 --- a/docs/examples/migrations/get-n-host-report.md +++ b/docs/examples/migrations/get-n-host-report.md @@ -1,18 +1,20 @@ -import { Client, Migrations } from "@appwrite.io/console"; +import { Client, Migrations } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const migrations = new Migrations(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = migrations.getNHostReport([], '[SUBDOMAIN]', '[REGION]', '[ADMIN_SECRET]', '[DATABASE]', '[USERNAME]', '[PASSWORD]'); +const result = await migrations.getNHostReport( + [], // resources + '[SUBDOMAIN]', // subdomain + '[REGION]', // region + '[ADMIN_SECRET]', // adminSecret + '[DATABASE]', // database + '[USERNAME]', // username + '[PASSWORD]', // password + null // port (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/migrations/get-supabase-report.md b/docs/examples/migrations/get-supabase-report.md index 146a895..c390227 100644 --- a/docs/examples/migrations/get-supabase-report.md +++ b/docs/examples/migrations/get-supabase-report.md @@ -1,18 +1,19 @@ -import { Client, Migrations } from "@appwrite.io/console"; +import { Client, Migrations } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const migrations = new Migrations(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = migrations.getSupabaseReport([], 'https://example.com', '[API_KEY]', '[DATABASE_HOST]', '[USERNAME]', '[PASSWORD]'); +const result = await migrations.getSupabaseReport( + [], // resources + 'https://example.com', // endpoint + '[API_KEY]', // apiKey + '[DATABASE_HOST]', // databaseHost + '[USERNAME]', // username + '[PASSWORD]', // password + null // port (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/migrations/get.md b/docs/examples/migrations/get.md index 4c1e7cb..8cfc284 100644 --- a/docs/examples/migrations/get.md +++ b/docs/examples/migrations/get.md @@ -1,18 +1,13 @@ -import { Client, Migrations } from "@appwrite.io/console"; +import { Client, Migrations } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const migrations = new Migrations(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = migrations.get('[MIGRATION_ID]'); +const result = await migrations.get( + '[MIGRATION_ID]' // migrationId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/migrations/list-firebase-projects.md b/docs/examples/migrations/list-firebase-projects.md index e237936..018b121 100644 --- a/docs/examples/migrations/list-firebase-projects.md +++ b/docs/examples/migrations/list-firebase-projects.md @@ -1,18 +1,11 @@ -import { Client, Migrations } from "@appwrite.io/console"; +import { Client, Migrations } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const migrations = new Migrations(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = migrations.listFirebaseProjects(); +const result = await migrations.listFirebaseProjects(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/migrations/list.md b/docs/examples/migrations/list.md index 39e5c22..c8cdd5b 100644 --- a/docs/examples/migrations/list.md +++ b/docs/examples/migrations/list.md @@ -1,18 +1,14 @@ -import { Client, Migrations } from "@appwrite.io/console"; +import { Client, Migrations } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const migrations = new Migrations(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = migrations.list(); +const result = await migrations.list( + [], // queries (optional) + '[SEARCH]' // search (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/migrations/retry.md b/docs/examples/migrations/retry.md index 31d32fe..3c092d9 100644 --- a/docs/examples/migrations/retry.md +++ b/docs/examples/migrations/retry.md @@ -1,18 +1,13 @@ -import { Client, Migrations } from "@appwrite.io/console"; +import { Client, Migrations } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const migrations = new Migrations(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = migrations.retry('[MIGRATION_ID]'); +const result = await migrations.retry( + '[MIGRATION_ID]' // migrationId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/project/create-variable.md b/docs/examples/project/create-variable.md index db07ad8..e56846e 100644 --- a/docs/examples/project/create-variable.md +++ b/docs/examples/project/create-variable.md @@ -1,18 +1,14 @@ -import { Client, Project } from "@appwrite.io/console"; +import { Client, Project } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const project = new Project(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = project.createVariable('[KEY]', '[VALUE]'); +const result = await project.createVariable( + '[KEY]', // key + '[VALUE]' // value +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/project/delete-variable.md b/docs/examples/project/delete-variable.md index d2d0dee..82490bb 100644 --- a/docs/examples/project/delete-variable.md +++ b/docs/examples/project/delete-variable.md @@ -1,18 +1,13 @@ -import { Client, Project } from "@appwrite.io/console"; +import { Client, Project } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const project = new Project(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = project.deleteVariable('[VARIABLE_ID]'); +const result = await project.deleteVariable( + '[VARIABLE_ID]' // variableId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/project/get-usage.md b/docs/examples/project/get-usage.md index 685b7a1..b81026e 100644 --- a/docs/examples/project/get-usage.md +++ b/docs/examples/project/get-usage.md @@ -1,18 +1,15 @@ -import { Client, Project } from "@appwrite.io/console"; +import { Client, Project, ProjectUsageRange } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const project = new Project(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = project.getUsage('', ''); +const result = await project.getUsage( + '', // startDate + '', // endDate + ProjectUsageRange.OneHour // period (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/project/get-variable.md b/docs/examples/project/get-variable.md index 4364f08..208e0ea 100644 --- a/docs/examples/project/get-variable.md +++ b/docs/examples/project/get-variable.md @@ -1,18 +1,13 @@ -import { Client, Project } from "@appwrite.io/console"; +import { Client, Project } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const project = new Project(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = project.getVariable('[VARIABLE_ID]'); +const result = await project.getVariable( + '[VARIABLE_ID]' // variableId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/project/list-variables.md b/docs/examples/project/list-variables.md index f9492f8..41e448e 100644 --- a/docs/examples/project/list-variables.md +++ b/docs/examples/project/list-variables.md @@ -1,18 +1,11 @@ -import { Client, Project } from "@appwrite.io/console"; +import { Client, Project } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const project = new Project(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = project.listVariables(); +const result = await project.listVariables(); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/project/update-variable.md b/docs/examples/project/update-variable.md index 9b1b9a3..033efbb 100644 --- a/docs/examples/project/update-variable.md +++ b/docs/examples/project/update-variable.md @@ -1,18 +1,15 @@ -import { Client, Project } from "@appwrite.io/console"; +import { Client, Project } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const project = new Project(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = project.updateVariable('[VARIABLE_ID]', '[KEY]'); +const result = await project.updateVariable( + '[VARIABLE_ID]', // variableId + '[KEY]', // key + '[VALUE]' // value (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/create-key.md b/docs/examples/projects/create-key.md index bebc135..955f9ba 100644 --- a/docs/examples/projects/create-key.md +++ b/docs/examples/projects/create-key.md @@ -1,18 +1,16 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.createKey('[PROJECT_ID]', '[NAME]', []); +const result = await projects.createKey( + '[PROJECT_ID]', // projectId + '[NAME]', // name + [], // scopes + '' // expire (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/create-platform.md b/docs/examples/projects/create-platform.md index 9a9b13a..f552f2f 100644 --- a/docs/examples/projects/create-platform.md +++ b/docs/examples/projects/create-platform.md @@ -1,18 +1,18 @@ -import { Client, PlatformType, Projects } from "@appwrite.io/console"; +import { Client, Projects, PlatformType } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.createPlatform('[PROJECT_ID]', PlatformType.Web, '[NAME]'); +const result = await projects.createPlatform( + '[PROJECT_ID]', // projectId + PlatformType.Web, // type + '[NAME]', // name + '[KEY]', // key (optional) + '[STORE]', // store (optional) + '' // hostname (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/create-smtp-test.md b/docs/examples/projects/create-smtp-test.md index 86e1100..d1df8b5 100644 --- a/docs/examples/projects/create-smtp-test.md +++ b/docs/examples/projects/create-smtp-test.md @@ -1,18 +1,22 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects, SMTPSecure } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.createSmtpTest('[PROJECT_ID]', [], '[SENDER_NAME]', 'email@example.com', ''); +const result = await projects.createSmtpTest( + '[PROJECT_ID]', // projectId + [], // emails + '[SENDER_NAME]', // senderName + 'email@example.com', // senderEmail + '', // host + 'email@example.com', // replyTo (optional) + null, // port (optional) + '[USERNAME]', // username (optional) + '[PASSWORD]', // password (optional) + SMTPSecure.Tls // secure (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/create-webhook.md b/docs/examples/projects/create-webhook.md index 08109f9..0595300 100644 --- a/docs/examples/projects/create-webhook.md +++ b/docs/examples/projects/create-webhook.md @@ -1,18 +1,20 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.createWebhook('[PROJECT_ID]', '[NAME]', [], '', false); +const result = await projects.createWebhook( + '[PROJECT_ID]', // projectId + '[NAME]', // name + [], // events + '', // url + false, // security + false, // enabled (optional) + '[HTTP_USER]', // httpUser (optional) + '[HTTP_PASS]' // httpPass (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/create.md b/docs/examples/projects/create.md index 967cf19..d9b0f88 100644 --- a/docs/examples/projects/create.md +++ b/docs/examples/projects/create.md @@ -1,18 +1,25 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects, } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.create('', '[NAME]', '[TEAM_ID]'); +const result = await projects.create( + '', // projectId + '[NAME]', // name + '[TEAM_ID]', // teamId + .Default, // region (optional) + '[DESCRIPTION]', // description (optional) + '[LOGO]', // logo (optional) + 'https://example.com', // url (optional) + '[LEGAL_NAME]', // legalName (optional) + '[LEGAL_COUNTRY]', // legalCountry (optional) + '[LEGAL_STATE]', // legalState (optional) + '[LEGAL_CITY]', // legalCity (optional) + '[LEGAL_ADDRESS]', // legalAddress (optional) + '[LEGAL_TAX_ID]' // legalTaxId (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/delete-email-template.md b/docs/examples/projects/delete-email-template.md index 260cf41..2a3cae3 100644 --- a/docs/examples/projects/delete-email-template.md +++ b/docs/examples/projects/delete-email-template.md @@ -1,18 +1,15 @@ -import { Client, EmailTemplateType,EmailTemplateLocale, Projects } from "@appwrite.io/console"; +import { Client, Projects, EmailTemplateType, EmailTemplateLocale } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.deleteEmailTemplate('[PROJECT_ID]', EmailTemplateType.Verification, EmailTemplateLocale.Af); +const result = await projects.deleteEmailTemplate( + '[PROJECT_ID]', // projectId + EmailTemplateType.Verification, // type + EmailTemplateLocale.Af // locale +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/delete-key.md b/docs/examples/projects/delete-key.md index 5840fac..797063a 100644 --- a/docs/examples/projects/delete-key.md +++ b/docs/examples/projects/delete-key.md @@ -1,18 +1,14 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.deleteKey('[PROJECT_ID]', '[KEY_ID]'); +const result = await projects.deleteKey( + '[PROJECT_ID]', // projectId + '[KEY_ID]' // keyId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/delete-platform.md b/docs/examples/projects/delete-platform.md index a9be36f..1e75a9c 100644 --- a/docs/examples/projects/delete-platform.md +++ b/docs/examples/projects/delete-platform.md @@ -1,18 +1,14 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.deletePlatform('[PROJECT_ID]', '[PLATFORM_ID]'); +const result = await projects.deletePlatform( + '[PROJECT_ID]', // projectId + '[PLATFORM_ID]' // platformId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/delete-sms-template.md b/docs/examples/projects/delete-sms-template.md index 2b20c5c..7bf1747 100644 --- a/docs/examples/projects/delete-sms-template.md +++ b/docs/examples/projects/delete-sms-template.md @@ -1,18 +1,15 @@ -import { Client, SMSTemplateType,SMSTemplateLocale, Projects } from "@appwrite.io/console"; +import { Client, Projects, SmsTemplateType, SmsTemplateLocale } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.deleteSmsTemplate('[PROJECT_ID]', SMSTemplateType.Verification, SMSTemplateLocale.Af); +const result = await projects.deleteSmsTemplate( + '[PROJECT_ID]', // projectId + SmsTemplateType.Verification, // type + SmsTemplateLocale.Af // locale +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/delete-webhook.md b/docs/examples/projects/delete-webhook.md index d065b0d..ad29516 100644 --- a/docs/examples/projects/delete-webhook.md +++ b/docs/examples/projects/delete-webhook.md @@ -1,18 +1,14 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.deleteWebhook('[PROJECT_ID]', '[WEBHOOK_ID]'); +const result = await projects.deleteWebhook( + '[PROJECT_ID]', // projectId + '[WEBHOOK_ID]' // webhookId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/delete.md b/docs/examples/projects/delete.md index eae5dc9..e888c6f 100644 --- a/docs/examples/projects/delete.md +++ b/docs/examples/projects/delete.md @@ -1,18 +1,13 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.delete('[PROJECT_ID]'); +const result = await projects.delete( + '[PROJECT_ID]' // projectId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/get-email-template.md b/docs/examples/projects/get-email-template.md index ccac406..6ddb9bc 100644 --- a/docs/examples/projects/get-email-template.md +++ b/docs/examples/projects/get-email-template.md @@ -1,18 +1,15 @@ -import { Client, EmailTemplateType,EmailTemplateLocale, Projects } from "@appwrite.io/console"; +import { Client, Projects, EmailTemplateType, EmailTemplateLocale } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.getEmailTemplate('[PROJECT_ID]', EmailTemplateType.Verification, EmailTemplateLocale.Af); +const result = await projects.getEmailTemplate( + '[PROJECT_ID]', // projectId + EmailTemplateType.Verification, // type + EmailTemplateLocale.Af // locale +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/get-key.md b/docs/examples/projects/get-key.md index d679468..84faed6 100644 --- a/docs/examples/projects/get-key.md +++ b/docs/examples/projects/get-key.md @@ -1,18 +1,14 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.getKey('[PROJECT_ID]', '[KEY_ID]'); +const result = await projects.getKey( + '[PROJECT_ID]', // projectId + '[KEY_ID]' // keyId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/get-platform.md b/docs/examples/projects/get-platform.md index ba72493..2fadafc 100644 --- a/docs/examples/projects/get-platform.md +++ b/docs/examples/projects/get-platform.md @@ -1,18 +1,14 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.getPlatform('[PROJECT_ID]', '[PLATFORM_ID]'); +const result = await projects.getPlatform( + '[PROJECT_ID]', // projectId + '[PLATFORM_ID]' // platformId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/get-sms-template.md b/docs/examples/projects/get-sms-template.md index 308bfed..d0031a5 100644 --- a/docs/examples/projects/get-sms-template.md +++ b/docs/examples/projects/get-sms-template.md @@ -1,18 +1,15 @@ -import { Client, SMSTemplateType,SMSTemplateLocale, Projects } from "@appwrite.io/console"; +import { Client, Projects, SmsTemplateType, SmsTemplateLocale } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.getSmsTemplate('[PROJECT_ID]', SMSTemplateType.Verification, SMSTemplateLocale.Af); +const result = await projects.getSmsTemplate( + '[PROJECT_ID]', // projectId + SmsTemplateType.Verification, // type + SmsTemplateLocale.Af // locale +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/get-webhook.md b/docs/examples/projects/get-webhook.md index d037680..14be8be 100644 --- a/docs/examples/projects/get-webhook.md +++ b/docs/examples/projects/get-webhook.md @@ -1,18 +1,14 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.getWebhook('[PROJECT_ID]', '[WEBHOOK_ID]'); +const result = await projects.getWebhook( + '[PROJECT_ID]', // projectId + '[WEBHOOK_ID]' // webhookId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/get.md b/docs/examples/projects/get.md index 193842e..66d0cb5 100644 --- a/docs/examples/projects/get.md +++ b/docs/examples/projects/get.md @@ -1,18 +1,13 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.get('[PROJECT_ID]'); +const result = await projects.get( + '[PROJECT_ID]' // projectId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/list-keys.md b/docs/examples/projects/list-keys.md index 82c5f75..1ee961e 100644 --- a/docs/examples/projects/list-keys.md +++ b/docs/examples/projects/list-keys.md @@ -1,18 +1,13 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.listKeys('[PROJECT_ID]'); +const result = await projects.listKeys( + '[PROJECT_ID]' // projectId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/list-platforms.md b/docs/examples/projects/list-platforms.md index 9032441..8984498 100644 --- a/docs/examples/projects/list-platforms.md +++ b/docs/examples/projects/list-platforms.md @@ -1,18 +1,13 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.listPlatforms('[PROJECT_ID]'); +const result = await projects.listPlatforms( + '[PROJECT_ID]' // projectId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/list-webhooks.md b/docs/examples/projects/list-webhooks.md index 36838cd..1229540 100644 --- a/docs/examples/projects/list-webhooks.md +++ b/docs/examples/projects/list-webhooks.md @@ -1,18 +1,13 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.listWebhooks('[PROJECT_ID]'); +const result = await projects.listWebhooks( + '[PROJECT_ID]' // projectId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/list.md b/docs/examples/projects/list.md index d751d33..e5a8ba5 100644 --- a/docs/examples/projects/list.md +++ b/docs/examples/projects/list.md @@ -1,18 +1,14 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.list(); +const result = await projects.list( + [], // queries (optional) + '[SEARCH]' // search (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/update-auth-duration.md b/docs/examples/projects/update-auth-duration.md index 2fc20a5..9b9cfc8 100644 --- a/docs/examples/projects/update-auth-duration.md +++ b/docs/examples/projects/update-auth-duration.md @@ -1,18 +1,14 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.updateAuthDuration('[PROJECT_ID]', 0); +const result = await projects.updateAuthDuration( + '[PROJECT_ID]', // projectId + 0 // duration +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/update-auth-limit.md b/docs/examples/projects/update-auth-limit.md index 55f9b03..b2c5dc3 100644 --- a/docs/examples/projects/update-auth-limit.md +++ b/docs/examples/projects/update-auth-limit.md @@ -1,18 +1,14 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.updateAuthLimit('[PROJECT_ID]', 0); +const result = await projects.updateAuthLimit( + '[PROJECT_ID]', // projectId + 0 // limit +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/update-auth-password-dictionary.md b/docs/examples/projects/update-auth-password-dictionary.md index 70321a9..8632a2a 100644 --- a/docs/examples/projects/update-auth-password-dictionary.md +++ b/docs/examples/projects/update-auth-password-dictionary.md @@ -1,18 +1,14 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.updateAuthPasswordDictionary('[PROJECT_ID]', false); +const result = await projects.updateAuthPasswordDictionary( + '[PROJECT_ID]', // projectId + false // enabled +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/update-auth-password-history.md b/docs/examples/projects/update-auth-password-history.md index 928b49d..e915215 100644 --- a/docs/examples/projects/update-auth-password-history.md +++ b/docs/examples/projects/update-auth-password-history.md @@ -1,18 +1,14 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.updateAuthPasswordHistory('[PROJECT_ID]', 0); +const result = await projects.updateAuthPasswordHistory( + '[PROJECT_ID]', // projectId + 0 // limit +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/update-auth-sessions-limit.md b/docs/examples/projects/update-auth-sessions-limit.md index 51eb0ad..ea810ab 100644 --- a/docs/examples/projects/update-auth-sessions-limit.md +++ b/docs/examples/projects/update-auth-sessions-limit.md @@ -1,18 +1,14 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.updateAuthSessionsLimit('[PROJECT_ID]', 1); +const result = await projects.updateAuthSessionsLimit( + '[PROJECT_ID]', // projectId + 1 // limit +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/update-auth-status.md b/docs/examples/projects/update-auth-status.md index 30f37b8..69f0cf9 100644 --- a/docs/examples/projects/update-auth-status.md +++ b/docs/examples/projects/update-auth-status.md @@ -1,18 +1,15 @@ -import { Client, AuthMethod, Projects } from "@appwrite.io/console"; +import { Client, Projects, AuthMethod } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.updateAuthStatus('[PROJECT_ID]', AuthMethod.EmailPassword, false); +const result = await projects.updateAuthStatus( + '[PROJECT_ID]', // projectId + AuthMethod.EmailPassword, // method + false // status +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/update-email-template.md b/docs/examples/projects/update-email-template.md index 2d8d10c..92cc1f7 100644 --- a/docs/examples/projects/update-email-template.md +++ b/docs/examples/projects/update-email-template.md @@ -1,18 +1,20 @@ -import { Client, EmailTemplateType,EmailTemplateLocale, Projects } from "@appwrite.io/console"; +import { Client, Projects, EmailTemplateType, EmailTemplateLocale } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.updateEmailTemplate('[PROJECT_ID]', EmailTemplateType.Verification, EmailTemplateLocale.Af, '[SUBJECT]', '[MESSAGE]'); +const result = await projects.updateEmailTemplate( + '[PROJECT_ID]', // projectId + EmailTemplateType.Verification, // type + EmailTemplateLocale.Af, // locale + '[SUBJECT]', // subject + '[MESSAGE]', // message + '[SENDER_NAME]', // senderName (optional) + 'email@example.com', // senderEmail (optional) + 'email@example.com' // replyTo (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/update-key.md b/docs/examples/projects/update-key.md index b12645e..f70887c 100644 --- a/docs/examples/projects/update-key.md +++ b/docs/examples/projects/update-key.md @@ -1,18 +1,17 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.updateKey('[PROJECT_ID]', '[KEY_ID]', '[NAME]', []); +const result = await projects.updateKey( + '[PROJECT_ID]', // projectId + '[KEY_ID]', // keyId + '[NAME]', // name + [], // scopes + '' // expire (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/update-o-auth2.md b/docs/examples/projects/update-o-auth2.md index e565ae1..6f6364f 100644 --- a/docs/examples/projects/update-o-auth2.md +++ b/docs/examples/projects/update-o-auth2.md @@ -1,18 +1,17 @@ -import { Client, OAuthProvider, Projects } from "@appwrite.io/console"; +import { Client, Projects, OAuthProvider } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.updateOAuth2('[PROJECT_ID]', OAuthProvider.Amazon); +const result = await projects.updateOAuth2( + '[PROJECT_ID]', // projectId + OAuthProvider.Amazon, // provider + '[APP_ID]', // appId (optional) + '[SECRET]', // secret (optional) + false // enabled (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/update-personal-data-check.md b/docs/examples/projects/update-personal-data-check.md index 59863be..d9a9cc1 100644 --- a/docs/examples/projects/update-personal-data-check.md +++ b/docs/examples/projects/update-personal-data-check.md @@ -1,18 +1,14 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.updatePersonalDataCheck('[PROJECT_ID]', false); +const result = await projects.updatePersonalDataCheck( + '[PROJECT_ID]', // projectId + false // enabled +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/update-platform.md b/docs/examples/projects/update-platform.md index 4704486..8908b0f 100644 --- a/docs/examples/projects/update-platform.md +++ b/docs/examples/projects/update-platform.md @@ -1,18 +1,18 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.updatePlatform('[PROJECT_ID]', '[PLATFORM_ID]', '[NAME]'); +const result = await projects.updatePlatform( + '[PROJECT_ID]', // projectId + '[PLATFORM_ID]', // platformId + '[NAME]', // name + '[KEY]', // key (optional) + '[STORE]', // store (optional) + '' // hostname (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/update-service-status-all.md b/docs/examples/projects/update-service-status-all.md index 535ef97..0cc5f35 100644 --- a/docs/examples/projects/update-service-status-all.md +++ b/docs/examples/projects/update-service-status-all.md @@ -1,18 +1,14 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.updateServiceStatusAll('[PROJECT_ID]', false); +const result = await projects.updateServiceStatusAll( + '[PROJECT_ID]', // projectId + false // status +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/update-service-status.md b/docs/examples/projects/update-service-status.md index a7803ea..d576142 100644 --- a/docs/examples/projects/update-service-status.md +++ b/docs/examples/projects/update-service-status.md @@ -1,18 +1,15 @@ -import { Client, APIService, Projects } from "@appwrite.io/console"; +import { Client, Projects, ApiService } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.updateServiceStatus('[PROJECT_ID]', APIService.Account, false); +const result = await projects.updateServiceStatus( + '[PROJECT_ID]', // projectId + ApiService.Account, // service + false // status +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/update-sms-template.md b/docs/examples/projects/update-sms-template.md index fbc2073..6a01fa6 100644 --- a/docs/examples/projects/update-sms-template.md +++ b/docs/examples/projects/update-sms-template.md @@ -1,18 +1,16 @@ -import { Client, SMSTemplateType,SMSTemplateLocale, Projects } from "@appwrite.io/console"; +import { Client, Projects, SmsTemplateType, SmsTemplateLocale } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.updateSmsTemplate('[PROJECT_ID]', SMSTemplateType.Verification, SMSTemplateLocale.Af, '[MESSAGE]'); +const result = await projects.updateSmsTemplate( + '[PROJECT_ID]', // projectId + SmsTemplateType.Verification, // type + SmsTemplateLocale.Af, // locale + '[MESSAGE]' // message +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/update-smtp.md b/docs/examples/projects/update-smtp.md index 0820a93..b39f363 100644 --- a/docs/examples/projects/update-smtp.md +++ b/docs/examples/projects/update-smtp.md @@ -1,18 +1,22 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects, SMTPSecure } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.updateSmtp('[PROJECT_ID]', false); +const result = await projects.updateSmtp( + '[PROJECT_ID]', // projectId + false, // enabled + '[SENDER_NAME]', // senderName (optional) + 'email@example.com', // senderEmail (optional) + 'email@example.com', // replyTo (optional) + '', // host (optional) + null, // port (optional) + '[USERNAME]', // username (optional) + '[PASSWORD]', // password (optional) + SMTPSecure.Tls // secure (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/update-team.md b/docs/examples/projects/update-team.md index 6dccac9..a8aa0bc 100644 --- a/docs/examples/projects/update-team.md +++ b/docs/examples/projects/update-team.md @@ -1,18 +1,14 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.updateTeam('[PROJECT_ID]', '[TEAM_ID]'); +const result = await projects.updateTeam( + '[PROJECT_ID]', // projectId + '[TEAM_ID]' // teamId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/update-webhook-signature.md b/docs/examples/projects/update-webhook-signature.md index 3e8ba88..a0cce99 100644 --- a/docs/examples/projects/update-webhook-signature.md +++ b/docs/examples/projects/update-webhook-signature.md @@ -1,18 +1,14 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.updateWebhookSignature('[PROJECT_ID]', '[WEBHOOK_ID]'); +const result = await projects.updateWebhookSignature( + '[PROJECT_ID]', // projectId + '[WEBHOOK_ID]' // webhookId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/update-webhook.md b/docs/examples/projects/update-webhook.md index 6600b63..81bf514 100644 --- a/docs/examples/projects/update-webhook.md +++ b/docs/examples/projects/update-webhook.md @@ -1,18 +1,21 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.updateWebhook('[PROJECT_ID]', '[WEBHOOK_ID]', '[NAME]', [], '', false); +const result = await projects.updateWebhook( + '[PROJECT_ID]', // projectId + '[WEBHOOK_ID]', // webhookId + '[NAME]', // name + [], // events + '', // url + false, // security + false, // enabled (optional) + '[HTTP_USER]', // httpUser (optional) + '[HTTP_PASS]' // httpPass (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/projects/update.md b/docs/examples/projects/update.md index 03b7678..8520b7b 100644 --- a/docs/examples/projects/update.md +++ b/docs/examples/projects/update.md @@ -1,18 +1,23 @@ -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Projects } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const projects = new Projects(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = projects.update('[PROJECT_ID]', '[NAME]'); +const result = await projects.update( + '[PROJECT_ID]', // projectId + '[NAME]', // name + '[DESCRIPTION]', // description (optional) + '[LOGO]', // logo (optional) + 'https://example.com', // url (optional) + '[LEGAL_NAME]', // legalName (optional) + '[LEGAL_COUNTRY]', // legalCountry (optional) + '[LEGAL_STATE]', // legalState (optional) + '[LEGAL_CITY]', // legalCity (optional) + '[LEGAL_ADDRESS]', // legalAddress (optional) + '[LEGAL_TAX_ID]' // legalTaxId (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/proxy/create-rule.md b/docs/examples/proxy/create-rule.md index 85f728a..6933c12 100644 --- a/docs/examples/proxy/create-rule.md +++ b/docs/examples/proxy/create-rule.md @@ -1,18 +1,15 @@ -import { Client, , Proxy } from "@appwrite.io/console"; +import { Client, Proxy, } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const proxy = new Proxy(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = proxy.createRule('', .Api); +const result = await proxy.createRule( + '', // domain + .Api, // resourceType + '[RESOURCE_ID]' // resourceId (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/proxy/delete-rule.md b/docs/examples/proxy/delete-rule.md index f095bdf..e9d50a4 100644 --- a/docs/examples/proxy/delete-rule.md +++ b/docs/examples/proxy/delete-rule.md @@ -1,18 +1,13 @@ -import { Client, Proxy } from "@appwrite.io/console"; +import { Client, Proxy } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const proxy = new Proxy(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = proxy.deleteRule('[RULE_ID]'); +const result = await proxy.deleteRule( + '[RULE_ID]' // ruleId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/proxy/get-rule.md b/docs/examples/proxy/get-rule.md index 0c68f44..96b3da3 100644 --- a/docs/examples/proxy/get-rule.md +++ b/docs/examples/proxy/get-rule.md @@ -1,18 +1,13 @@ -import { Client, Proxy } from "@appwrite.io/console"; +import { Client, Proxy } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const proxy = new Proxy(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = proxy.getRule('[RULE_ID]'); +const result = await proxy.getRule( + '[RULE_ID]' // ruleId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/proxy/list-rules.md b/docs/examples/proxy/list-rules.md index fccf58f..d74ea26 100644 --- a/docs/examples/proxy/list-rules.md +++ b/docs/examples/proxy/list-rules.md @@ -1,18 +1,14 @@ -import { Client, Proxy } from "@appwrite.io/console"; +import { Client, Proxy } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const proxy = new Proxy(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = proxy.listRules(); +const result = await proxy.listRules( + [], // queries (optional) + '[SEARCH]' // search (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/proxy/update-rule-verification.md b/docs/examples/proxy/update-rule-verification.md index e45b861..966c641 100644 --- a/docs/examples/proxy/update-rule-verification.md +++ b/docs/examples/proxy/update-rule-verification.md @@ -1,18 +1,13 @@ -import { Client, Proxy } from "@appwrite.io/console"; +import { Client, Proxy } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const proxy = new Proxy(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = proxy.updateRuleVerification('[RULE_ID]'); +const result = await proxy.updateRuleVerification( + '[RULE_ID]' // ruleId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md index 3d194f4..d9d05fa 100644 --- a/docs/examples/storage/create-bucket.md +++ b/docs/examples/storage/create-bucket.md @@ -1,18 +1,22 @@ -import { Client, Storage } from "@appwrite.io/console"; +import { Client, Storage, } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const storage = new Storage(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = storage.createBucket('[BUCKET_ID]', '[NAME]'); +const result = await storage.createBucket( + '[BUCKET_ID]', // bucketId + '[NAME]', // name + ["read("any")"], // permissions (optional) + false, // fileSecurity (optional) + false, // enabled (optional) + 1, // maximumFileSize (optional) + [], // allowedFileExtensions (optional) + .None, // compression (optional) + false, // encryption (optional) + false // antivirus (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index b1128b6..00bae8b 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -1,18 +1,16 @@ -import { Client, Storage } from "@appwrite.io/console"; +import { Client, Storage } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const storage = new Storage(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = storage.createFile('[BUCKET_ID]', '[FILE_ID]', document.getElementById('uploader').files[0]); +const result = await storage.createFile( + '[BUCKET_ID]', // bucketId + '[FILE_ID]', // fileId + document.getElementById('uploader').files[0], // file + ["read("any")"] // permissions (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md index 56e7e5e..598d627 100644 --- a/docs/examples/storage/delete-bucket.md +++ b/docs/examples/storage/delete-bucket.md @@ -1,18 +1,13 @@ -import { Client, Storage } from "@appwrite.io/console"; +import { Client, Storage } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const storage = new Storage(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = storage.deleteBucket('[BUCKET_ID]'); +const result = await storage.deleteBucket( + '[BUCKET_ID]' // bucketId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md index 30c93fb..b61d84d 100644 --- a/docs/examples/storage/delete-file.md +++ b/docs/examples/storage/delete-file.md @@ -1,18 +1,14 @@ -import { Client, Storage } from "@appwrite.io/console"; +import { Client, Storage } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const storage = new Storage(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = storage.deleteFile('[BUCKET_ID]', '[FILE_ID]'); +const result = await storage.deleteFile( + '[BUCKET_ID]', // bucketId + '[FILE_ID]' // fileId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/storage/get-bucket-usage.md b/docs/examples/storage/get-bucket-usage.md index c932aaf..c696205 100644 --- a/docs/examples/storage/get-bucket-usage.md +++ b/docs/examples/storage/get-bucket-usage.md @@ -1,18 +1,14 @@ -import { Client, Storage } from "@appwrite.io/console"; +import { Client, Storage, StorageUsageRange } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const storage = new Storage(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = storage.getBucketUsage('[BUCKET_ID]'); +const result = await storage.getBucketUsage( + '[BUCKET_ID]', // bucketId + StorageUsageRange.TwentyFourHours // range (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md index 6a508ce..ab79993 100644 --- a/docs/examples/storage/get-bucket.md +++ b/docs/examples/storage/get-bucket.md @@ -1,18 +1,13 @@ -import { Client, Storage } from "@appwrite.io/console"; +import { Client, Storage } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const storage = new Storage(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = storage.getBucket('[BUCKET_ID]'); +const result = await storage.getBucket( + '[BUCKET_ID]' // bucketId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index 578d6a8..5b34830 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -1,14 +1,14 @@ -import { Client, Storage } from "@appwrite.io/console"; +import { Client, Storage } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const storage = new Storage(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const result = storage.getFileDownload('[BUCKET_ID]', '[FILE_ID]'); +const result = storage.getFileDownload( + '[BUCKET_ID]', // bucketId + '[FILE_ID]' // fileId +); -console.log(result); // Resource URL \ No newline at end of file +console.log(result); diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index ca194fb..f1ea3d4 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -1,14 +1,25 @@ -import { Client, Storage } from "@appwrite.io/console"; +import { Client, Storage, ImageGravity, ImageFormat } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const storage = new Storage(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const result = storage.getFilePreview('[BUCKET_ID]', '[FILE_ID]'); +const result = storage.getFilePreview( + '[BUCKET_ID]', // bucketId + '[FILE_ID]', // fileId + 0, // width (optional) + 0, // height (optional) + ImageGravity.Center, // gravity (optional) + 0, // quality (optional) + 0, // borderWidth (optional) + '', // borderColor (optional) + 0, // borderRadius (optional) + 0, // opacity (optional) + -360, // rotation (optional) + '', // background (optional) + ImageFormat.Jpg // output (optional) +); -console.log(result); // Resource URL \ No newline at end of file +console.log(result); diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index 4717422..dc6c5f4 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -1,14 +1,14 @@ -import { Client, Storage } from "@appwrite.io/console"; +import { Client, Storage } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const storage = new Storage(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const result = storage.getFileView('[BUCKET_ID]', '[FILE_ID]'); +const result = storage.getFileView( + '[BUCKET_ID]', // bucketId + '[FILE_ID]' // fileId +); -console.log(result); // Resource URL \ No newline at end of file +console.log(result); diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md index dadae8d..bdeb8a8 100644 --- a/docs/examples/storage/get-file.md +++ b/docs/examples/storage/get-file.md @@ -1,18 +1,14 @@ -import { Client, Storage } from "@appwrite.io/console"; +import { Client, Storage } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const storage = new Storage(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = storage.getFile('[BUCKET_ID]', '[FILE_ID]'); +const result = await storage.getFile( + '[BUCKET_ID]', // bucketId + '[FILE_ID]' // fileId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/storage/get-usage.md b/docs/examples/storage/get-usage.md index d7b43fa..e1c0abf 100644 --- a/docs/examples/storage/get-usage.md +++ b/docs/examples/storage/get-usage.md @@ -1,18 +1,13 @@ -import { Client, Storage } from "@appwrite.io/console"; +import { Client, Storage, StorageUsageRange } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const storage = new Storage(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = storage.getUsage(); +const result = await storage.getUsage( + StorageUsageRange.TwentyFourHours // range (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md index b1223d4..d2858be 100644 --- a/docs/examples/storage/list-buckets.md +++ b/docs/examples/storage/list-buckets.md @@ -1,18 +1,14 @@ -import { Client, Storage } from "@appwrite.io/console"; +import { Client, Storage } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const storage = new Storage(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = storage.listBuckets(); +const result = await storage.listBuckets( + [], // queries (optional) + '[SEARCH]' // search (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index 3129342..951aaed 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -1,18 +1,15 @@ -import { Client, Storage } from "@appwrite.io/console"; +import { Client, Storage } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const storage = new Storage(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = storage.listFiles('[BUCKET_ID]'); +const result = await storage.listFiles( + '[BUCKET_ID]', // bucketId + [], // queries (optional) + '[SEARCH]' // search (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md index baa3a75..940fb06 100644 --- a/docs/examples/storage/update-bucket.md +++ b/docs/examples/storage/update-bucket.md @@ -1,18 +1,22 @@ -import { Client, Storage } from "@appwrite.io/console"; +import { Client, Storage, } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const storage = new Storage(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = storage.updateBucket('[BUCKET_ID]', '[NAME]'); +const result = await storage.updateBucket( + '[BUCKET_ID]', // bucketId + '[NAME]', // name + ["read("any")"], // permissions (optional) + false, // fileSecurity (optional) + false, // enabled (optional) + 1, // maximumFileSize (optional) + [], // allowedFileExtensions (optional) + .None, // compression (optional) + false, // encryption (optional) + false // antivirus (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index a7380c5..47c9d6e 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -1,18 +1,16 @@ -import { Client, Storage } from "@appwrite.io/console"; +import { Client, Storage } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const storage = new Storage(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = storage.updateFile('[BUCKET_ID]', '[FILE_ID]'); +const result = await storage.updateFile( + '[BUCKET_ID]', // bucketId + '[FILE_ID]', // fileId + '[NAME]', // name (optional) + ["read("any")"] // permissions (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index 51c0d6f..23a8456 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -1,18 +1,19 @@ -import { Client, Teams } from "@appwrite.io/console"; +import { Client, Teams } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const teams = new Teams(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = teams.createMembership('[TEAM_ID]', []); +const result = await teams.createMembership( + '[TEAM_ID]', // teamId + [], // roles + 'email@example.com', // email (optional) + '[USER_ID]', // userId (optional) + '+12065550100', // phone (optional) + 'https://example.com', // url (optional) + '[NAME]' // name (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md index 5a30fcc..a0d5bfa 100644 --- a/docs/examples/teams/create.md +++ b/docs/examples/teams/create.md @@ -1,18 +1,15 @@ -import { Client, Teams } from "@appwrite.io/console"; +import { Client, Teams } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const teams = new Teams(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = teams.create('[TEAM_ID]', '[NAME]'); +const result = await teams.create( + '[TEAM_ID]', // teamId + '[NAME]', // name + [] // roles (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md index b849cac..1ecbc2d 100644 --- a/docs/examples/teams/delete-membership.md +++ b/docs/examples/teams/delete-membership.md @@ -1,18 +1,14 @@ -import { Client, Teams } from "@appwrite.io/console"; +import { Client, Teams } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const teams = new Teams(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = teams.deleteMembership('[TEAM_ID]', '[MEMBERSHIP_ID]'); +const result = await teams.deleteMembership( + '[TEAM_ID]', // teamId + '[MEMBERSHIP_ID]' // membershipId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md index d533239..40e81ab 100644 --- a/docs/examples/teams/delete.md +++ b/docs/examples/teams/delete.md @@ -1,18 +1,13 @@ -import { Client, Teams } from "@appwrite.io/console"; +import { Client, Teams } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const teams = new Teams(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = teams.delete('[TEAM_ID]'); +const result = await teams.delete( + '[TEAM_ID]' // teamId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md index 302e53a..ab5ef4d 100644 --- a/docs/examples/teams/get-membership.md +++ b/docs/examples/teams/get-membership.md @@ -1,18 +1,14 @@ -import { Client, Teams } from "@appwrite.io/console"; +import { Client, Teams } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const teams = new Teams(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = teams.getMembership('[TEAM_ID]', '[MEMBERSHIP_ID]'); +const result = await teams.getMembership( + '[TEAM_ID]', // teamId + '[MEMBERSHIP_ID]' // membershipId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md index d583d6b..787ea8a 100644 --- a/docs/examples/teams/get-prefs.md +++ b/docs/examples/teams/get-prefs.md @@ -1,18 +1,13 @@ -import { Client, Teams } from "@appwrite.io/console"; +import { Client, Teams } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const teams = new Teams(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = teams.getPrefs('[TEAM_ID]'); +const result = await teams.getPrefs( + '[TEAM_ID]' // teamId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md index cd0840f..928d7ff 100644 --- a/docs/examples/teams/get.md +++ b/docs/examples/teams/get.md @@ -1,18 +1,13 @@ -import { Client, Teams } from "@appwrite.io/console"; +import { Client, Teams } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const teams = new Teams(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = teams.get('[TEAM_ID]'); +const result = await teams.get( + '[TEAM_ID]' // teamId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/teams/list-logs.md b/docs/examples/teams/list-logs.md index 4b7046d..d51c9d0 100644 --- a/docs/examples/teams/list-logs.md +++ b/docs/examples/teams/list-logs.md @@ -1,18 +1,14 @@ -import { Client, Teams } from "@appwrite.io/console"; +import { Client, Teams } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const teams = new Teams(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = teams.listLogs('[TEAM_ID]'); +const result = await teams.listLogs( + '[TEAM_ID]', // teamId + [] // queries (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index 588e98b..5414859 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -1,18 +1,15 @@ -import { Client, Teams } from "@appwrite.io/console"; +import { Client, Teams } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const teams = new Teams(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = teams.listMemberships('[TEAM_ID]'); +const result = await teams.listMemberships( + '[TEAM_ID]', // teamId + [], // queries (optional) + '[SEARCH]' // search (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index 992068a..b0c37ce 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -1,18 +1,14 @@ -import { Client, Teams } from "@appwrite.io/console"; +import { Client, Teams } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const teams = new Teams(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = teams.list(); +const result = await teams.list( + [], // queries (optional) + '[SEARCH]' // search (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md index 14b09c7..c6d2326 100644 --- a/docs/examples/teams/update-membership-status.md +++ b/docs/examples/teams/update-membership-status.md @@ -1,18 +1,16 @@ -import { Client, Teams } from "@appwrite.io/console"; +import { Client, Teams } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const teams = new Teams(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = teams.updateMembershipStatus('[TEAM_ID]', '[MEMBERSHIP_ID]', '[USER_ID]', '[SECRET]'); +const result = await teams.updateMembershipStatus( + '[TEAM_ID]', // teamId + '[MEMBERSHIP_ID]', // membershipId + '[USER_ID]', // userId + '[SECRET]' // secret +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md index 9ee92cf..4052789 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -1,18 +1,15 @@ -import { Client, Teams } from "@appwrite.io/console"; +import { Client, Teams } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const teams = new Teams(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = teams.updateMembership('[TEAM_ID]', '[MEMBERSHIP_ID]', []); +const result = await teams.updateMembership( + '[TEAM_ID]', // teamId + '[MEMBERSHIP_ID]', // membershipId + [] // roles +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md index 7c7418d..500d727 100644 --- a/docs/examples/teams/update-name.md +++ b/docs/examples/teams/update-name.md @@ -1,18 +1,14 @@ -import { Client, Teams } from "@appwrite.io/console"; +import { Client, Teams } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const teams = new Teams(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = teams.updateName('[TEAM_ID]', '[NAME]'); +const result = await teams.updateName( + '[TEAM_ID]', // teamId + '[NAME]' // name +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md index 2bf305b..a185eca 100644 --- a/docs/examples/teams/update-prefs.md +++ b/docs/examples/teams/update-prefs.md @@ -1,18 +1,14 @@ -import { Client, Teams } from "@appwrite.io/console"; +import { Client, Teams } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const teams = new Teams(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = teams.updatePrefs('[TEAM_ID]', {}); +const result = await teams.updatePrefs( + '[TEAM_ID]', // teamId + {} // prefs +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/create-argon2user.md b/docs/examples/users/create-argon2user.md index cc9f670..8d3644a 100644 --- a/docs/examples/users/create-argon2user.md +++ b/docs/examples/users/create-argon2user.md @@ -1,18 +1,16 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.createArgon2User('[USER_ID]', 'email@example.com', 'password'); +const result = await users.createArgon2User( + '[USER_ID]', // userId + 'email@example.com', // email + 'password', // password + '[NAME]' // name (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md index b712e00..0828efb 100644 --- a/docs/examples/users/create-bcrypt-user.md +++ b/docs/examples/users/create-bcrypt-user.md @@ -1,18 +1,16 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.createBcryptUser('[USER_ID]', 'email@example.com', 'password'); +const result = await users.createBcryptUser( + '[USER_ID]', // userId + 'email@example.com', // email + 'password', // password + '[NAME]' // name (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/create-m-d5user.md b/docs/examples/users/create-m-d5user.md index 886efdc..3139ccc 100644 --- a/docs/examples/users/create-m-d5user.md +++ b/docs/examples/users/create-m-d5user.md @@ -1,18 +1,16 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.createMD5User('[USER_ID]', 'email@example.com', 'password'); +const result = await users.createMD5User( + '[USER_ID]', // userId + 'email@example.com', // email + 'password', // password + '[NAME]' // name (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/create-p-h-pass-user.md b/docs/examples/users/create-p-h-pass-user.md index a3c051d..3416bd6 100644 --- a/docs/examples/users/create-p-h-pass-user.md +++ b/docs/examples/users/create-p-h-pass-user.md @@ -1,18 +1,16 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.createPHPassUser('[USER_ID]', 'email@example.com', 'password'); +const result = await users.createPHPassUser( + '[USER_ID]', // userId + 'email@example.com', // email + 'password', // password + '[NAME]' // name (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/create-s-h-a-user.md b/docs/examples/users/create-s-h-a-user.md index 9343cc6..8440c14 100644 --- a/docs/examples/users/create-s-h-a-user.md +++ b/docs/examples/users/create-s-h-a-user.md @@ -1,18 +1,17 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users, PasswordHash } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.createSHAUser('[USER_ID]', 'email@example.com', 'password'); +const result = await users.createSHAUser( + '[USER_ID]', // userId + 'email@example.com', // email + 'password', // password + PasswordHash.Sha1, // passwordVersion (optional) + '[NAME]' // name (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/create-scrypt-modified-user.md b/docs/examples/users/create-scrypt-modified-user.md index da08c92..3aa538d 100644 --- a/docs/examples/users/create-scrypt-modified-user.md +++ b/docs/examples/users/create-scrypt-modified-user.md @@ -1,18 +1,19 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.createScryptModifiedUser('[USER_ID]', 'email@example.com', 'password', '[PASSWORD_SALT]', '[PASSWORD_SALT_SEPARATOR]', '[PASSWORD_SIGNER_KEY]'); +const result = await users.createScryptModifiedUser( + '[USER_ID]', // userId + 'email@example.com', // email + 'password', // password + '[PASSWORD_SALT]', // passwordSalt + '[PASSWORD_SALT_SEPARATOR]', // passwordSaltSeparator + '[PASSWORD_SIGNER_KEY]', // passwordSignerKey + '[NAME]' // name (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md index 4147435..825564e 100644 --- a/docs/examples/users/create-scrypt-user.md +++ b/docs/examples/users/create-scrypt-user.md @@ -1,18 +1,21 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.createScryptUser('[USER_ID]', 'email@example.com', 'password', '[PASSWORD_SALT]', null, null, null, null); +const result = await users.createScryptUser( + '[USER_ID]', // userId + 'email@example.com', // email + 'password', // password + '[PASSWORD_SALT]', // passwordSalt + null, // passwordCpu + null, // passwordMemory + null, // passwordParallel + null, // passwordLength + '[NAME]' // name (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/create-session.md b/docs/examples/users/create-session.md index 9ed6239..be620bd 100644 --- a/docs/examples/users/create-session.md +++ b/docs/examples/users/create-session.md @@ -1,18 +1,13 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.createSession('[USER_ID]'); +const result = await users.createSession( + '[USER_ID]' // userId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/create-target.md b/docs/examples/users/create-target.md index 40db142..867d702 100644 --- a/docs/examples/users/create-target.md +++ b/docs/examples/users/create-target.md @@ -1,18 +1,18 @@ -import { Client, MessagingProviderType, Users } from "@appwrite.io/console"; +import { Client, Users, MessagingProviderType } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.createTarget('[USER_ID]', '[TARGET_ID]', MessagingProviderType.Email, '[IDENTIFIER]'); +const result = await users.createTarget( + '[USER_ID]', // userId + '[TARGET_ID]', // targetId + MessagingProviderType.Email, // providerType + '[IDENTIFIER]', // identifier + '[PROVIDER_ID]', // providerId (optional) + '[NAME]' // name (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/create-token.md b/docs/examples/users/create-token.md index 9965bb9..23d7efc 100644 --- a/docs/examples/users/create-token.md +++ b/docs/examples/users/create-token.md @@ -1,18 +1,15 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.createToken('[USER_ID]'); +const result = await users.createToken( + '[USER_ID]', // userId + 4, // length (optional) + 60 // expire (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md index 6f5ced6..966c8bc 100644 --- a/docs/examples/users/create.md +++ b/docs/examples/users/create.md @@ -1,18 +1,17 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.create('[USER_ID]'); +const result = await users.create( + '[USER_ID]', // userId + 'email@example.com', // email (optional) + '+12065550100', // phone (optional) + '', // password (optional) + '[NAME]' // name (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/delete-authenticator.md b/docs/examples/users/delete-authenticator.md index 86db6cc..38a276c 100644 --- a/docs/examples/users/delete-authenticator.md +++ b/docs/examples/users/delete-authenticator.md @@ -1,18 +1,15 @@ -import { Client, AuthenticatorType, Users } from "@appwrite.io/console"; +import { Client, Users, AuthenticatorType } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.deleteAuthenticator('[USER_ID]', AuthenticatorType.Totp, '[OTP]'); +const result = await users.deleteAuthenticator( + '[USER_ID]', // userId + AuthenticatorType.Totp, // type + '[OTP]' // otp +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md index 4604c7e..babe0ad 100644 --- a/docs/examples/users/delete-identity.md +++ b/docs/examples/users/delete-identity.md @@ -1,18 +1,13 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.deleteIdentity('[IDENTITY_ID]'); +const result = await users.deleteIdentity( + '[IDENTITY_ID]' // identityId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/delete-session.md b/docs/examples/users/delete-session.md index 7923a04..c59f328 100644 --- a/docs/examples/users/delete-session.md +++ b/docs/examples/users/delete-session.md @@ -1,18 +1,14 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.deleteSession('[USER_ID]', '[SESSION_ID]'); +const result = await users.deleteSession( + '[USER_ID]', // userId + '[SESSION_ID]' // sessionId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md index 0ed04bf..050e8c5 100644 --- a/docs/examples/users/delete-sessions.md +++ b/docs/examples/users/delete-sessions.md @@ -1,18 +1,13 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.deleteSessions('[USER_ID]'); +const result = await users.deleteSessions( + '[USER_ID]' // userId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/delete-target.md b/docs/examples/users/delete-target.md index f89970f..d08a773 100644 --- a/docs/examples/users/delete-target.md +++ b/docs/examples/users/delete-target.md @@ -1,18 +1,14 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.deleteTarget('[USER_ID]', '[TARGET_ID]'); +const result = await users.deleteTarget( + '[USER_ID]', // userId + '[TARGET_ID]' // targetId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md index 3cc3bc6..2f87bd4 100644 --- a/docs/examples/users/delete.md +++ b/docs/examples/users/delete.md @@ -1,18 +1,13 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.delete('[USER_ID]'); +const result = await users.delete( + '[USER_ID]' // userId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md index 02adaac..902a69a 100644 --- a/docs/examples/users/get-prefs.md +++ b/docs/examples/users/get-prefs.md @@ -1,18 +1,13 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.getPrefs('[USER_ID]'); +const result = await users.getPrefs( + '[USER_ID]' // userId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/get-target.md b/docs/examples/users/get-target.md index 451d117..491401c 100644 --- a/docs/examples/users/get-target.md +++ b/docs/examples/users/get-target.md @@ -1,18 +1,14 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.getTarget('[USER_ID]', '[TARGET_ID]'); +const result = await users.getTarget( + '[USER_ID]', // userId + '[TARGET_ID]' // targetId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/get-usage.md b/docs/examples/users/get-usage.md index 7f72bff..ffb4667 100644 --- a/docs/examples/users/get-usage.md +++ b/docs/examples/users/get-usage.md @@ -1,18 +1,13 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users, UserUsageRange } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.getUsage(); +const result = await users.getUsage( + UserUsageRange.TwentyFourHours // range (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md index 3970a99..a591d58 100644 --- a/docs/examples/users/get.md +++ b/docs/examples/users/get.md @@ -1,18 +1,13 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.get('[USER_ID]'); +const result = await users.get( + '[USER_ID]' // userId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/list-factors.md b/docs/examples/users/list-factors.md index 60e5788..e302044 100644 --- a/docs/examples/users/list-factors.md +++ b/docs/examples/users/list-factors.md @@ -1,18 +1,13 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.listFactors('[USER_ID]'); +const result = await users.listFactors( + '[USER_ID]' // userId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md index 27b0051..d551a28 100644 --- a/docs/examples/users/list-identities.md +++ b/docs/examples/users/list-identities.md @@ -1,18 +1,14 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.listIdentities(); +const result = await users.listIdentities( + [], // queries (optional) + '[SEARCH]' // search (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md index 0e13e1f..f4610dc 100644 --- a/docs/examples/users/list-logs.md +++ b/docs/examples/users/list-logs.md @@ -1,18 +1,14 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.listLogs('[USER_ID]'); +const result = await users.listLogs( + '[USER_ID]', // userId + [] // queries (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md index 3cb27f9..c5a4d6f 100644 --- a/docs/examples/users/list-memberships.md +++ b/docs/examples/users/list-memberships.md @@ -1,18 +1,13 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.listMemberships('[USER_ID]'); +const result = await users.listMemberships( + '[USER_ID]' // userId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md index 99b8574..82f8642 100644 --- a/docs/examples/users/list-sessions.md +++ b/docs/examples/users/list-sessions.md @@ -1,18 +1,13 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.listSessions('[USER_ID]'); +const result = await users.listSessions( + '[USER_ID]' // userId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md index f5c37d8..35ec342 100644 --- a/docs/examples/users/list-targets.md +++ b/docs/examples/users/list-targets.md @@ -1,18 +1,14 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.listTargets('[USER_ID]'); +const result = await users.listTargets( + '[USER_ID]', // userId + [] // queries (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md index 9bf6454..59bb300 100644 --- a/docs/examples/users/list.md +++ b/docs/examples/users/list.md @@ -1,18 +1,14 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.list(); +const result = await users.list( + [], // queries (optional) + '[SEARCH]' // search (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md index 7443d26..f29aae2 100644 --- a/docs/examples/users/update-email-verification.md +++ b/docs/examples/users/update-email-verification.md @@ -1,18 +1,14 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.updateEmailVerification('[USER_ID]', false); +const result = await users.updateEmailVerification( + '[USER_ID]', // userId + false // emailVerification +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md index 3609996..c6d4945 100644 --- a/docs/examples/users/update-email.md +++ b/docs/examples/users/update-email.md @@ -1,18 +1,14 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.updateEmail('[USER_ID]', 'email@example.com'); +const result = await users.updateEmail( + '[USER_ID]', // userId + 'email@example.com' // email +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md index 7cbed9e..dcd091c 100644 --- a/docs/examples/users/update-labels.md +++ b/docs/examples/users/update-labels.md @@ -1,18 +1,14 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.updateLabels('[USER_ID]', []); +const result = await users.updateLabels( + '[USER_ID]', // userId + [] // labels +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md index 8b2f6b8..f2e3e7a 100644 --- a/docs/examples/users/update-mfa.md +++ b/docs/examples/users/update-mfa.md @@ -1,18 +1,14 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.updateMfa('[USER_ID]', false); +const result = await users.updateMfa( + '[USER_ID]', // userId + false // mfa +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md index 3402c06..0c5dd3b 100644 --- a/docs/examples/users/update-name.md +++ b/docs/examples/users/update-name.md @@ -1,18 +1,14 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.updateName('[USER_ID]', '[NAME]'); +const result = await users.updateName( + '[USER_ID]', // userId + '[NAME]' // name +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md index ebe5f28..dc98d36 100644 --- a/docs/examples/users/update-password.md +++ b/docs/examples/users/update-password.md @@ -1,18 +1,14 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.updatePassword('[USER_ID]', ''); +const result = await users.updatePassword( + '[USER_ID]', // userId + '' // password +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md index aaf74f7..1af45c8 100644 --- a/docs/examples/users/update-phone-verification.md +++ b/docs/examples/users/update-phone-verification.md @@ -1,18 +1,14 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.updatePhoneVerification('[USER_ID]', false); +const result = await users.updatePhoneVerification( + '[USER_ID]', // userId + false // phoneVerification +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md index 76832b3..45414e9 100644 --- a/docs/examples/users/update-phone.md +++ b/docs/examples/users/update-phone.md @@ -1,18 +1,14 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.updatePhone('[USER_ID]', '+12065550100'); +const result = await users.updatePhone( + '[USER_ID]', // userId + '+12065550100' // number +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md index c351573..f48d561 100644 --- a/docs/examples/users/update-prefs.md +++ b/docs/examples/users/update-prefs.md @@ -1,18 +1,14 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.updatePrefs('[USER_ID]', {}); +const result = await users.updatePrefs( + '[USER_ID]', // userId + {} // prefs +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md index c560549..485d6b9 100644 --- a/docs/examples/users/update-status.md +++ b/docs/examples/users/update-status.md @@ -1,18 +1,14 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.updateStatus('[USER_ID]', false); +const result = await users.updateStatus( + '[USER_ID]', // userId + false // status +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/users/update-target.md b/docs/examples/users/update-target.md index 58cd82b..e60e189 100644 --- a/docs/examples/users/update-target.md +++ b/docs/examples/users/update-target.md @@ -1,18 +1,17 @@ -import { Client, Users } from "@appwrite.io/console"; +import { Client, Users } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const users = new Users(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = users.updateTarget('[USER_ID]', '[TARGET_ID]'); +const result = await users.updateTarget( + '[USER_ID]', // userId + '[TARGET_ID]', // targetId + '[IDENTIFIER]', // identifier (optional) + '[PROVIDER_ID]', // providerId (optional) + '[NAME]' // name (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/vcs/create-repository-detection.md b/docs/examples/vcs/create-repository-detection.md index 6e0a232..a2bdcc3 100644 --- a/docs/examples/vcs/create-repository-detection.md +++ b/docs/examples/vcs/create-repository-detection.md @@ -1,18 +1,15 @@ -import { Client, Vcs } from "@appwrite.io/console"; +import { Client, Vcs } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const vcs = new Vcs(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = vcs.createRepositoryDetection('[INSTALLATION_ID]', '[PROVIDER_REPOSITORY_ID]'); +const result = await vcs.createRepositoryDetection( + '[INSTALLATION_ID]', // installationId + '[PROVIDER_REPOSITORY_ID]', // providerRepositoryId + '[PROVIDER_ROOT_DIRECTORY]' // providerRootDirectory (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/vcs/create-repository.md b/docs/examples/vcs/create-repository.md index a043d27..834183a 100644 --- a/docs/examples/vcs/create-repository.md +++ b/docs/examples/vcs/create-repository.md @@ -1,18 +1,15 @@ -import { Client, Vcs } from "@appwrite.io/console"; +import { Client, Vcs } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const vcs = new Vcs(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = vcs.createRepository('[INSTALLATION_ID]', '[NAME]', false); +const result = await vcs.createRepository( + '[INSTALLATION_ID]', // installationId + '[NAME]', // name + false // private +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/vcs/delete-installation.md b/docs/examples/vcs/delete-installation.md index f921ad6..e250838 100644 --- a/docs/examples/vcs/delete-installation.md +++ b/docs/examples/vcs/delete-installation.md @@ -1,18 +1,13 @@ -import { Client, Vcs } from "@appwrite.io/console"; +import { Client, Vcs } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const vcs = new Vcs(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = vcs.deleteInstallation('[INSTALLATION_ID]'); +const result = await vcs.deleteInstallation( + '[INSTALLATION_ID]' // installationId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/vcs/get-installation.md b/docs/examples/vcs/get-installation.md index 2aba0da..8185d89 100644 --- a/docs/examples/vcs/get-installation.md +++ b/docs/examples/vcs/get-installation.md @@ -1,18 +1,13 @@ -import { Client, Vcs } from "@appwrite.io/console"; +import { Client, Vcs } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const vcs = new Vcs(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = vcs.getInstallation('[INSTALLATION_ID]'); +const result = await vcs.getInstallation( + '[INSTALLATION_ID]' // installationId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/vcs/get-repository.md b/docs/examples/vcs/get-repository.md index 56ea33d..26a3ecd 100644 --- a/docs/examples/vcs/get-repository.md +++ b/docs/examples/vcs/get-repository.md @@ -1,18 +1,14 @@ -import { Client, Vcs } from "@appwrite.io/console"; +import { Client, Vcs } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const vcs = new Vcs(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = vcs.getRepository('[INSTALLATION_ID]', '[PROVIDER_REPOSITORY_ID]'); +const result = await vcs.getRepository( + '[INSTALLATION_ID]', // installationId + '[PROVIDER_REPOSITORY_ID]' // providerRepositoryId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/vcs/list-installations.md b/docs/examples/vcs/list-installations.md index c28b9e8..8a7506f 100644 --- a/docs/examples/vcs/list-installations.md +++ b/docs/examples/vcs/list-installations.md @@ -1,18 +1,14 @@ -import { Client, Vcs } from "@appwrite.io/console"; +import { Client, Vcs } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const vcs = new Vcs(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = vcs.listInstallations(); +const result = await vcs.listInstallations( + [], // queries (optional) + '[SEARCH]' // search (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/vcs/list-repositories.md b/docs/examples/vcs/list-repositories.md index aeb1698..38667a6 100644 --- a/docs/examples/vcs/list-repositories.md +++ b/docs/examples/vcs/list-repositories.md @@ -1,18 +1,14 @@ -import { Client, Vcs } from "@appwrite.io/console"; +import { Client, Vcs } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const vcs = new Vcs(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = vcs.listRepositories('[INSTALLATION_ID]'); +const result = await vcs.listRepositories( + '[INSTALLATION_ID]', // installationId + '[SEARCH]' // search (optional) +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/vcs/list-repository-branches.md b/docs/examples/vcs/list-repository-branches.md index 2b6d05c..c49925b 100644 --- a/docs/examples/vcs/list-repository-branches.md +++ b/docs/examples/vcs/list-repository-branches.md @@ -1,18 +1,14 @@ -import { Client, Vcs } from "@appwrite.io/console"; +import { Client, Vcs } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const vcs = new Vcs(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = vcs.listRepositoryBranches('[INSTALLATION_ID]', '[PROVIDER_REPOSITORY_ID]'); +const result = await vcs.listRepositoryBranches( + '[INSTALLATION_ID]', // installationId + '[PROVIDER_REPOSITORY_ID]' // providerRepositoryId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/docs/examples/vcs/update-external-deployments.md b/docs/examples/vcs/update-external-deployments.md index 1a6d5d5..2b2d30e 100644 --- a/docs/examples/vcs/update-external-deployments.md +++ b/docs/examples/vcs/update-external-deployments.md @@ -1,18 +1,15 @@ -import { Client, Vcs } from "@appwrite.io/console"; +import { Client, Vcs } from "@appwrite.io/console"; -const client = new Client(); +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject('5df5acd0d48c2'); // Your project ID const vcs = new Vcs(client); -client - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID -; - -const promise = vcs.updateExternalDeployments('[INSTALLATION_ID]', '[REPOSITORY_ID]', '[PROVIDER_PULL_REQUEST_ID]'); +const result = await vcs.updateExternalDeployments( + '[INSTALLATION_ID]', // installationId + '[REPOSITORY_ID]', // repositoryId + '[PROVIDER_PULL_REQUEST_ID]' // providerPullRequestId +); -promise.then(function (response) { - console.log(response); // Success -}, function (error) { - console.log(error); // Failure -}); \ No newline at end of file +console.log(response); diff --git a/package.json b/package.json index a49942b..148f222 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@appwrite.io/console", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API", - "version": "0.6.0-rc.11", + "version": "0.6.0-rc.12", "license": "BSD-3-Clause", "main": "dist/cjs/sdk.js", "exports": { diff --git a/src/client.ts b/src/client.ts index 4183945..eab06d6 100644 --- a/src/client.ts +++ b/src/client.ts @@ -104,7 +104,7 @@ class Client { 'x-sdk-name': 'Console', 'x-sdk-platform': 'console', 'x-sdk-language': 'web', - 'x-sdk-version': '0.6.0-rc.11', + 'x-sdk-version': '0.6.0-rc.12', 'X-Appwrite-Response-Format': '1.5.0', }; diff --git a/src/enums/a-p-i-service.ts b/src/enums/api-service.ts similarity index 91% rename from src/enums/a-p-i-service.ts rename to src/enums/api-service.ts index fb84e31..032f1e8 100644 --- a/src/enums/a-p-i-service.ts +++ b/src/enums/api-service.ts @@ -1,4 +1,4 @@ -export enum APIService { +export enum ApiService { Account = 'account', Avatars = 'avatars', Databases = 'databases', diff --git a/src/enums/s-m-t-p-encryption.ts b/src/enums/encryption.ts similarity index 65% rename from src/enums/s-m-t-p-encryption.ts rename to src/enums/encryption.ts index e4985c8..4ce5dda 100644 --- a/src/enums/s-m-t-p-encryption.ts +++ b/src/enums/encryption.ts @@ -1,4 +1,4 @@ -export enum SMTPEncryption { +export enum Encryption { None = 'none', Ssl = 'ssl', Tls = 'tls', diff --git a/src/enums/region.ts b/src/enums/region.ts index 1c73f3e..b4f2d7b 100644 --- a/src/enums/region.ts +++ b/src/enums/region.ts @@ -1,3 +1,4 @@ export enum Region { Default = 'default', + Fra = 'fra', } \ No newline at end of file diff --git a/src/enums/runtime.ts b/src/enums/runtime.ts index b2d1cf9..cc3ceda 100644 --- a/src/enums/runtime.ts +++ b/src/enums/runtime.ts @@ -1,6 +1,38 @@ export enum Runtime { + Node145 = 'node-14.5', + Node160 = 'node-16.0', Node180 = 'node-18.0', + Node190 = 'node-19.0', + Node200 = 'node-20.0', Php80 = 'php-8.0', + Php81 = 'php-8.1', + Php82 = 'php-8.2', + Ruby30 = 'ruby-3.0', Ruby31 = 'ruby-3.1', + Ruby32 = 'ruby-3.2', + Python38 = 'python-3.8', Python39 = 'python-3.9', + Python310 = 'python-3.10', + Python311 = 'python-3.11', + Python312 = 'python-3.12', + Dart215 = 'dart-2.15', + Dart216 = 'dart-2.16', + Dart217 = 'dart-2.17', + Dart218 = 'dart-2.18', + Dart30 = 'dart-3.0', + Dart31 = 'dart-3.1', + Dotnet31 = 'dotnet-3.1', + Dotnet60 = 'dotnet-6.0', + Dotnet70 = 'dotnet-7.0', + Java80 = 'java-8.0', + Java110 = 'java-11.0', + Java170 = 'java-17.0', + Java180 = 'java-18.0', + Swift55 = 'swift-5.5', + Swift58 = 'swift-5.8', + Kotlin16 = 'kotlin-1.6', + Kotlin18 = 'kotlin-1.8', + Cpp17 = 'cpp-17', + Cpp20 = 'cpp-20', + Bun10 = 'bun-1.0', } \ No newline at end of file diff --git a/src/enums/s-m-s-template-locale.ts b/src/enums/sms-template-locale.ts similarity index 98% rename from src/enums/s-m-s-template-locale.ts rename to src/enums/sms-template-locale.ts index 5f11e94..d04fab2 100644 --- a/src/enums/s-m-s-template-locale.ts +++ b/src/enums/sms-template-locale.ts @@ -1,4 +1,4 @@ -export enum SMSTemplateLocale { +export enum SmsTemplateLocale { Af = 'af', Arae = 'ar-ae', Arbh = 'ar-bh', diff --git a/src/enums/s-m-s-template-type.ts b/src/enums/sms-template-type.ts similarity index 74% rename from src/enums/s-m-s-template-type.ts rename to src/enums/sms-template-type.ts index 58c762b..031b00e 100644 --- a/src/enums/s-m-s-template-type.ts +++ b/src/enums/sms-template-type.ts @@ -1,4 +1,4 @@ -export enum SMSTemplateType { +export enum SmsTemplateType { Verification = 'verification', Login = 'login', Invitation = 'invitation', diff --git a/src/index.ts b/src/index.ts index 057a415..03fa8fa 100644 --- a/src/index.ts +++ b/src/index.ts @@ -37,17 +37,17 @@ export { FunctionUsageRange } from './enums/function-usage-range'; export { ExecutionMethod } from './enums/execution-method'; export { Name } from './enums/name'; export { MessageStatus } from './enums/message-status'; -export { SMTPEncryption } from './enums/s-m-t-p-encryption'; +export { Encryption } from './enums/encryption'; export { ProjectUsageRange } from './enums/project-usage-range'; export { Region } from './enums/region'; export { AuthMethod } from './enums/auth-method'; export { PlatformType } from './enums/platform-type'; -export { APIService } from './enums/a-p-i-service'; +export { ApiService } from './enums/api-service'; export { SMTPSecure } from './enums/s-m-t-p-secure'; export { EmailTemplateType } from './enums/email-template-type'; export { EmailTemplateLocale } from './enums/email-template-locale'; -export { SMSTemplateType } from './enums/s-m-s-template-type'; -export { SMSTemplateLocale } from './enums/s-m-s-template-locale'; +export { SmsTemplateType } from './enums/sms-template-type'; +export { SmsTemplateLocale } from './enums/sms-template-locale'; export { ResourceType } from './enums/resource-type'; export { Compression } from './enums/compression'; export { ImageGravity } from './enums/image-gravity'; diff --git a/src/services/messaging.ts b/src/services/messaging.ts index b34b232..741fca5 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -4,7 +4,7 @@ import type { Models } from '../models'; import type { UploadProgress, Payload } from '../client'; import { Query } from '../query'; import { MessageStatus } from '../enums/message-status'; -import { SMTPEncryption } from '../enums/s-m-t-p-encryption'; +import { Encryption } from '../enums/encryption'; export class Messaging extends Service { @@ -16,6 +16,7 @@ export class Messaging extends Service { /** * List messages * + * Get a list of all messages from the current Appwrite project. * * @param {string[]} queries * @param {string} search @@ -41,8 +42,9 @@ export class Messaging extends Service { } /** - * Create an email. + * Create an email * + * Create a new email message. * * @param {string} messageId * @param {string} subject @@ -52,13 +54,14 @@ export class Messaging extends Service { * @param {string[]} targets * @param {string[]} cc * @param {string[]} bcc + * @param {string[]} attachments * @param {MessageStatus} status * @param {boolean} html * @param {string} scheduledAt * @throws {AppwriteException} * @returns {Promise} */ - async createEmail(messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], status?: MessageStatus, html?: boolean, scheduledAt?: string): Promise { + async createEmail(messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], status?: MessageStatus, html?: boolean, scheduledAt?: string): Promise { if (typeof messageId === 'undefined') { throw new AppwriteException('Missing required parameter: "messageId"'); } @@ -106,6 +109,10 @@ export class Messaging extends Service { payload['bcc'] = bcc; } + if (typeof attachments !== 'undefined') { + payload['attachments'] = attachments; + } + if (typeof status !== 'undefined') { payload['status'] = status; } @@ -125,8 +132,10 @@ export class Messaging extends Service { } /** - * Update an email. + * Update an email * + * Update an email message by its unique ID. + * * * @param {string} messageId * @param {string[]} topics @@ -197,8 +206,9 @@ export class Messaging extends Service { } /** - * Create a push notification. + * Create a push notification * + * Create a new push notification. * * @param {string} messageId * @param {string} title @@ -208,6 +218,7 @@ export class Messaging extends Service { * @param {string[]} targets * @param {object} data * @param {string} action + * @param {string} image * @param {string} icon * @param {string} sound * @param {string} color @@ -218,7 +229,7 @@ export class Messaging extends Service { * @throws {AppwriteException} * @returns {Promise} */ - async createPush(messageId: string, title: string, body: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: string, status?: MessageStatus, scheduledAt?: string): Promise { + async createPush(messageId: string, title: string, body: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: string, status?: MessageStatus, scheduledAt?: string): Promise { if (typeof messageId === 'undefined') { throw new AppwriteException('Missing required parameter: "messageId"'); } @@ -266,6 +277,10 @@ export class Messaging extends Service { payload['action'] = action; } + if (typeof image !== 'undefined') { + payload['image'] = image; + } + if (typeof icon !== 'undefined') { payload['icon'] = icon; } @@ -301,8 +316,10 @@ export class Messaging extends Service { } /** - * Update a push notification. + * Update a push notification * + * Update a push notification by its unique ID. + * * * @param {string} messageId * @param {string[]} topics @@ -312,6 +329,7 @@ export class Messaging extends Service { * @param {string} body * @param {object} data * @param {string} action + * @param {string} image * @param {string} icon * @param {string} sound * @param {string} color @@ -322,7 +340,7 @@ export class Messaging extends Service { * @throws {AppwriteException} * @returns {Promise} */ - async updatePush(messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, status?: MessageStatus, scheduledAt?: string): Promise { + async updatePush(messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, status?: MessageStatus, scheduledAt?: string): Promise { if (typeof messageId === 'undefined') { throw new AppwriteException('Missing required parameter: "messageId"'); } @@ -358,6 +376,10 @@ export class Messaging extends Service { payload['action'] = action; } + if (typeof image !== 'undefined') { + payload['image'] = image; + } + if (typeof icon !== 'undefined') { payload['icon'] = icon; } @@ -393,8 +415,9 @@ export class Messaging extends Service { } /** - * Create an SMS. + * Create an SMS * + * Create a new SMS message. * * @param {string} messageId * @param {string} content @@ -406,7 +429,7 @@ export class Messaging extends Service { * @throws {AppwriteException} * @returns {Promise} */ - async createSMS(messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], status?: MessageStatus, scheduledAt?: string): Promise { + async createSms(messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], status?: MessageStatus, scheduledAt?: string): Promise { if (typeof messageId === 'undefined') { throw new AppwriteException('Missing required parameter: "messageId"'); } @@ -453,8 +476,10 @@ export class Messaging extends Service { } /** - * Update an SMS. + * Update an SMS * + * Update an email message by its unique ID. + * * * @param {string} messageId * @param {string[]} topics @@ -466,7 +491,7 @@ export class Messaging extends Service { * @throws {AppwriteException} * @returns {Promise} */ - async updateSMS(messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, status?: MessageStatus, scheduledAt?: string): Promise { + async updateSms(messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, status?: MessageStatus, scheduledAt?: string): Promise { if (typeof messageId === 'undefined') { throw new AppwriteException('Missing required parameter: "messageId"'); } @@ -507,6 +532,8 @@ export class Messaging extends Service { /** * Get a message * + * Get a message by its unique ID. + * * * @param {string} messageId * @throws {AppwriteException} @@ -551,6 +578,7 @@ export class Messaging extends Service { /** * List message logs * + * Get the message activity logs listed by its unique ID. * * @param {string} messageId * @param {string[]} queries @@ -578,8 +606,7 @@ export class Messaging extends Service { /** * List message targets * - * List the targets associated with a message as set via the targets - * attribute. + * Get a list of the targets associated with a message. * * @param {string} messageId * @param {string[]} queries @@ -607,6 +634,7 @@ export class Messaging extends Service { /** * List providers * + * Get a list of all providers from the current Appwrite project. * * @param {string[]} queries * @param {string} search @@ -634,6 +662,7 @@ export class Messaging extends Service { /** * Create APNS provider * + * Create a new Apple Push Notification service provider. * * @param {string} providerId * @param {string} name @@ -645,7 +674,7 @@ export class Messaging extends Service { * @throws {AppwriteException} * @returns {Promise} */ - async createAPNSProvider(providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, enabled?: boolean): Promise { + async createApnsProvider(providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, enabled?: boolean): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -694,6 +723,7 @@ export class Messaging extends Service { /** * Update APNS provider * + * Update a Apple Push Notification service provider by its unique ID. * * @param {string} providerId * @param {string} name @@ -746,6 +776,7 @@ export class Messaging extends Service { /** * Create FCM provider * + * Create a new Firebase Cloud Messaging provider. * * @param {string} providerId * @param {string} name @@ -754,7 +785,7 @@ export class Messaging extends Service { * @throws {AppwriteException} * @returns {Promise} */ - async createFCMProvider(providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean): Promise { + async createFcmProvider(providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -791,6 +822,7 @@ export class Messaging extends Service { /** * Update FCM provider * + * Update a Firebase Cloud Messaging provider by its unique ID. * * @param {string} providerId * @param {string} name @@ -828,6 +860,7 @@ export class Messaging extends Service { /** * Create Mailgun provider * + * Create a new Mailgun provider. * * @param {string} providerId * @param {string} name @@ -903,6 +936,7 @@ export class Messaging extends Service { /** * Update Mailgun provider * + * Update a Mailgun provider by its unique ID. * * @param {string} providerId * @param {string} name @@ -970,6 +1004,7 @@ export class Messaging extends Service { /** * Create Msg91 provider * + * Create a new MSG91 provider. * * @param {string} providerId * @param {string} name @@ -1025,6 +1060,7 @@ export class Messaging extends Service { /** * Update Msg91 provider * + * Update a MSG91 provider by its unique ID. * * @param {string} providerId * @param {string} name @@ -1137,6 +1173,7 @@ export class Messaging extends Service { /** * Update Sendgrid provider * + * Update a Sendgrid provider by its unique ID. * * @param {string} providerId * @param {string} name @@ -1194,6 +1231,7 @@ export class Messaging extends Service { /** * Create SMTP provider * + * Create a new SMTP provider. * * @param {string} providerId * @param {string} name @@ -1201,7 +1239,7 @@ export class Messaging extends Service { * @param {number} port * @param {string} username * @param {string} password - * @param {SMTPEncryption} encryption + * @param {Encryption} encryption * @param {boolean} autoTLS * @param {string} mailer * @param {string} fromName @@ -1212,7 +1250,7 @@ export class Messaging extends Service { * @throws {AppwriteException} * @returns {Promise} */ - async createSMTPProvider(providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SMTPEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise { + async createSmtpProvider(providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: Encryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -1293,6 +1331,7 @@ export class Messaging extends Service { /** * Update SMTP provider * + * Update a SMTP provider by its unique ID. * * @param {string} providerId * @param {string} name @@ -1300,7 +1339,7 @@ export class Messaging extends Service { * @param {number} port * @param {string} username * @param {string} password - * @param {SMTPEncryption} encryption + * @param {Encryption} encryption * @param {boolean} autoTLS * @param {string} mailer * @param {string} fromName @@ -1311,7 +1350,7 @@ export class Messaging extends Service { * @throws {AppwriteException} * @returns {Promise} */ - async updateSMTPProvider(providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SMTPEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise { + async updateSmtpProvider(providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: Encryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -1380,6 +1419,7 @@ export class Messaging extends Service { /** * Create Telesign provider * + * Create a new Telesign provider. * * @param {string} providerId * @param {string} name @@ -1435,6 +1475,7 @@ export class Messaging extends Service { /** * Update Telesign provider * + * Update a Telesign provider by its unique ID. * * @param {string} providerId * @param {string} name @@ -1482,6 +1523,7 @@ export class Messaging extends Service { /** * Create Textmagic provider * + * Create a new Textmagic provider. * * @param {string} providerId * @param {string} name @@ -1537,6 +1579,7 @@ export class Messaging extends Service { /** * Update Textmagic provider * + * Update a Textmagic provider by its unique ID. * * @param {string} providerId * @param {string} name @@ -1584,6 +1627,7 @@ export class Messaging extends Service { /** * Create Twilio provider * + * Create a new Twilio provider. * * @param {string} providerId * @param {string} name @@ -1639,6 +1683,7 @@ export class Messaging extends Service { /** * Update Twilio provider * + * Update a Twilio provider by its unique ID. * * @param {string} providerId * @param {string} name @@ -1686,6 +1731,7 @@ export class Messaging extends Service { /** * Create Vonage provider * + * Create a new Vonage provider. * * @param {string} providerId * @param {string} name @@ -1741,6 +1787,7 @@ export class Messaging extends Service { /** * Update Vonage provider * + * Update a Vonage provider by its unique ID. * * @param {string} providerId * @param {string} name @@ -1788,6 +1835,8 @@ export class Messaging extends Service { /** * Get provider * + * Get a provider by its unique ID. + * * * @param {string} providerId * @throws {AppwriteException} @@ -1810,6 +1859,7 @@ export class Messaging extends Service { /** * Delete provider * + * Delete a provider by its unique ID. * * @param {string} providerId * @throws {AppwriteException} @@ -1832,6 +1882,7 @@ export class Messaging extends Service { /** * List provider logs * + * Get the provider activity logs listed by its unique ID. * * @param {string} providerId * @param {string[]} queries @@ -1859,6 +1910,7 @@ export class Messaging extends Service { /** * List subscriber logs * + * Get the subscriber activity logs listed by its unique ID. * * @param {string} subscriberId * @param {string[]} queries @@ -1884,8 +1936,9 @@ export class Messaging extends Service { } /** - * List topics. + * List topics * + * Get a list of all topics from the current Appwrite project. * * @param {string[]} queries * @param {string} search @@ -1911,8 +1964,9 @@ export class Messaging extends Service { } /** - * Create a topic. + * Create a topic * + * Create a new topic. * * @param {string} topicId * @param {string} name @@ -1951,8 +2005,10 @@ export class Messaging extends Service { } /** - * Get a topic. + * Get a topic * + * Get a topic by its unique ID. + * * * @param {string} topicId * @throws {AppwriteException} @@ -1973,8 +2029,10 @@ export class Messaging extends Service { } /** - * Update a topic. + * Update a topic * + * Update a topic by its unique ID. + * * * @param {string} topicId * @param {string} name @@ -2000,8 +2058,9 @@ export class Messaging extends Service { } /** - * Delete a topic. + * Delete a topic * + * Delete a topic by its unique ID. * * @param {string} topicId * @throws {AppwriteException} @@ -2024,6 +2083,7 @@ export class Messaging extends Service { /** * List topic logs * + * Get the topic activity logs listed by its unique ID. * * @param {string} topicId * @param {string[]} queries @@ -2049,8 +2109,9 @@ export class Messaging extends Service { } /** - * List subscribers. + * List subscribers * + * Get a list of all subscribers from the current Appwrite project. * * @param {string} topicId * @param {string[]} queries @@ -2081,8 +2142,9 @@ export class Messaging extends Service { } /** - * Create a subscriber. + * Create a subscriber * + * Create a new subscriber. * * @param {string} topicId * @param {string} subscriberId @@ -2121,8 +2183,10 @@ export class Messaging extends Service { } /** - * Get a subscriber. + * Get a subscriber * + * Get a subscriber by its unique ID. + * * * @param {string} topicId * @param {string} subscriberId @@ -2148,8 +2212,9 @@ export class Messaging extends Service { } /** - * Delete a subscriber. + * Delete a subscriber * + * Delete a subscriber by its unique ID. * * @param {string} topicId * @param {string} subscriberId diff --git a/src/services/projects.ts b/src/services/projects.ts index 05cdc6e..a48321e 100644 --- a/src/services/projects.ts +++ b/src/services/projects.ts @@ -7,12 +7,12 @@ import { Region } from '../enums/region'; import { AuthMethod } from '../enums/auth-method'; import { OAuthProvider } from '../enums/o-auth-provider'; import { PlatformType } from '../enums/platform-type'; -import { APIService } from '../enums/a-p-i-service'; +import { ApiService } from '../enums/api-service'; import { SMTPSecure } from '../enums/s-m-t-p-secure'; import { EmailTemplateType } from '../enums/email-template-type'; import { EmailTemplateLocale } from '../enums/email-template-locale'; -import { SMSTemplateType } from '../enums/s-m-s-template-type'; -import { SMSTemplateLocale } from '../enums/s-m-s-template-locale'; +import { SmsTemplateType } from '../enums/sms-template-type'; +import { SmsTemplateLocale } from '../enums/sms-template-locale'; export class Projects extends Service { @@ -888,12 +888,12 @@ export class Projects extends Service { * * * @param {string} projectId - * @param {APIService} service + * @param {ApiService} service * @param {boolean} status * @throws {AppwriteException} * @returns {Promise} */ - async updateServiceStatus(projectId: string, service: APIService, status: boolean): Promise { + async updateServiceStatus(projectId: string, service: ApiService, status: boolean): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } @@ -1273,12 +1273,12 @@ export class Projects extends Service { * * * @param {string} projectId - * @param {SMSTemplateType} type - * @param {SMSTemplateLocale} locale + * @param {SmsTemplateType} type + * @param {SmsTemplateLocale} locale * @throws {AppwriteException} * @returns {Promise} */ - async getSmsTemplate(projectId: string, type: SMSTemplateType, locale: SMSTemplateLocale): Promise { + async getSmsTemplate(projectId: string, type: SmsTemplateType, locale: SmsTemplateLocale): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } @@ -1305,13 +1305,13 @@ export class Projects extends Service { * * * @param {string} projectId - * @param {SMSTemplateType} type - * @param {SMSTemplateLocale} locale + * @param {SmsTemplateType} type + * @param {SmsTemplateLocale} locale * @param {string} message * @throws {AppwriteException} * @returns {Promise} */ - async updateSmsTemplate(projectId: string, type: SMSTemplateType, locale: SMSTemplateLocale, message: string): Promise { + async updateSmsTemplate(projectId: string, type: SmsTemplateType, locale: SmsTemplateLocale, message: string): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } @@ -1346,12 +1346,12 @@ export class Projects extends Service { * * * @param {string} projectId - * @param {SMSTemplateType} type - * @param {SMSTemplateLocale} locale + * @param {SmsTemplateType} type + * @param {SmsTemplateLocale} locale * @throws {AppwriteException} * @returns {Promise} */ - async deleteSmsTemplate(projectId: string, type: SMSTemplateType, locale: SMSTemplateLocale): Promise { + async deleteSmsTemplate(projectId: string, type: SmsTemplateType, locale: SmsTemplateLocale): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); }