shipmail-cli 0.4.1 → 0.4.4

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.
Files changed (3) hide show
  1. package/README.md +15 -3
  2. package/dist/cli.js +87 -10
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -97,11 +97,11 @@ shipmail reply-scans create --mailbox-id 550e8400-e29b-41d4-a716-446655440000 --
97
97
  shipmail reply-scans status rsc_123
98
98
  shipmail reply-scans results rsc_123 --limit 100
99
99
 
100
- # Find newsletter sending domain IDs, then create a draft with blocks
101
- shipmail newsletter-domains list
100
+ # Find reusable sender identity IDs, then create a draft with blocks
101
+ shipmail newsletter-sender-identities list
102
102
  shipmail newsletters create \
103
103
  --audience-id aud_123 \
104
- --newsletter-domain-id nwsdom_456 \
104
+ --sender-identity-id nwsid_456 \
105
105
  --name "July changelog" \
106
106
  --subject "What shipped in July" \
107
107
  --blocks @blocks.json
@@ -159,6 +159,10 @@ Use repeatable `--header "Name: value"` flags for request headers. Use `--output
159
159
  - `mailboxes sandbox-inbound`
160
160
  - `webhooks list|create|test|deliveries|replay-delivery`
161
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`
165
+ - `newsletter-sender-identities list`
162
166
  - `newsletter-domains list`
163
167
  - `newsletters create|update|preview|preflight|test-send|schedule|cancel|resume`
164
168
  - `newsletter-assets list|upload|register-url`
