Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## 10.1.0

* Deprecate `createVerification` method in `Account` service
* Add `createEmailVerification` method in `Account` service

## 10.0.1

* Fix CLI Dart model generation issues
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Once the installation is complete, you can verify the install using

```sh
$ appwrite -v
10.0.1
10.1.0
```

### Install using prebuilt binaries
Expand Down Expand Up @@ -60,7 +60,7 @@ $ scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/sc
Once the installation completes, you can verify your install using
```
$ appwrite -v
10.0.1
10.1.0
```

## Getting Started
Expand Down
2 changes: 2 additions & 0 deletions docs/examples/account/create-email-verification.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
appwrite account create-email-verification \
--url https://example.com
3 changes: 3 additions & 0 deletions docs/examples/account/update-email-verification.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
appwrite account update-email-verification \
--user-id <USER_ID> \
--secret <SECRET>
4 changes: 2 additions & 2 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# You can use "View source" of this page to see the full script.

# REPO
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/10.0.1/appwrite-cli-win-x64.exe"
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/10.0.1/appwrite-cli-win-arm64.exe"
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/10.1.0/appwrite-cli-win-x64.exe"
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/10.1.0/appwrite-cli-win-arm64.exe"

$APPWRITE_BINARY_NAME = "appwrite.exe"

Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ printSuccess() {
downloadBinary() {
echo "[2/4] Downloading executable for $OS ($ARCH) ..."

GITHUB_LATEST_VERSION="10.0.1"
GITHUB_LATEST_VERSION="10.1.0"
GITHUB_FILE="appwrite-cli-${OS}-${ARCH}"
GITHUB_URL="https://github.com/$GITHUB_REPOSITORY_NAME/releases/download/$GITHUB_LATEST_VERSION/$GITHUB_FILE"

Expand Down
4 changes: 2 additions & 2 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class Client {
'x-sdk-name': 'Command Line',
'x-sdk-platform': 'console',
'x-sdk-language': 'cli',
'x-sdk-version': '10.0.1',
'user-agent' : `AppwriteCLI/10.0.1 (${os.type()} ${os.version()}; ${os.arch()})`,
'x-sdk-version': '10.1.0',
'user-agent' : `AppwriteCLI/10.1.0 (${os.type()} ${os.version()}; ${os.arch()})`,
'X-Appwrite-Response-Format' : '1.8.0',
};
}
Expand Down
97 changes: 91 additions & 6 deletions lib/commands/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -1527,6 +1527,39 @@ const accountCreatePhoneToken = async ({userId,phone,parseOutput = true, overrid

return response;

}
/**
* @typedef {Object} AccountCreateEmailVerificationRequestParams
* @property {string} url URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
* @property {boolean} overrideForCli
* @property {boolean} parseOutput
* @property {libClient | undefined} sdk
*/

/**
* @param {AccountCreateEmailVerificationRequestParams} params
*/
const accountCreateEmailVerification = async ({url,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
let client = !sdk ? await sdkForProject() :
sdk;
let apiPath = '/account/verifications/email';
let payload = {};
if (typeof url !== 'undefined') {
payload['url'] = url;
}

let response = undefined;

response = await client.call('post', apiPath, {
'content-type': 'application/json',
}, payload);

if (parseOutput) {
parse(response)
}

return response;

}
/**
* @typedef {Object} AccountCreateVerificationRequestParams
Expand All @@ -1542,7 +1575,7 @@ const accountCreatePhoneToken = async ({userId,phone,parseOutput = true, overrid
const accountCreateVerification = async ({url,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
let client = !sdk ? await sdkForProject() :
sdk;
let apiPath = '/account/verification';
let apiPath = '/account/verifications/email';
let payload = {};
if (typeof url !== 'undefined') {
payload['url'] = url;
Expand All @@ -1560,6 +1593,43 @@ const accountCreateVerification = async ({url,parseOutput = true, overrideForCli

return response;

}
/**
* @typedef {Object} AccountUpdateEmailVerificationRequestParams
* @property {string} userId User ID.
* @property {string} secret Valid verification token.
* @property {boolean} overrideForCli
* @property {boolean} parseOutput
* @property {libClient | undefined} sdk
*/

/**
* @param {AccountUpdateEmailVerificationRequestParams} params
*/
const accountUpdateEmailVerification = async ({userId,secret,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
let client = !sdk ? await sdkForProject() :
sdk;
let apiPath = '/account/verifications/email';
let payload = {};
if (typeof userId !== 'undefined') {
payload['userId'] = userId;
}
if (typeof secret !== 'undefined') {
payload['secret'] = secret;
}

let response = undefined;

response = await client.call('put', apiPath, {
'content-type': 'application/json',
}, payload);

if (parseOutput) {
parse(response)
}

return response;

}
/**
* @typedef {Object} AccountUpdateVerificationRequestParams
Expand All @@ -1576,7 +1646,7 @@ const accountCreateVerification = async ({url,parseOutput = true, overrideForCli
const accountUpdateVerification = async ({userId,secret,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
let client = !sdk ? await sdkForProject() :
sdk;
let apiPath = '/account/verification';
let apiPath = '/account/verifications/email';
let payload = {};
if (typeof userId !== 'undefined') {
payload['userId'] = userId;
Expand Down Expand Up @@ -1611,7 +1681,7 @@ const accountUpdateVerification = async ({userId,secret,parseOutput = true, over
const accountCreatePhoneVerification = async ({parseOutput = true, overrideForCli = false, sdk = undefined}) => {
let client = !sdk ? await sdkForProject() :
sdk;
let apiPath = '/account/verification/phone';
let apiPath = '/account/verifications/phone';
let payload = {};

let response = undefined;
Expand Down Expand Up @@ -1642,7 +1712,7 @@ const accountCreatePhoneVerification = async ({parseOutput = true, overrideForCl
const accountUpdatePhoneVerification = async ({userId,secret,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
let client = !sdk ? await sdkForProject() :
sdk;
let apiPath = '/account/verification/phone';
let apiPath = '/account/verifications/phone';
let payload = {};
if (typeof userId !== 'undefined') {
payload['userId'] = userId;
Expand Down Expand Up @@ -1949,16 +2019,29 @@ account
.action(actionRunner(accountCreatePhoneToken))

account
.command(`create-verification`)
.command(`create-email-verification`)
.description(`Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days. Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. `)
.requiredOption(`--url <url>`, `URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
.action(actionRunner(accountCreateEmailVerification))

account
.command(`create-verification`)
.description(`[**DEPRECATED** - This command is deprecated. Please use 'account create-email-verification' instead] Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days. Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. `)
.requiredOption(`--url <url>`, `URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
.action(actionRunner(accountCreateVerification))

account
.command(`update-verification`)
.command(`update-email-verification`)
.description(`Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.`)
.requiredOption(`--user-id <user-id>`, `User ID.`)
.requiredOption(`--secret <secret>`, `Valid verification token.`)
.action(actionRunner(accountUpdateEmailVerification))

account
.command(`update-verification`)
.description(`[**DEPRECATED** - This command is deprecated. Please use 'account update-email-verification' instead] Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.`)
.requiredOption(`--user-id <user-id>`, `User ID.`)
.requiredOption(`--secret <secret>`, `Valid verification token.`)
.action(actionRunner(accountUpdateVerification))

account
Expand Down Expand Up @@ -2019,7 +2102,9 @@ module.exports = {
accountCreateMagicURLToken,
accountCreateOAuth2Token,
accountCreatePhoneToken,
accountCreateEmailVerification,
accountCreateVerification,
accountUpdateEmailVerification,
accountUpdateVerification,
accountCreatePhoneVerification,
accountUpdatePhoneVerification
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1541,7 +1541,7 @@ functions

functions
.command(`create-template-deployment`)
.description(`Create a deployment based on a template. Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to find the template details.`)
.description(`Create a deployment based on a template. Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/functions/templates) to find the template details.`)
.requiredOption(`--function-id <function-id>`, `Function ID.`)
.requiredOption(`--repository <repository>`, `Repository name of the template.`)
.requiredOption(`--owner <owner>`, `The name of the owner of the template.`)
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/sites.js
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,7 @@ sites

sites
.command(`create-template-deployment`)
.description(`Create a deployment based on a template. Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to find the template details.`)
.description(`Create a deployment based on a template. Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/sites/templates) to find the template details.`)
.requiredOption(`--site-id <site-id>`, `Site ID.`)
.requiredOption(`--repository <repository>`, `Repository name of the template.`)
.requiredOption(`--owner <owner>`, `The name of the owner of the template.`)
Expand Down
Loading