@myapihq/cli 1.0.15 → 1.0.16

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.
@@ -68,7 +68,7 @@ async function topup(amountStr, flags) {
68
68
  }
69
69
  async function setup(flags) {
70
70
  if (flags.help) {
71
- (0, output_js_1.info)('Usage: myapi billing setup\n\nGenerates a secure Stripe Checkout link to add or update your payment method.');
71
+ (0, output_js_1.info)('Usage: myapi billing setup\n\nGenerates a secure checkout link to add or update your payment method.');
72
72
  return;
73
73
  }
74
74
  const config = (0, config_js_1.requireConfig)();
@@ -1,7 +1,9 @@
1
1
  export declare function createMailbox(flags: Record<string, string | boolean>): Promise<void>;
2
2
  export declare function listMailboxes(flags: Record<string, string | boolean>): Promise<void>;
3
+ export declare function sent(flags: Record<string, string | boolean>): Promise<void>;
3
4
  export declare function send(flags: Record<string, string | boolean>): Promise<void>;
4
5
  export declare function inbox(address: string, flags: Record<string, string | boolean>): Promise<void>;
6
+ export declare function outbox(address: string, flags: Record<string, string | boolean>): Promise<void>;
5
7
  export declare function listTemplates(flags: Record<string, string | boolean>): Promise<void>;
6
8
  export declare function generateTemplate(flags: Record<string, string | boolean>): Promise<void>;
7
9
  export declare function listCampaigns(flags: Record<string, string | boolean>): Promise<void>;
@@ -2,8 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createMailbox = createMailbox;
4
4
  exports.listMailboxes = listMailboxes;
5
+ exports.sent = sent;
5
6
  exports.send = send;
6
7
  exports.inbox = inbox;
8
+ exports.outbox = outbox;
7
9
  exports.listTemplates = listTemplates;
8
10
  exports.generateTemplate = generateTemplate;
9
11
  exports.listCampaigns = listCampaigns;
@@ -27,21 +29,51 @@ async function listMailboxes(flags) {
27
29
  const config = (0, config_js_1.requireConfig)();
28
30
  const orgId = flags.org || config.default_org;
29
31
  if (!orgId)
30
- (0, output_js_1.error)("Missing required arguments.\nUsage: myapi email list-mailboxes --org <id>\n(Or set a default org via: myapi config set-org <id>)");
31
- const mailboxes = await sdk_1.email.listMailboxes(config.api_key, orgId);
32
+ (0, output_js_1.error)("Missing required arguments.\nUsage: myapi email list-mailboxes --org <id> [--domain <domain> | --filter unassigned]\n(Or set a default org via: myapi config set-org <id>)");
33
+ if (!flags.domain && flags.filter !== 'unassigned')
34
+ (0, output_js_1.error)("Must provide either --domain <domain> or --filter unassigned");
35
+ const mailboxes = await sdk_1.email.listMailboxes(config.api_key, orgId, {
36
+ domain: flags.domain,
37
+ filter: flags.filter === 'unassigned' ? 'unassigned' : undefined
38
+ });
32
39
  (0, output_js_1.printTable)(mailboxes);
33
40
  }
41
+ async function sent(flags) {
42
+ const config = (0, config_js_1.requireConfig)();
43
+ const orgId = flags.org || config.default_org;
44
+ if (!orgId)
45
+ (0, output_js_1.error)("Missing required arguments.\nUsage: myapi email sent --org <id> [--limit <num>] [--offset <num>]\n(Or set defaults via: myapi config set-org <id>)");
46
+ const limit = parseInt(flags.limit) || 50;
47
+ const offset = parseInt(flags.offset) || 0;
48
+ const emails = await sdk_1.email.getSentEmails(config.api_key, orgId, limit, offset);
49
+ (0, output_js_1.printTable)(emails);
50
+ }
34
51
  async function send(flags) {
35
52
  const config = (0, config_js_1.requireConfig)();
36
53
  const orgId = flags.org || config.default_org;
37
- if (!orgId || !flags.from || !flags.to || !flags.subject || !flags.body) {
38
- (0, output_js_1.error)("Missing required arguments.\nUsage: myapi email send --org <id> --from <email> --to <email> --subject <str> --body <str>");
54
+ if (!orgId || !flags.from || !flags.to || !flags.subject) {
55
+ (0, output_js_1.error)("Missing required arguments.\nUsage: myapi email send --org <id> --from <email> --to <email> --subject <str> [--body <str> | --template-id <id> [--template-vars <json_str>]]");
56
+ }
57
+ if (!flags.body && !flags['template-id'])
58
+ (0, output_js_1.error)("Must provide either --body or --template-id");
59
+ if (flags.body && flags['template-id'])
60
+ (0, output_js_1.error)("Cannot provide both --body and --template-id");
61
+ let templateVars;
62
+ if (flags['template-vars']) {
63
+ try {
64
+ templateVars = JSON.parse(flags['template-vars']);
65
+ }
66
+ catch (e) {
67
+ (0, output_js_1.error)("--template-vars must be a valid JSON string");
68
+ }
39
69
  }
40
70
  const res = await sdk_1.email.sendEmail(config.api_key, orgId, {
41
71
  from: flags.from,
42
72
  to: [flags.to],
43
73
  subject: flags.subject,
44
- text: flags.body
74
+ text: flags.body,
75
+ template_id: flags['template-id'],
76
+ template_vars: templateVars
45
77
  });
46
78
  (0, output_js_1.success)(`Email sent! Message ID: ${res.message_id}`);
47
79
  }
@@ -53,6 +85,14 @@ async function inbox(address, flags) {
53
85
  const messages = await sdk_1.email.getInbox(config.api_key, orgId, address);
54
86
  (0, output_js_1.printTable)(messages);
55
87
  }
88
+ async function outbox(address, flags) {
89
+ const config = (0, config_js_1.requireConfig)();
90
+ const orgId = flags.org || config.default_org;
91
+ if (!orgId || !address)
92
+ (0, output_js_1.error)("Missing required arguments.\nUsage: myapi email outbox <address> --org <id>");
93
+ const messages = await sdk_1.email.getOutbox(config.api_key, orgId, address);
94
+ (0, output_js_1.printTable)(messages);
95
+ }
56
96
  async function listTemplates(flags) {
57
97
  const config = (0, config_js_1.requireConfig)();
58
98
  const orgId = flags.org || config.default_org;
@@ -111,18 +151,22 @@ async function campaignStats(id, flags) {
111
151
  }
112
152
  async function run(subcommand, args, flags) {
113
153
  if (!subcommand || (flags.help && !subcommand)) {
114
- (0, output_js_1.info)('Usage: myapi email <subcommand>\n\nSubcommands:\n create-mailbox Create a new mailbox\n list-mailboxes List mailboxes\n send Send an email\n inbox Read received emails\n list-templates List email templates\n generate-template Generate AI template\n list-campaigns List campaigns\n campaign-stats Get campaign stats\n\nNote: All email commands require the --org <id> flag.');
154
+ (0, output_js_1.info)('Usage: myapi email <subcommand>\n\nSubcommands:\n create-mailbox Create a new mailbox\n list-mailboxes List mailboxes\n send Send an email\n sent List sent emails\n inbox Read received emails\n outbox Read sent emails for address\n list-templates List email templates\n generate-template Generate AI template\n list-campaigns List campaigns\n campaign-stats Get campaign stats\n\nNote: All email commands require the --org <id> flag.');
115
155
  return;
116
156
  }
117
157
  if (flags.help) {
118
158
  if (subcommand === 'create-mailbox')
119
159
  (0, output_js_1.info)('Usage: myapi email create-mailbox --org <id> --domain <domain> --username <user>');
120
160
  else if (subcommand === 'list-mailboxes')
121
- (0, output_js_1.info)('Usage: myapi email list-mailboxes --org <id>');
161
+ (0, output_js_1.info)('Usage: myapi email list-mailboxes --org <id> [--domain <domain> | --filter unassigned]');
122
162
  else if (subcommand === 'send')
123
- (0, output_js_1.info)('Usage: myapi email send --org <id> --from <email> --to <email> --subject <str> --body <str>');
163
+ (0, output_js_1.info)('Usage: myapi email send --org <id> --from <email> --to <email> --subject <str> [--body <str> | --template-id <id> [--template-vars <json_str>]]');
164
+ else if (subcommand === 'sent')
165
+ (0, output_js_1.info)('Usage: myapi email sent --org <id> [--limit <num>] [--offset <num>]');
124
166
  else if (subcommand === 'inbox')
125
167
  (0, output_js_1.info)('Usage: myapi email inbox <address> --org <id>');
168
+ else if (subcommand === 'outbox')
169
+ (0, output_js_1.info)('Usage: myapi email outbox <address> --org <id>');
126
170
  else if (subcommand === 'list-templates')
127
171
  (0, output_js_1.info)('Usage: myapi email list-templates --org <id>');
128
172
  else if (subcommand === 'generate-template')
@@ -139,8 +183,12 @@ async function run(subcommand, args, flags) {
139
183
  await listMailboxes(flags);
140
184
  else if (subcommand === 'send')
141
185
  await send(flags);
186
+ else if (subcommand === 'sent')
187
+ await sent(flags);
142
188
  else if (subcommand === 'inbox')
143
189
  await inbox(args[0], flags);
190
+ else if (subcommand === 'outbox')
191
+ await outbox(args[0], flags);
144
192
  else if (subcommand === 'list-templates')
145
193
  await listTemplates(flags);
146
194
  else if (subcommand === 'generate-template')
@@ -2,9 +2,6 @@ export declare function list(flags: Record<string, string | boolean>): Promise<v
2
2
  export declare function create(flags: Record<string, string | boolean>): Promise<void>;
3
3
  export declare function get(id: string, flags: Record<string, string | boolean>): Promise<void>;
4
4
  export declare function del(id: string, flags: Record<string, string | boolean>): Promise<void>;
5
- export declare function preview(id: string, flags: Record<string, string | boolean>): Promise<void>;
6
- export declare function publish(id: string, flags: Record<string, string | boolean>): Promise<void>;
7
- export declare function status(id: string, flags: Record<string, string | boolean>): Promise<void>;
8
5
  export declare function push(id: string, slug: string, flags: Record<string, string | boolean>): Promise<void>;
9
6
  export declare function verify(id: string, flags: Record<string, string | boolean>): Promise<void>;
10
7
  export declare function run(subcommand: string | undefined, args: string[], flags: Record<string, string | boolean>): Promise<void>;
@@ -4,9 +4,6 @@ exports.list = list;
4
4
  exports.create = create;
5
5
  exports.get = get;
6
6
  exports.del = del;
7
- exports.preview = preview;
8
- exports.publish = publish;
9
- exports.status = status;
10
7
  exports.push = push;
11
8
  exports.verify = verify;
12
9
  exports.run = run;
@@ -47,30 +44,6 @@ async function del(id, flags) {
47
44
  await sdk_1.funnel.deleteFunnel(config.api_key, orgId, id);
48
45
  (0, output_js_1.success)(`Funnel ${id} deleted`);
49
46
  }
50
- async function preview(id, flags) {
51
- const config = (0, config_js_1.requireConfig)();
52
- const orgId = flags.org || config.default_org;
53
- if (!orgId || !id)
54
- (0, output_js_1.error)("Missing required arguments.\nUsage: myapi funnel preview <id> --org <id>\n(Or set defaults via: myapi config set-org <id>)");
55
- const p = await sdk_1.funnel.previewFunnel(config.api_key, orgId, id);
56
- (0, output_js_1.success)(`Preview deployed: ${p.preview_url}`);
57
- }
58
- async function publish(id, flags) {
59
- const config = (0, config_js_1.requireConfig)();
60
- const orgId = flags.org || config.default_org;
61
- if (!orgId || !id)
62
- (0, output_js_1.error)("Missing required arguments.\nUsage: myapi funnel publish <id> --org <id>\n(Or set defaults via: myapi config set-org <id>)");
63
- const p = await sdk_1.funnel.publishFunnel(config.api_key, orgId, id);
64
- (0, output_js_1.success)(`Publish job started. Status: ${p.status}`);
65
- }
66
- async function status(id, flags) {
67
- const config = (0, config_js_1.requireConfig)();
68
- const orgId = flags.org || config.default_org;
69
- if (!orgId || !id)
70
- (0, output_js_1.error)("Missing required arguments.\nUsage: myapi funnel status <id> --org <id>\n(Or set defaults via: myapi config set-org <id>)");
71
- const s = await sdk_1.funnel.getPublishStatus(config.api_key, orgId, id);
72
- (0, output_js_1.info)(`Publish Status: ${s.status}`);
73
- }
74
47
  async function push(id, slug, flags) {
75
48
  const config = (0, config_js_1.requireConfig)();
76
49
  const orgId = flags.org || config.default_org;
@@ -86,7 +59,7 @@ async function push(id, slug, flags) {
86
59
  });
87
60
  if (!html)
88
61
  (0, output_js_1.error)("No HTML provided via stdin");
89
- await sdk_1.funnel.pushPage(config.api_key, orgId, id, slug, html);
62
+ await sdk_1.funnel.pushFunnelPage(config.api_key, orgId, id, { slug, html });
90
63
  (0, output_js_1.success)(`Pushed page to ${slug}`);
91
64
  }
92
65
  async function verify(id, flags) {
@@ -102,7 +75,7 @@ async function verify(id, flags) {
102
75
  }
103
76
  async function run(subcommand, args, flags) {
104
77
  if (!subcommand || (flags.help && !subcommand)) {
105
- (0, output_js_1.info)('Usage: myapi funnel <subcommand>\n\nSubcommands:\n list List funnels\n create Create a funnel\n get Get funnel details\n delete Delete a funnel\n preview Deploy to a preview domain\n publish Deploy to production domain\n status Check publish status\n push Push a raw HTML page to a slug\n verify Verify links and webhooks\n\nNote: All funnel commands require the --org <id> flag.');
78
+ (0, output_js_1.info)('Usage: myapi funnel <subcommand>\n\nSubcommands:\n list List funnels\n create Create a funnel\n get Get funnel details\n delete Delete a funnel\n push Push a raw HTML page to a slug\n verify Verify links and webhooks\n\nNote: All funnel commands require the --org <id> flag.');
106
79
  return;
107
80
  }
108
81
  if (flags.help) {
@@ -114,16 +87,10 @@ async function run(subcommand, args, flags) {
114
87
  (0, output_js_1.info)('Usage: myapi funnel get <id> --org <id>');
115
88
  else if (subcommand === 'delete')
116
89
  (0, output_js_1.info)('Usage: myapi funnel delete <id> --org <id>');
117
- else if (subcommand === 'preview')
118
- (0, output_js_1.info)('Usage: myapi funnel preview <id> --org <id>');
119
- else if (subcommand === 'publish')
120
- (0, output_js_1.info)('Usage: myapi funnel publish <id> --org <id>');
121
- else if (subcommand === 'status')
122
- (0, output_js_1.info)('Usage: myapi funnel status <id> --org <id>');
123
90
  else if (subcommand === 'push')
124
91
  (0, output_js_1.info)('Usage: myapi funnel push <funnel_id> <slug> --org <id> < index.html\n\nPushes HTML content from stdin to the specified funnel.');
125
92
  else if (subcommand === 'verify')
126
- (0, output_js_1.info)('Usage: myapi funnel verify <id> --org <id> [--slug <slug>]\n\nVerifies syntax and structure before publishing.');
93
+ (0, output_js_1.info)('Usage: myapi funnel verify <id> --org <id> [--slug <slug>]\n\nVerifies syntax and structure before pushing.');
127
94
  return;
128
95
  }
129
96
  if (subcommand === 'list')
@@ -134,12 +101,6 @@ async function run(subcommand, args, flags) {
134
101
  await get(args[0], flags);
135
102
  else if (subcommand === 'delete')
136
103
  await del(args[0], flags);
137
- else if (subcommand === 'preview')
138
- await preview(args[0], flags);
139
- else if (subcommand === 'publish')
140
- await publish(args[0], flags);
141
- else if (subcommand === 'status')
142
- await status(args[0], flags);
143
104
  else if (subcommand === 'push')
144
105
  await push(args[0], args[1], flags);
145
106
  else if (subcommand === 'verify')
package/dist/index.js CHANGED
@@ -44,6 +44,7 @@ const orgCmd = __importStar(require("./commands/org.js"));
44
44
  const setupCmd = __importStar(require("./commands/setup.js"));
45
45
  const configCmd = __importStar(require("./commands/config.js"));
46
46
  const domainCmd = __importStar(require("./commands/domain.js"));
47
+ const funnelCmd = __importStar(require("./commands/funnel.js"));
47
48
  async function main() {
48
49
  const { args, flags } = (0, utils_js_1.parseArgs)(process.argv.slice(2));
49
50
  if (args.length === 0) {
@@ -114,6 +115,9 @@ async function main() {
114
115
  case 'domain':
115
116
  await domainCmd.run(subcommand, restArgs, flags);
116
117
  break;
118
+ case 'funnel':
119
+ await funnelCmd.run(subcommand, restArgs, flags);
120
+ break;
117
121
  default:
118
122
  printHelp();
119
123
  process.exit(0);
@@ -141,6 +145,7 @@ Commands:
141
145
  setup Setup CLI credentials and view integration instructions
142
146
  config Manage CLI defaults like org_id and domain
143
147
  domain Manage domain configurations
148
+ funnel Manage headless funnels and pages
144
149
 
145
150
  Run "myapi <command> --help" for subcommand help.`);
146
151
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myapihq/cli",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "MyAPI command-line interface",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -74,7 +74,7 @@ export async function topup(amountStr: string, flags: Record<string, string | bo
74
74
 
75
75
  export async function setup(flags: Record<string, string | boolean>) {
76
76
  if (flags.help) {
77
- info('Usage: myapi billing setup\n\nGenerates a secure Stripe Checkout link to add or update your payment method.');
77
+ info('Usage: myapi billing setup\n\nGenerates a secure checkout link to add or update your payment method.');
78
78
  return;
79
79
  }
80
80
  const config = requireConfig();
@@ -17,22 +17,50 @@ export async function createMailbox(flags: Record<string, string | boolean>) {
17
17
  export async function listMailboxes(flags: Record<string, string | boolean>) {
18
18
  const config = requireConfig();
19
19
  const orgId = (flags.org as string) || config.default_org;
20
- if (!orgId) error("Missing required arguments.\nUsage: myapi email list-mailboxes --org <id>\n(Or set a default org via: myapi config set-org <id>)");
21
- const mailboxes = await sdkEmail.listMailboxes(config.api_key, orgId);
20
+ if (!orgId) error("Missing required arguments.\nUsage: myapi email list-mailboxes --org <id> [--domain <domain> | --filter unassigned]\n(Or set a default org via: myapi config set-org <id>)");
21
+ if (!flags.domain && flags.filter !== 'unassigned') error("Must provide either --domain <domain> or --filter unassigned");
22
+ const mailboxes = await sdkEmail.listMailboxes(config.api_key, orgId, {
23
+ domain: flags.domain as string | undefined,
24
+ filter: flags.filter === 'unassigned' ? 'unassigned' : undefined
25
+ });
22
26
  printTable(mailboxes as unknown as Record<string, unknown>[]);
23
27
  }
24
28
 
29
+ export async function sent(flags: Record<string, string | boolean>) {
30
+ const config = requireConfig();
31
+ const orgId = (flags.org as string) || config.default_org;
32
+ if (!orgId) error("Missing required arguments.\nUsage: myapi email sent --org <id> [--limit <num>] [--offset <num>]\n(Or set defaults via: myapi config set-org <id>)");
33
+ const limit = parseInt(flags.limit as string) || 50;
34
+ const offset = parseInt(flags.offset as string) || 0;
35
+ const emails = await sdkEmail.getSentEmails(config.api_key, orgId, limit, offset);
36
+ printTable(emails as unknown as Record<string, unknown>[]);
37
+ }
38
+
25
39
  export async function send(flags: Record<string, string | boolean>) {
26
40
  const config = requireConfig();
27
41
  const orgId = (flags.org as string) || config.default_org;
28
- if (!orgId || !flags.from || !flags.to || !flags.subject || !flags.body) {
29
- error("Missing required arguments.\nUsage: myapi email send --org <id> --from <email> --to <email> --subject <str> --body <str>");
42
+ if (!orgId || !flags.from || !flags.to || !flags.subject) {
43
+ error("Missing required arguments.\nUsage: myapi email send --org <id> --from <email> --to <email> --subject <str> [--body <str> | --template-id <id> [--template-vars <json_str>]]");
44
+ }
45
+ if (!flags.body && !flags['template-id']) error("Must provide either --body or --template-id");
46
+ if (flags.body && flags['template-id']) error("Cannot provide both --body and --template-id");
47
+
48
+ let templateVars: Record<string, string> | undefined;
49
+ if (flags['template-vars']) {
50
+ try {
51
+ templateVars = JSON.parse(flags['template-vars'] as string);
52
+ } catch (e) {
53
+ error("--template-vars must be a valid JSON string");
54
+ }
30
55
  }
56
+
31
57
  const res = await sdkEmail.sendEmail(config.api_key, orgId, {
32
58
  from: flags.from as string,
33
59
  to: [flags.to as string],
34
60
  subject: flags.subject as string,
35
- text: flags.body as string
61
+ text: flags.body as string | undefined,
62
+ template_id: flags['template-id'] as string | undefined,
63
+ template_vars: templateVars
36
64
  });
37
65
  success(`Email sent! Message ID: ${res.message_id}`);
38
66
  }
@@ -45,6 +73,14 @@ export async function inbox(address: string, flags: Record<string, string | bool
45
73
  printTable(messages as unknown as Record<string, unknown>[]);
46
74
  }
47
75
 
76
+ export async function outbox(address: string, flags: Record<string, string | boolean>) {
77
+ const config = requireConfig();
78
+ const orgId = (flags.org as string) || config.default_org;
79
+ if (!orgId || !address) error("Missing required arguments.\nUsage: myapi email outbox <address> --org <id>");
80
+ const messages = await sdkEmail.getOutbox(config.api_key, orgId, address);
81
+ printTable(messages as unknown as Record<string, unknown>[]);
82
+ }
83
+
48
84
  export async function listTemplates(flags: Record<string, string | boolean>) {
49
85
  const config = requireConfig();
50
86
  const orgId = (flags.org as string) || config.default_org;
@@ -107,15 +143,17 @@ export async function campaignStats(id: string, flags: Record<string, string | b
107
143
 
108
144
  export async function run(subcommand: string | undefined, args: string[], flags: Record<string, string | boolean>) {
109
145
  if (!subcommand || (flags.help && !subcommand)) {
110
- info('Usage: myapi email <subcommand>\n\nSubcommands:\n create-mailbox Create a new mailbox\n list-mailboxes List mailboxes\n send Send an email\n inbox Read received emails\n list-templates List email templates\n generate-template Generate AI template\n list-campaigns List campaigns\n campaign-stats Get campaign stats\n\nNote: All email commands require the --org <id> flag.');
146
+ info('Usage: myapi email <subcommand>\n\nSubcommands:\n create-mailbox Create a new mailbox\n list-mailboxes List mailboxes\n send Send an email\n sent List sent emails\n inbox Read received emails\n outbox Read sent emails for address\n list-templates List email templates\n generate-template Generate AI template\n list-campaigns List campaigns\n campaign-stats Get campaign stats\n\nNote: All email commands require the --org <id> flag.');
111
147
  return;
112
148
  }
113
149
 
114
150
  if (flags.help) {
115
151
  if (subcommand === 'create-mailbox') info('Usage: myapi email create-mailbox --org <id> --domain <domain> --username <user>');
116
- else if (subcommand === 'list-mailboxes') info('Usage: myapi email list-mailboxes --org <id>');
117
- else if (subcommand === 'send') info('Usage: myapi email send --org <id> --from <email> --to <email> --subject <str> --body <str>');
152
+ else if (subcommand === 'list-mailboxes') info('Usage: myapi email list-mailboxes --org <id> [--domain <domain> | --filter unassigned]');
153
+ else if (subcommand === 'send') info('Usage: myapi email send --org <id> --from <email> --to <email> --subject <str> [--body <str> | --template-id <id> [--template-vars <json_str>]]');
154
+ else if (subcommand === 'sent') info('Usage: myapi email sent --org <id> [--limit <num>] [--offset <num>]');
118
155
  else if (subcommand === 'inbox') info('Usage: myapi email inbox <address> --org <id>');
156
+ else if (subcommand === 'outbox') info('Usage: myapi email outbox <address> --org <id>');
119
157
  else if (subcommand === 'list-templates') info('Usage: myapi email list-templates --org <id>');
120
158
  else if (subcommand === 'generate-template') info('Usage: myapi email generate-template --org <id> --prompt <str> --name <str>');
121
159
  else if (subcommand === 'list-campaigns') info('Usage: myapi email list-campaigns --org <id>');
@@ -126,7 +164,9 @@ export async function run(subcommand: string | undefined, args: string[], flags:
126
164
  if (subcommand === 'create-mailbox') await createMailbox(flags);
127
165
  else if (subcommand === 'list-mailboxes') await listMailboxes(flags);
128
166
  else if (subcommand === 'send') await send(flags);
167
+ else if (subcommand === 'sent') await sent(flags);
129
168
  else if (subcommand === 'inbox') await inbox(args[0], flags);
169
+ else if (subcommand === 'outbox') await outbox(args[0], flags);
130
170
  else if (subcommand === 'list-templates') await listTemplates(flags);
131
171
  else if (subcommand === 'generate-template') await generateTemplate(flags);
132
172
  else if (subcommand === 'list-campaigns') await listCampaigns(flags);
@@ -40,30 +40,6 @@ export async function del(id: string, flags: Record<string, string | boolean>) {
40
40
  success(`Funnel ${id} deleted`);
41
41
  }
42
42
 
43
- export async function preview(id: string, flags: Record<string, string | boolean>) {
44
- const config = requireConfig();
45
- const orgId = (flags.org as string) || config.default_org;
46
- if (!orgId || !id) error("Missing required arguments.\nUsage: myapi funnel preview <id> --org <id>\n(Or set defaults via: myapi config set-org <id>)");
47
- const p = await sdkFunnel.previewFunnel(config.api_key, orgId, id);
48
- success(`Preview deployed: ${p.preview_url}`);
49
- }
50
-
51
- export async function publish(id: string, flags: Record<string, string | boolean>) {
52
- const config = requireConfig();
53
- const orgId = (flags.org as string) || config.default_org;
54
- if (!orgId || !id) error("Missing required arguments.\nUsage: myapi funnel publish <id> --org <id>\n(Or set defaults via: myapi config set-org <id>)");
55
- const p = await sdkFunnel.publishFunnel(config.api_key, orgId, id);
56
- success(`Publish job started. Status: ${p.status}`);
57
- }
58
-
59
- export async function status(id: string, flags: Record<string, string | boolean>) {
60
- const config = requireConfig();
61
- const orgId = (flags.org as string) || config.default_org;
62
- if (!orgId || !id) error("Missing required arguments.\nUsage: myapi funnel status <id> --org <id>\n(Or set defaults via: myapi config set-org <id>)");
63
- const s = await sdkFunnel.getPublishStatus(config.api_key, orgId, id);
64
- info(`Publish Status: ${s.status}`);
65
- }
66
-
67
43
  export async function push(id: string, slug: string, flags: Record<string, string | boolean>) {
68
44
  const config = requireConfig();
69
45
  const orgId = (flags.org as string) || config.default_org;
@@ -82,7 +58,7 @@ export async function push(id: string, slug: string, flags: Record<string, strin
82
58
 
83
59
  if (!html) error("No HTML provided via stdin");
84
60
 
85
- await sdkFunnel.pushPage(config.api_key, orgId, id, slug, html);
61
+ await sdkFunnel.pushFunnelPage(config.api_key, orgId, id, { slug, html });
86
62
  success(`Pushed page to ${slug}`);
87
63
  }
88
64
 
@@ -98,7 +74,7 @@ export async function verify(id: string, flags: Record<string, string | boolean>
98
74
 
99
75
  export async function run(subcommand: string | undefined, args: string[], flags: Record<string, string | boolean>) {
100
76
  if (!subcommand || (flags.help && !subcommand)) {
101
- info('Usage: myapi funnel <subcommand>\n\nSubcommands:\n list List funnels\n create Create a funnel\n get Get funnel details\n delete Delete a funnel\n preview Deploy to a preview domain\n publish Deploy to production domain\n status Check publish status\n push Push a raw HTML page to a slug\n verify Verify links and webhooks\n\nNote: All funnel commands require the --org <id> flag.');
77
+ info('Usage: myapi funnel <subcommand>\n\nSubcommands:\n list List funnels\n create Create a funnel\n get Get funnel details\n delete Delete a funnel\n push Push a raw HTML page to a slug\n verify Verify links and webhooks\n\nNote: All funnel commands require the --org <id> flag.');
102
78
  return;
103
79
  }
104
80
 
@@ -107,11 +83,8 @@ export async function run(subcommand: string | undefined, args: string[], flags:
107
83
  else if (subcommand === 'create') info('Usage: myapi funnel create --org <id> --domain <domain>');
108
84
  else if (subcommand === 'get') info('Usage: myapi funnel get <id> --org <id>');
109
85
  else if (subcommand === 'delete') info('Usage: myapi funnel delete <id> --org <id>');
110
- else if (subcommand === 'preview') info('Usage: myapi funnel preview <id> --org <id>');
111
- else if (subcommand === 'publish') info('Usage: myapi funnel publish <id> --org <id>');
112
- else if (subcommand === 'status') info('Usage: myapi funnel status <id> --org <id>');
113
86
  else if (subcommand === 'push') info('Usage: myapi funnel push <funnel_id> <slug> --org <id> < index.html\n\nPushes HTML content from stdin to the specified funnel.');
114
- else if (subcommand === 'verify') info('Usage: myapi funnel verify <id> --org <id> [--slug <slug>]\n\nVerifies syntax and structure before publishing.');
87
+ else if (subcommand === 'verify') info('Usage: myapi funnel verify <id> --org <id> [--slug <slug>]\n\nVerifies syntax and structure before pushing.');
115
88
  return;
116
89
  }
117
90
 
@@ -119,9 +92,6 @@ export async function run(subcommand: string | undefined, args: string[], flags:
119
92
  else if (subcommand === 'create') await create(flags);
120
93
  else if (subcommand === 'get') await get(args[0], flags);
121
94
  else if (subcommand === 'delete') await del(args[0], flags);
122
- else if (subcommand === 'preview') await preview(args[0], flags);
123
- else if (subcommand === 'publish') await publish(args[0], flags);
124
- else if (subcommand === 'status') await status(args[0], flags);
125
95
  else if (subcommand === 'push') await push(args[0], args[1], flags);
126
96
  else if (subcommand === 'verify') await verify(args[0], flags);
127
97
  else error(`Unknown subcommand: ${subcommand}. Run "myapi funnel --help" for a list of valid subcommands.`);
package/src/index.ts CHANGED
@@ -9,6 +9,7 @@ import * as orgCmd from './commands/org.js';
9
9
  import * as setupCmd from './commands/setup.js';
10
10
  import * as configCmd from './commands/config.js';
11
11
  import * as domainCmd from './commands/domain.js';
12
+ import * as funnelCmd from './commands/funnel.js';
12
13
 
13
14
  async function main() {
14
15
  const { args, flags } = parseArgs(process.argv.slice(2));
@@ -62,6 +63,9 @@ async function main() {
62
63
  case 'domain':
63
64
  await domainCmd.run(subcommand, restArgs, flags);
64
65
  break;
66
+ case 'funnel':
67
+ await funnelCmd.run(subcommand, restArgs, flags);
68
+ break;
65
69
  default:
66
70
  printHelp();
67
71
  process.exit(0);
@@ -87,6 +91,7 @@ Commands:
87
91
  setup Setup CLI credentials and view integration instructions
88
92
  config Manage CLI defaults like org_id and domain
89
93
  domain Manage domain configurations
94
+ funnel Manage headless funnels and pages
90
95
 
91
96
  Run "myapi <command> --help" for subcommand help.`);
92
97
  }