@@ -166,4 +170,12 @@ Use repeatable `--header "Name: value"` flags for request headers. Use `--output
166
170
  - `partner credential-grants list|consume`
167
171
  - `partner usage`
168
172
 
173
+ Configure a publisher-owned Atom self URL and the number of recent issues:
174
+
175
+ ```bash
176
+ shipmail audiences feed update aud_123 \
177
+ --canonical-url https://example.com/feed.xml \
178
+ --entry-limit 25
179
+ ```
180
+
169
181
  Run `shipmail --help` for flags and examples.
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.1";
17
+ var VERSION = "0.4.4";
18
18
 
19
19
  // src/cli.ts
20
20
  var DEFAULT_BASE_URL = "https://shipmail.to/api/v1";
@@ -187,7 +187,7 @@ function parseStylingMode(options) {
187
187
  }
188
188
  async function newsletterCreateParams(options) {
189
189
  const audience_id = getRequiredString(options, "audience-id");
190
- const newsletter_domain_id = getRequiredString(options, "newsletter-domain-id");
190
+ const sender_identity_id = getRequiredString(options, "sender-identity-id");
191
191
  const name = getRequiredString(options, "name");
192
192
  const subject = getRequiredString(options, "subject");
193
193
  const blocksInput = getString(options, "blocks");
@@ -203,14 +203,12 @@ async function newsletterCreateParams(options) {
203
203
  const archive_visibility = parseArchiveVisibility(options);
204
204
  const styling_mode = parseStylingMode(options);
205
205
  const preview_text = getString(options, "preview-text");
206
- const from_name = getString(options, "from-name");
207
206
  return {
208
207
  audience_id,
209
- newsletter_domain_id,
208
+ sender_identity_id,
210
209
  name,
211
210
  subject,
212
211
  ...preview_text !== void 0 ? { preview_text } : {},
213
- ...from_name !== void 0 ? { from_name } : {},
214
212
  ...blocks ? { blocks } : {},
215
213
  ...body_html !== void 0 ? { body_html } : {},
216
214
  ...body_text !== void 0 ? { body_text } : {},
@@ -221,11 +219,10 @@ async function newsletterCreateParams(options) {
221
219
  }
222
220
  async function newsletterUpdateParams(options) {
223
221
  const audience_id = getString(options, "audience-id");
224
- const newsletter_domain_id = getString(options, "newsletter-domain-id");
222
+ const sender_identity_id = getString(options, "sender-identity-id");
225
223
  const name = getString(options, "name");
226
224
  const subject = getString(options, "subject");
227
225
  const preview_text = getString(options, "preview-text");
228
- const from_name = getString(options, "from-name");
229
226
  const send_window_hours = getNumber(options, "send-window-hours");
230
227
  const archive_visibility = parseArchiveVisibility(options);
231
228
  const styling_mode = parseStylingMode(options);
@@ -237,11 +234,10 @@ async function newsletterUpdateParams(options) {
237
234
  const body_text = bodyTextInput ? await readTextInput(bodyTextInput) : void 0;
238
235
  const params = {
239
236
  ...audience_id ? { audience_id } : {},
240
- ...newsletter_domain_id ? { newsletter_domain_id } : {},
237
+ ...sender_identity_id ? { sender_identity_id } : {},
241
238
  ...name ? { name } : {},
242
239
  ...subject ? { subject } : {},
243
240
  ...preview_text !== void 0 ? { preview_text } : {},
244
- ...from_name !== void 0 ? { from_name } : {},
245
241
  ...blocks ? { blocks } : {},
246
242
  ...body_html !== void 0 ? { body_html } : {},
247
243
  ...body_text !== void 0 ? { body_text } : {},
@@ -383,7 +379,7 @@ Usage:
383
379
  shipmail suppressions remove <email>
384
380
  shipmail newsletters create \\
385
381
  --audience-id aud_123 \\
386
- --newsletter-domain-id nwsdom_456 \\
382
+ --sender-identity-id nwsid_456 \\
387
383
  --name "July changelog" \\
388
384
  --subject "What shipped in July" \\
389
385
  --blocks @blocks.json \\
@@ -398,12 +394,17 @@ Usage:
398
394
  shipmail newsletter-assets list [--kind image|video] [--q text] [--limit 25] [--cursor cur]
399
395
  shipmail newsletter-assets upload <file> [--filename name] [--content-type type]
400
396
  shipmail newsletter-assets register-url <url> [--filename name] [--thumbnail-url url]
397
+ shipmail newsletter-sender-identities list [--limit 25] [--cursor cur]
401
398
  shipmail newsletter-domains list [--limit 25] [--cursor cur]
402
399
  shipmail audiences list [--limit 25] [--cursor cur]
403
400
  shipmail audiences create <name> --consent-source "Signup form" [--description "..."]
404
401
  shipmail audiences get <id>
405
402
  shipmail audiences update <id> [--name "..."] [--description "..."]
406
403
  shipmail audiences delete <id>
404
+ shipmail audiences feed get <audience-id>
405
+ shipmail audiences feed update <audience-id> [--enabled true|false] [--title "..."] [--subtitle "..."] [--site-url https://...] [--canonical-url https://...] [--author-name "..."] [--icon-url https://...] [--entry-limit 10..100] [--idempotency-key key]
406
+ shipmail audiences feed rotate <audience-id> [--idempotency-key key]
407
+ shipmail audiences feed revoke <audience-id> [--idempotency-key key]
407
408
  shipmail audiences subscribers add <audience-id> <email> [--name "Jane"] [--consent-source "..."]
408
409
  shipmail audiences subscribers list <audience-id> [--status subscribed] [--email jane@x.com] [--limit 25]
409
410
  shipmail audiences subscribers get <audience-id> <subscriber-id>
@@ -1326,12 +1327,72 @@ async function runSubscribers(client, parsed, out) {
1326
1327
  }
1327
1328
  throw new CliUsageError("Unknown audiences subscribers command.");
1328
1329
  }
1330
+ function audienceFeedUpdateParams(options) {
1331
+ const enabled = getBoolean(options, "enabled");
1332
+ const title = getString(options, "title");
1333
+ const subtitle = getString(options, "subtitle");
1334
+ const siteUrl = getString(options, "site-url");
1335
+ const canonicalUrl = getString(options, "canonical-url");
1336
+ const authorName = getString(options, "author-name");
1337
+ const iconUrl = getString(options, "icon-url");
1338
+ const entryLimit = getNumber(options, "entry-limit");
1339
+ if (entryLimit !== void 0 && (entryLimit < 10 || entryLimit > 100)) {
1340
+ throw new CliUsageError("--entry-limit must be between 10 and 100.");
1341
+ }
1342
+ if (enabled === void 0 && title === void 0 && subtitle === void 0 && siteUrl === void 0 && canonicalUrl === void 0 && authorName === void 0 && iconUrl === void 0 && entryLimit === void 0) {
1343
+ throw new CliUsageError("Provide at least one feed setting to update.");
1344
+ }
1345
+ return {
1346
+ ...enabled !== void 0 ? { enabled } : {},
1347
+ ...title !== void 0 ? { title } : {},
1348
+ ...subtitle !== void 0 ? { subtitle } : {},
1349
+ ...siteUrl !== void 0 ? { site_url: siteUrl } : {},
1350
+ ...canonicalUrl !== void 0 ? { canonical_url: canonicalUrl } : {},
1351
+ ...authorName !== void 0 ? { author_name: authorName } : {},
1352
+ ...iconUrl !== void 0 ? { icon_url: iconUrl } : {},
1353
+ ...entryLimit !== void 0 ? { entry_limit: entryLimit } : {}
1354
+ };
1355
+ }
1356
+ async function runAudienceFeed(client, parsed, out) {
1357
+ const action = parsed.positional[2];
1358
+ const audienceId = requirePositional(parsed.positional, 3, "audience id");
1359
+ if (action === "get") {
1360
+ writeJson(out, await client.audiences.feeds.get(audienceId));
1361
+ return;
1362
+ }
1363
+ const idempotencyKey = getString(parsed.options, "idempotency-key");
1364
+ const methodOptions = idempotencyKey ? { idempotencyKey } : void 0;
1365
+ if (action === "update") {
1366
+ writeJson(
1367
+ out,
1368
+ await client.audiences.feeds.update(
1369
+ audienceId,
1370
+ audienceFeedUpdateParams(parsed.options),
1371
+ methodOptions
1372
+ )
1373
+ );
1374
+ return;
1375
+ }
1376
+ if (action === "rotate") {
1377
+ writeJson(out, await client.audiences.feeds.rotate(audienceId, methodOptions));
1378
+ return;
1379
+ }
1380
+ if (action === "revoke") {
1381
+ writeJson(out, await client.audiences.feeds.revoke(audienceId, methodOptions));
1382
+ return;
1383
+ }
1384
+ throw new CliUsageError("Unknown audiences feed command.");
1385
+ }
1329
1386
  async function runAudiences(client, parsed, out) {
1330
1387
  const subcommand = parsed.positional[1];
1331
1388
  if (subcommand === "subscribers") {
1332
1389
  await runSubscribers(client, parsed, out);
1333
1390
  return;
1334
1391
  }
1392
+ if (subcommand === "feed") {
1393
+ await runAudienceFeed(client, parsed, out);
1394
+ return;
1395
+ }
1335
1396
  if (subcommand === "list") {
1336
1397
  writeJson(
1337
1398
  out,
@@ -1396,6 +1457,20 @@ async function runNewsletterDomains(client, parsed, out) {
1396
1457
  }
1397
1458
  throw new CliUsageError("Unknown newsletter-domains command.");
1398
1459
  }
1460
+ async function runNewsletterSenderIdentities(client, parsed, out) {
1461
+ const subcommand = parsed.positional[1];
1462
+ if (subcommand === "list") {
1463
+ writeJson(
1464
+ out,
1465
+ await client.newsletters.senderIdentities.list({
1466
+ cursor: getString(parsed.options, "cursor"),
1467
+ limit: getNumber(parsed.options, "limit")
1468
+ })
1469
+ );
1470
+ return;
1471
+ }
1472
+ throw new CliUsageError("Unknown newsletter-sender-identities command.");
1473
+ }
1399
1474
  async function runNewsletters(client, parsed, out) {
1400
1475
  const subcommand = parsed.positional[1];
1401
1476
  if (subcommand === "create") {
@@ -1916,6 +1991,8 @@ async function runCli(argv, options = {}) {
1916
1991
  else if (command === "suppressions") await runSuppressions(client, parsed, out);
1917
1992
  else if (command === "newsletters") await runNewsletters(client, parsed, out);
1918
1993
  else if (command === "newsletter-assets") await runNewsletterAssets(client, parsed, out);
1994
+ else if (command === "newsletter-sender-identities")
1995
+ await runNewsletterSenderIdentities(client, parsed, out);
1919
1996
  else if (command === "newsletter-domains") await runNewsletterDomains(client, parsed, out);
1920
1997
  else if (command === "audiences") await runAudiences(client, parsed, out);
1921
1998
  else if (command === "calendar") await runCalendar(client, parsed, out);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shipmail-cli",
3
- "version": "0.4.1",
3
+ "version": "0.4.4",
4
4
  "description": "Official CLI for the ShipMail API",
5
5
  "type": "module",
6
6
  "bin": {
@@ -31,7 +31,7 @@
31
31
  "homepage": "https://shipmail.to/docs/cli",
32
32
  "repository": {
33
33
  "type": "git",
34
- "url": "git+https://github.com/jcoulaud/ShipMail.git",
34
+ "url": "git+https://github.com/shipmail-to/Shipmail.git",
35
35
  "directory": "packages/shipmail-cli"
36
36
  },
37
37
  "engines": {
@@ -41,7 +41,7 @@
41
41
  "access": "public"
42
42
  },
43
43
  "dependencies": {
44
- "shipmail": "0.4.4"
44
+ "shipmail": "0.4.9"
45
45
  },
46
46
  "devDependencies": {
47
47
  "tsup": "^8.4.0",