Skip to content

Commit 44c7c7d

Browse files
authored
Merge pull request #213 from appwrite/dev
feat: Command Line SDK update for version 11.0.0
2 parents 1ea90ef + 5eb6b0c commit 44c7c7d

File tree

15 files changed

+397
-23
lines changed

15 files changed

+397
-23
lines changed

CHANGELOG.md

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

3+
## 11.0.0
4+
5+
* Rename `create-csv-migration` to `create-csv-import` command to create a CSV import of a collection/table
6+
* Add `create-csv-export` command to create a CSV export of a collection/table
7+
* Add `create-resend-provider` and `update-resend-provider` commands to create and update a Resend Email provider
8+
* Fix syncing of tables deleted locally during `push tables` command
9+
* Fix added push command support for cli spatial types
10+
* Fix attribute changing during push
11+
* Replace pkg with @yao-pkg/pkg in dependencies
12+
313
## 10.2.3
414

515
* Fix `init tables` command not working

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.2.3
32+
11.0.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.2.3
63+
11.0.0
6464
```
6565

6666
## Getting Started
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
appwrite messaging create-resend-provider \
2+
--provider-id <PROVIDER_ID> \
3+
--name <NAME>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
appwrite messaging update-resend-provider \
2+
--provider-id <PROVIDER_ID>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
appwrite migrations create-csv-export \
2+
--resource-id <ID1:ID2> \
3+
--bucket-id <BUCKET_ID> \
4+
--filename <FILENAME>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
appwrite migrations create-csv-migration \
1+
appwrite migrations create-csv-import \
22
--bucket-id <BUCKET_ID> \
33
--file-id <FILE_ID> \
44
--resource-id <ID1:ID2>

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.2.3/appwrite-cli-win-x64.exe"
17-
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/10.2.3/appwrite-cli-win-arm64.exe"
16+
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/11.0.0/appwrite-cli-win-x64.exe"
17+
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/11.0.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.2.3"
100+
GITHUB_LATEST_VERSION="11.0.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.2.3',
20-
'user-agent' : `AppwriteCLI/10.2.3 (${os.type()} ${os.version()}; ${os.arch()})`,
19+
'x-sdk-version': '11.0.0',
20+
'user-agent' : `AppwriteCLI/11.0.0 (${os.type()} ${os.version()}; ${os.arch()})`,
2121
'X-Appwrite-Response-Format' : '1.8.0',
2222
};
2323
}

lib/commands/messaging.js

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,125 @@ const messagingUpdateMsg91Provider = async ({providerId,name,enabled,templateId,
11881188

11891189
return response;
11901190

1191+
}
1192+
/**
1193+
* @typedef {Object} MessagingCreateResendProviderRequestParams
1194+
* @property {string} providerId Provider ID. Choose a custom ID or generate a random ID with &#039;ID.unique()&#039;. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can&#039;t start with a special char. Max length is 36 chars.
1195+
* @property {string} name Provider name.
1196+
* @property {string} apiKey Resend API key.
1197+
* @property {string} fromName Sender Name.
1198+
* @property {string} fromEmail Sender email address.
1199+
* @property {string} replyToName Name set in the reply to field for the mail. Default value is sender name.
1200+
* @property {string} replyToEmail Email set in the reply to field for the mail. Default value is sender email.
1201+
* @property {boolean} enabled Set as enabled.
1202+
* @property {boolean} overrideForCli
1203+
* @property {boolean} parseOutput
1204+
* @property {libClient | undefined} sdk
1205+
*/
1206+
1207+
/**
1208+
* @param {MessagingCreateResendProviderRequestParams} params
1209+
*/
1210+
const messagingCreateResendProvider = async ({providerId,name,apiKey,fromName,fromEmail,replyToName,replyToEmail,enabled,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1211+
let client = !sdk ? await sdkForProject() :
1212+
sdk;
1213+
let apiPath = '/messaging/providers/resend';
1214+
let payload = {};
1215+
if (typeof providerId !== 'undefined') {
1216+
payload['providerId'] = providerId;
1217+
}
1218+
if (typeof name !== 'undefined') {
1219+
payload['name'] = name;
1220+
}
1221+
if (typeof apiKey !== 'undefined') {
1222+
payload['apiKey'] = apiKey;
1223+
}
1224+
if (typeof fromName !== 'undefined') {
1225+
payload['fromName'] = fromName;
1226+
}
1227+
if (typeof fromEmail !== 'undefined') {
1228+
payload['fromEmail'] = fromEmail;
1229+
}
1230+
if (typeof replyToName !== 'undefined') {
1231+
payload['replyToName'] = replyToName;
1232+
}
1233+
if (typeof replyToEmail !== 'undefined') {
1234+
payload['replyToEmail'] = replyToEmail;
1235+
}
1236+
if (typeof enabled !== 'undefined') {
1237+
payload['enabled'] = enabled;
1238+
}
1239+
1240+
let response = undefined;
1241+
1242+
response = await client.call('post', apiPath, {
1243+
'content-type': 'application/json',
1244+
}, payload);
1245+
1246+
if (parseOutput) {
1247+
parse(response)
1248+
}
1249+
1250+
return response;
1251+
1252+
}
1253+
/**
1254+
* @typedef {Object} MessagingUpdateResendProviderRequestParams
1255+
* @property {string} providerId Provider ID.
1256+
* @property {string} name Provider name.
1257+
* @property {boolean} enabled Set as enabled.
1258+
* @property {string} apiKey Resend API key.
1259+
* @property {string} fromName Sender Name.
1260+
* @property {string} fromEmail Sender email address.
1261+
* @property {string} replyToName Name set in the Reply To field for the mail. Default value is Sender Name.
1262+
* @property {string} replyToEmail Email set in the Reply To field for the mail. Default value is Sender Email.
1263+
* @property {boolean} overrideForCli
1264+
* @property {boolean} parseOutput
1265+
* @property {libClient | undefined} sdk
1266+
*/
1267+
1268+
/**
1269+
* @param {MessagingUpdateResendProviderRequestParams} params
1270+
*/
1271+
const messagingUpdateResendProvider = async ({providerId,name,enabled,apiKey,fromName,fromEmail,replyToName,replyToEmail,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1272+
let client = !sdk ? await sdkForProject() :
1273+
sdk;
1274+
let apiPath = '/messaging/providers/resend/{providerId}'.replace('{providerId}', providerId);
1275+
let payload = {};
1276+
if (typeof name !== 'undefined') {
1277+
payload['name'] = name;
1278+
}
1279+
if (typeof enabled !== 'undefined') {
1280+
payload['enabled'] = enabled;
1281+
}
1282+
if (typeof apiKey !== 'undefined') {
1283+
payload['apiKey'] = apiKey;
1284+
}
1285+
if (typeof fromName !== 'undefined') {
1286+
payload['fromName'] = fromName;
1287+
}
1288+
if (typeof fromEmail !== 'undefined') {
1289+
payload['fromEmail'] = fromEmail;
1290+
}
1291+
if (typeof replyToName !== 'undefined') {
1292+
payload['replyToName'] = replyToName;
1293+
}
1294+
if (typeof replyToEmail !== 'undefined') {
1295+
payload['replyToEmail'] = replyToEmail;
1296+
}
1297+
1298+
let response = undefined;
1299+
1300+
response = await client.call('patch', apiPath, {
1301+
'content-type': 'application/json',
1302+
}, payload);
1303+
1304+
if (parseOutput) {
1305+
parse(response)
1306+
}
1307+
1308+
return response;
1309+
11911310
}
11921311
/**
11931312
* @typedef {Object} MessagingCreateSendgridProviderRequestParams
@@ -2619,6 +2738,32 @@ messaging
26192738
.option(`--auth-key <auth-key>`, `Msg91 auth key.`)
26202739
.action(actionRunner(messagingUpdateMsg91Provider))
26212740

2741+
messaging
2742+
.command(`create-resend-provider`)
2743+
.description(`Create a new Resend provider.`)
2744+
.requiredOption(`--provider-id <provider-id>`, `Provider ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
2745+
.requiredOption(`--name <name>`, `Provider name.`)
2746+
.option(`--api-key <api-key>`, `Resend API key.`)
2747+
.option(`--from-name <from-name>`, `Sender Name.`)
2748+
.option(`--from-email <from-email>`, `Sender email address.`)
2749+
.option(`--reply-to-name <reply-to-name>`, `Name set in the reply to field for the mail. Default value is sender name.`)
2750+
.option(`--reply-to-email <reply-to-email>`, `Email set in the reply to field for the mail. Default value is sender email.`)
2751+
.option(`--enabled [value]`, `Set as enabled.`, (value) => value === undefined ? true : parseBool(value))
2752+
.action(actionRunner(messagingCreateResendProvider))
2753+
2754+
messaging
2755+
.command(`update-resend-provider`)
2756+
.description(`Update a Resend provider by its unique ID.`)
2757+
.requiredOption(`--provider-id <provider-id>`, `Provider ID.`)
2758+
.option(`--name <name>`, `Provider name.`)
2759+
.option(`--enabled [value]`, `Set as enabled.`, (value) => value === undefined ? true : parseBool(value))
2760+
.option(`--api-key <api-key>`, `Resend API key.`)
2761+
.option(`--from-name <from-name>`, `Sender Name.`)
2762+
.option(`--from-email <from-email>`, `Sender email address.`)
2763+
.option(`--reply-to-name <reply-to-name>`, `Name set in the Reply To field for the mail. Default value is Sender Name.`)
2764+
.option(`--reply-to-email <reply-to-email>`, `Email set in the Reply To field for the mail. Default value is Sender Email.`)
2765+
.action(actionRunner(messagingUpdateResendProvider))
2766+
26222767
messaging
26232768
.command(`create-sendgrid-provider`)
26242769
.description(`Create a new Sendgrid provider.`)
@@ -2895,6 +3040,8 @@ module.exports = {
28953040
messagingUpdateMailgunProvider,
28963041
messagingCreateMsg91Provider,
28973042
messagingUpdateMsg91Provider,
3043+
messagingCreateResendProvider,
3044+
messagingUpdateResendProvider,
28983045
messagingCreateSendgridProvider,
28993046
messagingUpdateSendgridProvider,
29003047
messagingCreateSMTPProvider,

0 commit comments

Comments
 (0)