shipmail-cli 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/cli.js +84 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -34,6 +34,7 @@ shipmail mailboxes resume mbx_123
|
|
|
34
34
|
shipmail mailboxes forwarding-add mbx_123 --destination owner@example.net
|
|
35
35
|
shipmail mailboxes forwarding mbx_123
|
|
36
36
|
shipmail mailboxes forwarding-remove mbx_123 fwd_123
|
|
37
|
+
shipmail mailboxes rules mbx_123
|
|
37
38
|
shipmail mailboxes app-passwords list mbx_123
|
|
38
39
|
shipmail mailboxes app-passwords create mbx_123 --name "Desktop mail" --expires-at 2026-10-01T00:00:00Z
|
|
39
40
|
shipmail mailboxes app-passwords revoke mbx_123 appwd_123
|
|
@@ -158,6 +159,9 @@ Use repeatable `--header "Name: value"` flags for request headers. Use `--output
|
|
|
158
159
|
- `mailboxes sandbox-inbound`
|
|
159
160
|
- `webhooks list|create|test|deliveries|replay-delivery`
|
|
160
161
|
- `suppressions list|remove`
|
|
162
|
+
- `audiences list|create|get|update|delete`
|
|
163
|
+
- `audiences feed get|update|rotate|revoke`
|
|
164
|
+
- `audiences subscribers add|list|get|by-email|update|unsubscribe|resubscribe|remove`
|
|
161
165
|
- `newsletter-domains list`
|
|
162
166
|
- `newsletters create|update|preview|preflight|test-send|schedule|cancel|resume`
|
|
163
167
|
- `newsletter-assets list|upload|register-url`
|
package/dist/cli.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "shipmail";
|
|
15
15
|
|
|
16
16
|
// src/version.ts
|
|
17
|
-
var VERSION = "0.4.
|
|
17
|
+
var VERSION = "0.4.2";
|
|
18
18
|
|
|
19
19
|
// src/cli.ts
|
|
20
20
|
var DEFAULT_BASE_URL = "https://shipmail.to/api/v1";
|
|
@@ -179,6 +179,12 @@ function parseArchiveVisibility(options) {
|
|
|
179
179
|
if (value === "private" || value === "public") return value;
|
|
180
180
|
throw new CliUsageError("--archive-visibility must be private or public.");
|
|
181
181
|
}
|
|
182
|
+
function parseStylingMode(options) {
|
|
183
|
+
const value = getString(options, "styling-mode");
|
|
184
|
+
if (value === void 0) return void 0;
|
|
185
|
+
if (value === "styled" || value === "plain") return value;
|
|
186
|
+
throw new CliUsageError("--styling-mode must be styled or plain.");
|
|
187
|
+
}
|
|
182
188
|
async function newsletterCreateParams(options) {
|
|
183
189
|
const audience_id = getRequiredString(options, "audience-id");
|
|
184
190
|
const newsletter_domain_id = getRequiredString(options, "newsletter-domain-id");
|
|
@@ -195,6 +201,7 @@ async function newsletterCreateParams(options) {
|
|
|
195
201
|
}
|
|
196
202
|
const send_window_hours = getNumber(options, "send-window-hours");
|
|
197
203
|
const archive_visibility = parseArchiveVisibility(options);
|
|
204
|
+
const styling_mode = parseStylingMode(options);
|
|
198
205
|
const preview_text = getString(options, "preview-text");
|
|
199
206
|
const from_name = getString(options, "from-name");
|
|
200
207
|
return {
|
|
@@ -208,7 +215,8 @@ async function newsletterCreateParams(options) {
|
|
|
208
215
|
...body_html !== void 0 ? { body_html } : {},
|
|
209
216
|
...body_text !== void 0 ? { body_text } : {},
|
|
210
217
|
...send_window_hours !== void 0 ? { send_window_hours } : {},
|
|
211
|
-
...archive_visibility !== void 0 ? { archive_visibility } : {}
|
|
218
|
+
...archive_visibility !== void 0 ? { archive_visibility } : {},
|
|
219
|
+
...styling_mode !== void 0 ? { styling_mode } : {}
|
|
212
220
|
};
|
|
213
221
|
}
|
|
214
222
|
async function newsletterUpdateParams(options) {
|
|
@@ -220,6 +228,7 @@ async function newsletterUpdateParams(options) {
|
|
|
220
228
|
const from_name = getString(options, "from-name");
|
|
221
229
|
const send_window_hours = getNumber(options, "send-window-hours");
|
|
222
230
|
const archive_visibility = parseArchiveVisibility(options);
|
|
231
|
+
const styling_mode = parseStylingMode(options);
|
|
223
232
|
const blocksInput = getString(options, "blocks");
|
|
224
233
|
const bodyHtmlInput = getString(options, "body-html");
|
|
225
234
|
const bodyTextInput = getString(options, "body-text");
|
|
@@ -237,7 +246,8 @@ async function newsletterUpdateParams(options) {
|
|
|
237
246
|
...body_html !== void 0 ? { body_html } : {},
|
|
238
247
|
...body_text !== void 0 ? { body_text } : {},
|
|
239
248
|
...send_window_hours !== void 0 ? { send_window_hours } : {},
|
|
240
|
-
...archive_visibility !== void 0 ? { archive_visibility } : {}
|
|
249
|
+
...archive_visibility !== void 0 ? { archive_visibility } : {},
|
|
250
|
+
...styling_mode !== void 0 ? { styling_mode } : {}
|
|
241
251
|
};
|
|
242
252
|
if (Object.keys(params).length === 0) {
|
|
243
253
|
throw new CliUsageError("Provide at least one field to update.");
|
|
@@ -337,6 +347,7 @@ Usage:
|
|
|
337
347
|
shipmail mailboxes app-passwords revoke <id> <app-password-id>
|
|
338
348
|
shipmail mailboxes folders <id>
|
|
339
349
|
shipmail mailboxes identities <id>
|
|
350
|
+
shipmail mailboxes rules <id>
|
|
340
351
|
shipmail mailboxes forwarding <id>
|
|
341
352
|
shipmail mailboxes forwarding-add <id> --destination owner@example.com
|
|
342
353
|
shipmail mailboxes forwarding-remove <id> <forwarding-id>
|
|
@@ -375,8 +386,9 @@ Usage:
|
|
|
375
386
|
--newsletter-domain-id nwsdom_456 \\
|
|
376
387
|
--name "July changelog" \\
|
|
377
388
|
--subject "What shipped in July" \\
|
|
378
|
-
--blocks @blocks.json
|
|
379
|
-
|
|
389
|
+
--blocks @blocks.json \\
|
|
390
|
+
[--styling-mode styled|plain]
|
|
391
|
+
shipmail newsletters update nws_789 --subject "Updated subject" --blocks @blocks-v2.json [--styling-mode styled|plain]
|
|
380
392
|
shipmail newsletters preview <id>
|
|
381
393
|
shipmail newsletters preflight <id>
|
|
382
394
|
shipmail newsletters test-send <id> --recipient-email owner@example.com
|
|
@@ -392,6 +404,10 @@ Usage:
|
|
|
392
404
|
shipmail audiences get <id>
|
|
393
405
|
shipmail audiences update <id> [--name "..."] [--description "..."]
|
|
394
406
|
shipmail audiences delete <id>
|
|
407
|
+
shipmail audiences feed get <audience-id>
|
|
408
|
+
shipmail audiences feed update <audience-id> [--enabled true|false] [--title "..."] [--subtitle "..."] [--site-url https://...] [--author-name "..."] [--icon-url https://...] [--idempotency-key key]
|
|
409
|
+
shipmail audiences feed rotate <audience-id> [--idempotency-key key]
|
|
410
|
+
shipmail audiences feed revoke <audience-id> [--idempotency-key key]
|
|
395
411
|
shipmail audiences subscribers add <audience-id> <email> [--name "Jane"] [--consent-source "..."]
|
|
396
412
|
shipmail audiences subscribers list <audience-id> [--status subscribed] [--email jane@x.com] [--limit 25]
|
|
397
413
|
shipmail audiences subscribers get <audience-id> <subscriber-id>
|
|
@@ -427,6 +443,9 @@ Booking page conferencing:
|
|
|
427
443
|
--conferencing-provider <zoom|google_meet> Create a meeting for every booking.
|
|
428
444
|
--conferencing-provider none Stop creating meeting links on update.
|
|
429
445
|
|
|
446
|
+
Newsletter styling:
|
|
447
|
+
--styling-mode <styled|plain> styled applies Shipmail's email theme. plain sends your HTML without injected styles, width, or centering, so the reader's email client styles it.
|
|
448
|
+
|
|
430
449
|
Global options:
|
|
431
450
|
--api-key <key> API key. Defaults to SHIPMAIL_API_KEY.
|
|
432
451
|
--base-url <url> API base URL. Defaults to SHIPMAIL_BASE_URL or ${DEFAULT_BASE_URL}.
|
|
@@ -744,6 +763,13 @@ async function runMailboxes(client, parsed, out) {
|
|
|
744
763
|
);
|
|
745
764
|
return;
|
|
746
765
|
}
|
|
766
|
+
if (subcommand === "rules") {
|
|
767
|
+
writeJson(
|
|
768
|
+
out,
|
|
769
|
+
await client.mailboxes.getRules(requirePositional(parsed.positional, 2, "mailbox id"))
|
|
770
|
+
);
|
|
771
|
+
return;
|
|
772
|
+
}
|
|
747
773
|
if (subcommand === "forwarding") {
|
|
748
774
|
writeJson(
|
|
749
775
|
out,
|
|
@@ -1304,12 +1330,65 @@ async function runSubscribers(client, parsed, out) {
|
|
|
1304
1330
|
}
|
|
1305
1331
|
throw new CliUsageError("Unknown audiences subscribers command.");
|
|
1306
1332
|
}
|
|
1333
|
+
function audienceFeedUpdateParams(options) {
|
|
1334
|
+
const enabled = getBoolean(options, "enabled");
|
|
1335
|
+
const title = getString(options, "title");
|
|
1336
|
+
const subtitle = getString(options, "subtitle");
|
|
1337
|
+
const siteUrl = getString(options, "site-url");
|
|
1338
|
+
const authorName = getString(options, "author-name");
|
|
1339
|
+
const iconUrl = getString(options, "icon-url");
|
|
1340
|
+
if (enabled === void 0 && title === void 0 && subtitle === void 0 && siteUrl === void 0 && authorName === void 0 && iconUrl === void 0) {
|
|
1341
|
+
throw new CliUsageError("Provide at least one feed setting to update.");
|
|
1342
|
+
}
|
|
1343
|
+
return {
|
|
1344
|
+
...enabled !== void 0 ? { enabled } : {},
|
|
1345
|
+
...title !== void 0 ? { title } : {},
|
|
1346
|
+
...subtitle !== void 0 ? { subtitle } : {},
|
|
1347
|
+
...siteUrl !== void 0 ? { site_url: siteUrl } : {},
|
|
1348
|
+
...authorName !== void 0 ? { author_name: authorName } : {},
|
|
1349
|
+
...iconUrl !== void 0 ? { icon_url: iconUrl } : {}
|
|
1350
|
+
};
|
|
1351
|
+
}
|
|
1352
|
+
async function runAudienceFeed(client, parsed, out) {
|
|
1353
|
+
const action = parsed.positional[2];
|
|
1354
|
+
const audienceId = requirePositional(parsed.positional, 3, "audience id");
|
|
1355
|
+
if (action === "get") {
|
|
1356
|
+
writeJson(out, await client.audiences.feeds.get(audienceId));
|
|
1357
|
+
return;
|
|
1358
|
+
}
|
|
1359
|
+
const idempotencyKey = getString(parsed.options, "idempotency-key");
|
|
1360
|
+
const methodOptions = idempotencyKey ? { idempotencyKey } : void 0;
|
|
1361
|
+
if (action === "update") {
|
|
1362
|
+
writeJson(
|
|
1363
|
+
out,
|
|
1364
|
+
await client.audiences.feeds.update(
|
|
1365
|
+
audienceId,
|
|
1366
|
+
audienceFeedUpdateParams(parsed.options),
|
|
1367
|
+
methodOptions
|
|
1368
|
+
)
|
|
1369
|
+
);
|
|
1370
|
+
return;
|
|
1371
|
+
}
|
|
1372
|
+
if (action === "rotate") {
|
|
1373
|
+
writeJson(out, await client.audiences.feeds.rotate(audienceId, methodOptions));
|
|
1374
|
+
return;
|
|
1375
|
+
}
|
|
1376
|
+
if (action === "revoke") {
|
|
1377
|
+
writeJson(out, await client.audiences.feeds.revoke(audienceId, methodOptions));
|
|
1378
|
+
return;
|
|
1379
|
+
}
|
|
1380
|
+
throw new CliUsageError("Unknown audiences feed command.");
|
|
1381
|
+
}
|
|
1307
1382
|
async function runAudiences(client, parsed, out) {
|
|
1308
1383
|
const subcommand = parsed.positional[1];
|
|
1309
1384
|
if (subcommand === "subscribers") {
|
|
1310
1385
|
await runSubscribers(client, parsed, out);
|
|
1311
1386
|
return;
|
|
1312
1387
|
}
|
|
1388
|
+
if (subcommand === "feed") {
|
|
1389
|
+
await runAudienceFeed(client, parsed, out);
|
|
1390
|
+
return;
|
|
1391
|
+
}
|
|
1313
1392
|
if (subcommand === "list") {
|
|
1314
1393
|
writeJson(
|
|
1315
1394
|
out,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shipmail-cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Official CLI for the ShipMail API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"shipmail": "0.4.
|
|
44
|
+
"shipmail": "0.4.6"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"tsup": "^8.4.0",
|