@trycourier/cli
Advanced tools
Comparing version 1.4.1 to 1.5.0
@@ -8,6 +8,6 @@ import React from 'react'; | ||
if (!params?.apikey) { | ||
return React.createElement(UhOh, { text: "You must specify your API key using --apikey <your-api-key>" }); | ||
return (React.createElement(UhOh, { text: "You must specify your API key using --apikey <your-api-key>" })); | ||
} | ||
if (fs.existsSync(FILE_PATH) && !params.overwrite) { | ||
return React.createElement(UhOh, { text: `${FILE_PATH} already exists. Consider adding the --overwrite option` }); | ||
return (React.createElement(UhOh, { text: `${FILE_PATH} already exists. Consider adding the --overwrite option` })); | ||
} | ||
@@ -14,0 +14,0 @@ fs.writeFileSync(FILE_PATH, `COURIER_API_KEY=${params.apikey}\n`); |
@@ -12,3 +12,3 @@ import React from 'react'; | ||
React.createElement(Text, { bold: true }, props.request.method), | ||
' ', | ||
" ", | ||
url)), | ||
@@ -15,0 +15,0 @@ props.request.body ? (typeof props.request.body === 'string' ? (React.createElement(Text, null, props.request.body)) : (React.createElement(Text, null, JSON.stringify(props.request.body, undefined, ' ')))) : null, |
@@ -18,3 +18,3 @@ import React from 'react'; | ||
else { | ||
return React.createElement(React.Fragment, null, | ||
return (React.createElement(React.Fragment, null, | ||
React.createElement(Text, { bold: true, color: "red" }, "No COURIER_API_KEY specified, please set via one of these options:"), | ||
@@ -24,3 +24,3 @@ React.createElement(Text, { bold: true, color: "red" }, "\u2022 running \"courier config --apikey <your-api-key>\""), | ||
React.createElement(Text, { bold: true, color: "red" }, "\u2022 setting COURIER_API_KEY in a \".courier\" file in your current working directory"), | ||
React.createElement(Text, { bold: true, color: "red" }, "\u2022 setting COURIER_API_KEY in a \".courier\" file in your user's home directory")); | ||
React.createElement(Text, { bold: true, color: "red" }, "\u2022 setting COURIER_API_KEY in a \".courier\" file in your user's home directory"))); | ||
} | ||
@@ -27,0 +27,0 @@ } |
@@ -6,2 +6,4 @@ import React from 'react'; | ||
import Track from './commands/Track.js'; | ||
import UsersGet from './commands/UsersGet.js'; | ||
import UsersSet from './commands/UsersSet.js'; | ||
import Send from './commands/Send.js'; | ||
@@ -16,3 +18,3 @@ import DigestFlush from './commands/DigestFlush.js'; | ||
}, | ||
noApiKeyRequired: true | ||
noApiKeyRequired: true, | ||
}); | ||
@@ -35,3 +37,3 @@ mappings.set('config', { | ||
example: `courier config --apikey MY_API_KEY`, | ||
noApiKeyRequired: true | ||
noApiKeyRequired: true, | ||
}); | ||
@@ -122,2 +124,32 @@ mappings.set('whoami', { | ||
}); | ||
mappings.set('users:get', { | ||
params: '<user>', | ||
instructions: 'Fetch the data for a given user ID', | ||
example: `courier users:get user123`, | ||
component: params => { | ||
return React.createElement(UsersGet, { params: params }); | ||
}, | ||
}); | ||
mappings.set('users:set', { | ||
params: '<user>', | ||
instructions: "Overwrite a user's profile with the provided data", | ||
options: [ | ||
{ | ||
option: '--email <email address>', | ||
value: '', | ||
}, | ||
{ | ||
option: '--tel <phone number>', | ||
value: '', | ||
}, | ||
{ | ||
option: '--<key> <value>', | ||
value: 'arbitrary key/value properties for your user', | ||
}, | ||
], | ||
example: `courier users:set user123 --email user@example.com`, | ||
component: params => { | ||
return React.createElement(UsersSet, { params: params }); | ||
}, | ||
}); | ||
mappings.set('digests:flush', { | ||
@@ -124,0 +156,0 @@ params: '<user> <digest>', |
{ | ||
"name": "@trycourier/cli", | ||
"version": "1.4.1", | ||
"version": "1.5.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "bin": { |
@@ -46,2 +46,4 @@ # Courier CLI | ||
- `courier track` - Send a track event to trigger a Courier Automations | ||
- `courier users:get` - Fetch the data for a given user ID | ||
- `courier users:set` - Overwrite a user's profile with the provided data | ||
- `courier digests:flush` – Flush any currently queued events for a given user + digest | ||
@@ -64,2 +66,5 @@ - `courier translations:upload` - Upload .PO files to your Courier workspace | ||
$ courier users:get user123 | ||
$ courier users:set user123 --email user@example.com --tel 555-867-5309 | ||
$ courier digests:flush user123 my-digest-id | ||
@@ -66,0 +71,0 @@ |
51596
79
1333
81