shipmail-cli 0.4.12 → 0.4.14
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/dist/cli.js +72 -1
- package/package.json +2 -2
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.14";
|
|
18
18
|
|
|
19
19
|
// src/cli.ts
|
|
20
20
|
var DEFAULT_BASE_URL = "https://shipmail.to/api/v1";
|
|
@@ -371,9 +371,13 @@ Usage:
|
|
|
371
371
|
shipmail mailboxes forwarding <id>
|
|
372
372
|
shipmail mailboxes forwarding-add <id> --destination owner@example.com
|
|
373
373
|
shipmail mailboxes forwarding-remove <id> <forwarding-id>
|
|
374
|
+
shipmail mailboxes delivery-routing <id>
|
|
375
|
+
shipmail mailboxes delivery-routing-set <id> --mode keep|fixed|round-robin [--destination-mailbox-id mbx_...] [--fallback-mailbox-id mbx_...]
|
|
374
376
|
shipmail mailboxes prepare-attachment-upload <id> <file> [--filename name] [--content-type type]
|
|
375
377
|
shipmail mailboxes stage-attachment <id> <file> [--filename name] [--content-type type]
|
|
376
378
|
shipmail mailboxes sandbox-inbound <id> --from sender@example.com --subject "Test" (--text "Hello" | --html "<p>Hello</p>") [--to support@example.com]
|
|
379
|
+
shipmail members list [--limit 25] [--cursor cur]
|
|
380
|
+
shipmail members get <id>
|
|
377
381
|
shipmail inbox list <mailbox-id> [--folder-role inbox] [--search text] [--after ISO] [--before ISO] [--limit 25] [--cursor cur]
|
|
378
382
|
shipmail inbox message <mailbox-id> <message-id>
|
|
379
383
|
shipmail inbox threads <mailbox-id> [--attention-state needs_reply] [--after ISO] [--before ISO] [--limit 25] [--cursor cur]
|
|
@@ -846,6 +850,53 @@ async function runMailboxes(client, parsed, out) {
|
|
|
846
850
|
writeJson(out, { ok: true, id: forwardingId });
|
|
847
851
|
return;
|
|
848
852
|
}
|
|
853
|
+
if (subcommand === "delivery-routing") {
|
|
854
|
+
writeJson(
|
|
855
|
+
out,
|
|
856
|
+
await client.mailboxes.getDeliveryRouting(
|
|
857
|
+
requirePositional(parsed.positional, 2, "mailbox id")
|
|
858
|
+
)
|
|
859
|
+
);
|
|
860
|
+
return;
|
|
861
|
+
}
|
|
862
|
+
if (subcommand === "delivery-routing-set") {
|
|
863
|
+
const mailboxId = requirePositional(parsed.positional, 2, "mailbox id");
|
|
864
|
+
const mode = getRequiredString(parsed.options, "mode");
|
|
865
|
+
const destinationMailboxIds = getStringList(parsed.options, "destination-mailbox-id");
|
|
866
|
+
let params;
|
|
867
|
+
if (mode === "keep") {
|
|
868
|
+
if (destinationMailboxIds.length > 0 || getString(parsed.options, "fallback-mailbox-id")) {
|
|
869
|
+
throw new CliUsageError(
|
|
870
|
+
"--destination-mailbox-id and --fallback-mailbox-id cannot be used with --mode keep."
|
|
871
|
+
);
|
|
872
|
+
}
|
|
873
|
+
params = { mode: "keep" };
|
|
874
|
+
} else if (mode === "fixed") {
|
|
875
|
+
if (destinationMailboxIds.length !== 1) {
|
|
876
|
+
throw new CliUsageError("--mode fixed requires exactly one --destination-mailbox-id.");
|
|
877
|
+
}
|
|
878
|
+
params = {
|
|
879
|
+
mode: "fixed",
|
|
880
|
+
destination_mailbox_id: destinationMailboxIds[0],
|
|
881
|
+
fallback_mailbox_id: getRequiredString(parsed.options, "fallback-mailbox-id")
|
|
882
|
+
};
|
|
883
|
+
} else if (mode === "round-robin") {
|
|
884
|
+
if (destinationMailboxIds.length < 2) {
|
|
885
|
+
throw new CliUsageError(
|
|
886
|
+
"--mode round-robin requires at least two --destination-mailbox-id values."
|
|
887
|
+
);
|
|
888
|
+
}
|
|
889
|
+
params = {
|
|
890
|
+
mode: "round_robin",
|
|
891
|
+
destination_mailbox_ids: destinationMailboxIds,
|
|
892
|
+
fallback_mailbox_id: getRequiredString(parsed.options, "fallback-mailbox-id")
|
|
893
|
+
};
|
|
894
|
+
} else {
|
|
895
|
+
throw new CliUsageError("--mode must be keep, fixed, or round-robin.");
|
|
896
|
+
}
|
|
897
|
+
writeJson(out, await client.mailboxes.updateDeliveryRouting(mailboxId, params));
|
|
898
|
+
return;
|
|
899
|
+
}
|
|
849
900
|
if (subcommand === "stage-attachment") {
|
|
850
901
|
const mailboxId = requirePositional(parsed.positional, 2, "mailbox id");
|
|
851
902
|
const filePath = requirePositional(parsed.positional, 3, "file");
|
|
@@ -1268,6 +1319,25 @@ async function runWebhooks(client, parsed, out) {
|
|
|
1268
1319
|
}
|
|
1269
1320
|
throw new CliUsageError("Unknown webhooks command.");
|
|
1270
1321
|
}
|
|
1322
|
+
async function runMembers(client, parsed, out) {
|
|
1323
|
+
const subcommand = parsed.positional[1];
|
|
1324
|
+
if (subcommand === "list") {
|
|
1325
|
+
writeJson(
|
|
1326
|
+
out,
|
|
1327
|
+
await client.members.list({
|
|
1328
|
+
cursor: getString(parsed.options, "cursor"),
|
|
1329
|
+
limit: getNumber(parsed.options, "limit")
|
|
1330
|
+
})
|
|
1331
|
+
);
|
|
1332
|
+
return;
|
|
1333
|
+
}
|
|
1334
|
+
const memberId = requirePositional(parsed.positional, 2, "member id");
|
|
1335
|
+
if (subcommand === "get") {
|
|
1336
|
+
writeJson(out, await client.members.get(memberId));
|
|
1337
|
+
return;
|
|
1338
|
+
}
|
|
1339
|
+
throw new CliUsageError("Unknown members command.");
|
|
1340
|
+
}
|
|
1271
1341
|
async function runSuppressions(client, parsed, out) {
|
|
1272
1342
|
const subcommand = parsed.positional[1];
|
|
1273
1343
|
if (subcommand === "list") {
|
|
@@ -2175,6 +2245,7 @@ async function runCli(argv, options = {}) {
|
|
|
2175
2245
|
if (command === "automations") await runAutomations(client, parsed, out);
|
|
2176
2246
|
else if (command === "domains") await runDomains(client, parsed, out);
|
|
2177
2247
|
else if (command === "mailboxes") await runMailboxes(client, parsed, out);
|
|
2248
|
+
else if (command === "members") await runMembers(client, parsed, out);
|
|
2178
2249
|
else if (command === "inbox") await runInbox(client, parsed, out);
|
|
2179
2250
|
else if (command === "messages") await runMessages(client, parsed, out);
|
|
2180
2251
|
else if (command === "scheduled-messages") await runScheduledMessages(client, parsed, out);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shipmail-cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.14",
|
|
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.23"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"tsup": "^8.4.0",
|