Skip to content

Commit f925c9e

Browse files
authored
Merge pull request #204 from appwrite/dev
feat: Command Line SDK update for version 10.1.0
2 parents ac18baf + 4ad9bbb commit f925c9e

File tree

14 files changed

+160
-65
lines changed

14 files changed

+160
-65
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Log
22

3+
## 10.1.0
4+
5+
* Deprecate `createVerification` method in `Account` service
6+
* Add `createEmailVerification` method in `Account` service
7+
38
## 10.0.1
49

510
* Fix CLI Dart model generation issues

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Once the installation is complete, you can verify the install using
2929

3030
```sh
3131
$ appwrite -v
32-
10.0.1
32+
10.1.0
3333
```
3434

3535
### Install using prebuilt binaries
@@ -60,7 +60,7 @@ $ scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/sc
6060
Once the installation completes, you can verify your install using
6161
```
6262
$ appwrite -v
63-
10.0.1
63+
10.1.0
6464
```
6565

6666
## Getting Started
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
appwrite account create-email-verification \
2+
--url https://example.com
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
appwrite account update-email-verification \
2+
--user-id <USER_ID> \
3+
--secret <SECRET>

install.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# You can use "View source" of this page to see the full script.
1414

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

1919
$APPWRITE_BINARY_NAME = "appwrite.exe"
2020

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ printSuccess() {
9797
downloadBinary() {
9898
echo "[2/4] Downloading executable for $OS ($ARCH) ..."
9999

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

lib/client.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ class Client {
1616
'x-sdk-name': 'Command Line',
1717
'x-sdk-platform': 'console',
1818
'x-sdk-language': 'cli',
19-
'x-sdk-version': '10.0.1',
20-
'user-agent' : `AppwriteCLI/10.0.1 (${os.type()} ${os.version()}; ${os.arch()})`,
19+
'x-sdk-version': '10.1.0',
20+
'user-agent' : `AppwriteCLI/10.1.0 (${os.type()} ${os.version()}; ${os.arch()})`,
2121
'X-Appwrite-Response-Format' : '1.8.0',
2222
};
2323
}

lib/commands/account.js

Lines changed: 91 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,6 +1527,39 @@ const accountCreatePhoneToken = async ({userId,phone,parseOutput = true, overrid
15271527

15281528
return response;
15291529

1530+
}
1531+
/**
1532+
* @typedef {Object} AccountCreateEmailVerificationRequestParams
1533+
* @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.
1534+
* @property {boolean} overrideForCli
1535+
* @property {boolean} parseOutput
1536+
* @property {libClient | undefined} sdk
1537+
*/
1538+
1539+
/**
1540+
* @param {AccountCreateEmailVerificationRequestParams} params
1541+
*/
1542+
const accountCreateEmailVerification = async ({url,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1543+
let client = !sdk ? await sdkForProject() :
1544+
sdk;
1545+
let apiPath = '/account/verifications/email';
1546+
let payload = {};
1547+
if (typeof url !== 'undefined') {
1548+
payload['url'] = url;
1549+
}
1550+
1551+
let response = undefined;
1552+
1553+
response = await client.call('post', apiPath, {
1554+
'content-type': 'application/json',
1555+
}, payload);
1556+
1557+
if (parseOutput) {
1558+
parse(response)
1559+
}
1560+
1561+
return response;
1562+
15301563
}
15311564
/**
15321565
* @typedef {Object} AccountCreateVerificationRequestParams
@@ -1542,7 +1575,7 @@ const accountCreatePhoneToken = async ({userId,phone,parseOutput = true, overrid
15421575
const accountCreateVerification = async ({url,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
15431576
let client = !sdk ? await sdkForProject() :
15441577
sdk;
1545-
let apiPath = '/account/verification';
1578+
let apiPath = '/account/verifications/email';
15461579
let payload = {};
15471580
if (typeof url !== 'undefined') {
15481581
payload['url'] = url;
@@ -1560,6 +1593,43 @@ const accountCreateVerification = async ({url,parseOutput = true, overrideForCli
15601593

15611594
return response;
15621595

1596+
}
1597+
/**
1598+
* @typedef {Object} AccountUpdateEmailVerificationRequestParams
1599+
* @property {string} userId User ID.
1600+
* @property {string} secret Valid verification token.
1601+
* @property {boolean} overrideForCli
1602+
* @property {boolean} parseOutput
1603+
* @property {libClient | undefined} sdk
1604+
*/
1605+
1606+
/**
1607+
* @param {AccountUpdateEmailVerificationRequestParams} params
1608+
*/
1609+
const accountUpdateEmailVerification = async ({userId,secret,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1610+
let client = !sdk ? await sdkForProject() :
1611+
sdk;
1612+
let apiPath = '/account/verifications/email';
1613+
let payload = {};
1614+
if (typeof userId !== 'undefined') {
1615+
payload['userId'] = userId;
1616+
}
1617+
if (typeof secret !== 'undefined') {
1618+
payload['secret'] = secret;
1619+
}
1620+
1621+
let response = undefined;
1622+
1623+
response = await client.call('put', apiPath, {
1624+
'content-type': 'application/json',
1625+
}, payload);
1626+
1627+
if (parseOutput) {
1628+
parse(response)
1629+
}
1630+
1631+
return response;
1632+
15631633
}
15641634
/**
15651635
* @typedef {Object} AccountUpdateVerificationRequestParams
@@ -1576,7 +1646,7 @@ const accountCreateVerification = async ({url,parseOutput = true, overrideForCli
15761646
const accountUpdateVerification = async ({userId,secret,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
15771647
let client = !sdk ? await sdkForProject() :
15781648
sdk;
1579-
let apiPath = '/account/verification';
1649+
let apiPath = '/account/verifications/email';
15801650
let payload = {};
15811651
if (typeof userId !== 'undefined') {
15821652
payload['userId'] = userId;
@@ -1611,7 +1681,7 @@ const accountUpdateVerification = async ({userId,secret,parseOutput = true, over
16111681
const accountCreatePhoneVerification = async ({parseOutput = true, overrideForCli = false, sdk = undefined}) => {
16121682
let client = !sdk ? await sdkForProject() :
16131683
sdk;
1614-
let apiPath = '/account/verification/phone';
1684+
let apiPath = '/account/verifications/phone';
16151685
let payload = {};
16161686

16171687
let response = undefined;
@@ -1642,7 +1712,7 @@ const accountCreatePhoneVerification = async ({parseOutput = true, overrideForCl
16421712
const accountUpdatePhoneVerification = async ({userId,secret,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
16431713
let client = !sdk ? await sdkForProject() :
16441714
sdk;
1645-
let apiPath = '/account/verification/phone';
1715+
let apiPath = '/account/verifications/phone';
16461716
let payload = {};
16471717
if (typeof userId !== 'undefined') {
16481718
payload['userId'] = userId;
@@ -1949,16 +2019,29 @@ account
19492019
.action(actionRunner(accountCreatePhoneToken))
19502020

19512021
account
1952-
.command(`create-verification`)
2022+
.command(`create-email-verification`)
19532023
.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. `)
19542024
.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.`)
2025+
.action(actionRunner(accountCreateEmailVerification))
2026+
2027+
account
2028+
.command(`create-verification`)
2029+
.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. `)
2030+
.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.`)
19552031
.action(actionRunner(accountCreateVerification))
19562032

19572033
account
1958-
.command(`update-verification`)
2034+
.command(`update-email-verification`)
19592035
.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.`)
19602036
.requiredOption(`--user-id <user-id>`, `User ID.`)
19612037
.requiredOption(`--secret <secret>`, `Valid verification token.`)
2038+
.action(actionRunner(accountUpdateEmailVerification))
2039+
2040+
account
2041+
.command(`update-verification`)
2042+
.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.`)
2043+
.requiredOption(`--user-id <user-id>`, `User ID.`)
2044+
.requiredOption(`--secret <secret>`, `Valid verification token.`)
19622045
.action(actionRunner(accountUpdateVerification))
19632046

19642047
account
@@ -2019,7 +2102,9 @@ module.exports = {
20192102
accountCreateMagicURLToken,
20202103
accountCreateOAuth2Token,
20212104
accountCreatePhoneToken,
2105+
accountCreateEmailVerification,
20222106
accountCreateVerification,
2107+
accountUpdateEmailVerification,
20232108
accountUpdateVerification,
20242109
accountCreatePhoneVerification,
20252110
accountUpdatePhoneVerification

lib/commands/functions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1541,7 +1541,7 @@ functions
15411541

15421542
functions
15431543
.command(`create-template-deployment`)
1544-
.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.`)
1544+
.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.`)
15451545
.requiredOption(`--function-id <function-id>`, `Function ID.`)
15461546
.requiredOption(`--repository <repository>`, `Repository name of the template.`)
15471547
.requiredOption(`--owner <owner>`, `The name of the owner of the template.`)

lib/commands/sites.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1482,7 +1482,7 @@ sites
14821482

14831483
sites
14841484
.command(`create-template-deployment`)
1485-
.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.`)
1485+
.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.`)
14861486
.requiredOption(`--site-id <site-id>`, `Site ID.`)
14871487
.requiredOption(`--repository <repository>`, `Repository name of the template.`)
14881488
.requiredOption(`--owner <owner>`, `The name of the owner of the template.`)

0 commit comments

Comments
 (0)