@myapihq/cli 1.0.82 → 1.1.0-wip.0
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/commands/auth.d.ts +8 -3
- package/dist/commands/auth.js +11 -29
- package/dist/commands/billing.d.ts +8 -4
- package/dist/commands/billing.js +43 -22
- package/dist/commands/config.d.ts +8 -5
- package/dist/commands/config.js +63 -28
- package/dist/commands/domain.d.ts +12 -9
- package/dist/commands/domain.js +117 -86
- package/dist/commands/email.d.ts +4 -12
- package/dist/commands/email.js +490 -128
- package/dist/commands/funnel.d.ts +10 -7
- package/dist/commands/funnel.js +78 -55
- package/dist/commands/image.js +25 -15
- package/dist/commands/keys.d.ts +8 -3
- package/dist/commands/keys.js +67 -28
- package/dist/commands/org.d.ts +9 -5
- package/dist/commands/org.js +121 -53
- package/dist/commands/pixel.js +23 -11
- package/dist/commands/setup.d.ts +3 -2
- package/dist/commands/setup.js +44 -77
- package/dist/commands/storage.js +25 -15
- package/dist/commands/update.d.ts +2 -1
- package/dist/commands/url.js +19 -7
- package/dist/commands/webhook.d.ts +8 -5
- package/dist/commands/webhook.js +52 -36
- package/dist/commands/workflow.d.ts +13 -7
- package/dist/commands/workflow.js +158 -56
- package/dist/flags.d.ts +8 -0
- package/dist/flags.js +88 -0
- package/dist/flags.test.d.ts +1 -0
- package/dist/flags.test.js +73 -0
- package/dist/helpers.d.ts +6 -0
- package/dist/helpers.js +29 -0
- package/dist/index.js +97 -107
- package/dist/output.d.ts +10 -1
- package/dist/output.js +4 -6
- package/dist/skills/my-email-api/README.md +45 -0
- package/dist/skills/my-email-api/SKILL.md +106 -0
- package/dist/skills/my-email-api/claude/.claude-plugin/plugin.json +6 -0
- package/dist/skills/my-email-api/make/.gitkeep +0 -0
- package/dist/skills/my-email-api/n8n/.gitkeep +0 -0
- package/dist/skills/my-email-api/openapi/.gitkeep +0 -0
- package/dist/skills/my-webhook-api/README.md +40 -0
- package/dist/skills/my-webhook-api/SKILL.md +65 -0
- package/dist/skills/my-webhook-api/claude/.claude-plugin/plugin.json +6 -0
- package/dist/skills/my-webhook-api/make/.gitkeep +0 -0
- package/dist/skills/my-webhook-api/n8n/.gitkeep +0 -0
- package/dist/skills/my-webhook-api/openapi/.gitkeep +0 -0
- package/dist/skills/my-workflow-api/README.md +37 -0
- package/dist/skills/my-workflow-api/SKILL.md +98 -0
- package/dist/skills/my-workflow-api/claude/.claude-plugin/plugin.json +6 -0
- package/dist/skills/my-workflow-api/make/.gitkeep +0 -0
- package/dist/skills/my-workflow-api/n8n/.gitkeep +0 -0
- package/dist/skills/my-workflow-api/openapi/.gitkeep +0 -0
- package/dist/utils.d.ts +0 -4
- package/dist/utils.js +0 -33
- package/dist/utils.test.d.ts +1 -0
- package/dist/utils.test.js +48 -0
- package/package.json +9 -4
- package/dist/commands/account.d.ts +0 -4
- package/dist/commands/account.js +0 -80
package/dist/commands/auth.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare
|
|
1
|
+
import type { FlagSchema } from '../flags.js';
|
|
2
|
+
import type { Flags } from '../helpers.js';
|
|
3
|
+
export declare const SCHEMA: FlagSchema;
|
|
4
|
+
export declare const HELP = "Usage: myapi auth <subcommand>\n\nSubcommands:\n setup Configure your account\n import-key Import an existing API key non-interactively\n whoami Show current account \u00B7 supports --json\n link [email] Upgrade anonymous account to registered (or add a second session)\n Use myapi auth setup to create a completely new account\n switch [index] Switch active account by index or email\n config Manage CLI defaults (org, funnel, domain) \u00B7 supports set-org / set-funnel / set-domain\n install-skills Install or update the MyAPI skills pack for AI agents\n api-keys Manage API keys \u00B7 list / create / revoke\n keys Alias for api-keys";
|
|
5
|
+
export declare const INSTALL_SKILLS_HELP = "Usage: myapi auth install-skills\n\nInstalls the MyAPI skills pack for AI coding agents (Claude, Gemini, Cursor).\n\nThis command writes skill definition files to:\n ~/.agents/skills/myapi/\n\nAnd creates symlinks in the appropriate agent config directories:\n ~/.claude/ (Claude)\n ~/.gemini/ (Gemini)\n ~/.cursor/ (Cursor, if detected)\n\nThese files teach agents how to use the MyAPI CLI and API directly.\nRun this command again to update existing skills to the latest version.";
|
|
6
|
+
export declare function link(flags?: Flags, emailArg?: string): Promise<void>;
|
|
7
|
+
export declare function whoami(flags?: Flags): Promise<void>;
|
|
8
|
+
export declare function switchCmd(flags?: Flags, indexArg?: string): Promise<void>;
|
package/dist/commands/auth.js
CHANGED
|
@@ -3,7 +3,14 @@ import { loadConfig, saveConfig, addAccount, switchAccount, listAccounts } from
|
|
|
3
3
|
import { info, success, error, printJson } from '../output.js';
|
|
4
4
|
import { installSkills } from './setup.js';
|
|
5
5
|
import { hq } from '@myapihq/sdk';
|
|
6
|
-
const
|
|
6
|
+
export const SCHEMA = {
|
|
7
|
+
'install-skills': 'boolean',
|
|
8
|
+
'no-skills': 'boolean',
|
|
9
|
+
anonymous: 'boolean',
|
|
10
|
+
anon: 'boolean',
|
|
11
|
+
};
|
|
12
|
+
export const HELP = 'Usage: myapi auth <subcommand>\n\nSubcommands:\n setup Configure your account\n import-key Import an existing API key non-interactively\n whoami Show current account · supports --json\n link [email] Upgrade anonymous account to registered (or add a second session)\n Use myapi auth setup to create a completely new account\n switch [index] Switch active account by index or email\n config Manage CLI defaults (org, funnel, domain) · supports set-org / set-funnel / set-domain\n install-skills Install or update the MyAPI skills pack for AI agents\n api-keys Manage API keys · list / create / revoke\n keys Alias for api-keys';
|
|
13
|
+
export const INSTALL_SKILLS_HELP = 'Usage: myapi auth install-skills\n\nInstalls the MyAPI skills pack for AI coding agents (Claude, Gemini, Cursor).\n\nThis command writes skill definition files to:\n ~/.agents/skills/myapi/\n\nAnd creates symlinks in the appropriate agent config directories:\n ~/.claude/ (Claude)\n ~/.gemini/ (Gemini)\n ~/.cursor/ (Cursor, if detected)\n\nThese files teach agents how to use the MyAPI CLI and API directly.\nRun this command again to update existing skills to the latest version.';
|
|
7
14
|
function ask(rl, q) {
|
|
8
15
|
return new Promise(resolve => rl.question(q, resolve));
|
|
9
16
|
}
|
|
@@ -13,31 +20,6 @@ function yn(answer, defaultYes = true) {
|
|
|
13
20
|
return defaultYes;
|
|
14
21
|
return t === 'y' || t === 'yes';
|
|
15
22
|
}
|
|
16
|
-
async function post(path, body, apiKey) {
|
|
17
|
-
const headers = { 'Content-Type': 'application/json' };
|
|
18
|
-
if (apiKey)
|
|
19
|
-
headers['Authorization'] = `Bearer ${apiKey}`;
|
|
20
|
-
const res = await fetch(`${API_BASE}${path}`, {
|
|
21
|
-
method: 'POST',
|
|
22
|
-
headers,
|
|
23
|
-
body: JSON.stringify(body),
|
|
24
|
-
});
|
|
25
|
-
const json = await res.json();
|
|
26
|
-
if (!res.ok)
|
|
27
|
-
throw new Error(json.error ?? `HTTP ${res.status}`);
|
|
28
|
-
return json.data ?? json;
|
|
29
|
-
}
|
|
30
|
-
async function patch(path, body, apiKey) {
|
|
31
|
-
const res = await fetch(`${API_BASE}${path}`, {
|
|
32
|
-
method: 'PATCH',
|
|
33
|
-
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${apiKey}` },
|
|
34
|
-
body: JSON.stringify(body),
|
|
35
|
-
});
|
|
36
|
-
const json = await res.json();
|
|
37
|
-
if (!res.ok)
|
|
38
|
-
throw new Error(json.error ?? `HTTP ${res.status}`);
|
|
39
|
-
return json.data ?? json;
|
|
40
|
-
}
|
|
41
23
|
// myapi auth link — upgrade anonymous session to registered account.
|
|
42
24
|
export async function link(flags = {}, emailArg) {
|
|
43
25
|
if (flags.help) {
|
|
@@ -56,7 +38,7 @@ export async function link(flags = {}, emailArg) {
|
|
|
56
38
|
error(`Invalid email address: "${email}".`);
|
|
57
39
|
let upgradeOk = true;
|
|
58
40
|
try {
|
|
59
|
-
await
|
|
41
|
+
await hq.upgradeAccount(config.api_key, email);
|
|
60
42
|
}
|
|
61
43
|
catch (err) {
|
|
62
44
|
if (err.message !== 'EMAIL_TAKEN')
|
|
@@ -67,11 +49,11 @@ export async function link(flags = {}, emailArg) {
|
|
|
67
49
|
const ans = (await ask(rl, '› Sign in and add it as a second account? (Y/n) ')).trim();
|
|
68
50
|
if (!yn(ans))
|
|
69
51
|
return;
|
|
70
|
-
await
|
|
52
|
+
await hq.sendCode(email);
|
|
71
53
|
}
|
|
72
54
|
info(`› Sent a code to ${email} · paste it below`);
|
|
73
55
|
const code = (await ask(rl, '› Code? ')).trim();
|
|
74
|
-
const data = await
|
|
56
|
+
const data = await hq.verifyCode(email, code);
|
|
75
57
|
const skillsFromFlag = flags['install-skills'] ? true : flags['no-skills'] ? false : null;
|
|
76
58
|
const wantsSkills = skillsFromFlag !== null ? skillsFromFlag : yn((await ask(rl, '› Install the MyAPI skills pack? (Y/n) ')).trim());
|
|
77
59
|
if (upgradeOk) {
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
export declare function
|
|
1
|
+
import type { FlagSchema } from '../flags.js';
|
|
2
|
+
import type { Flags } from '../helpers.js';
|
|
3
|
+
export declare const SCHEMA: FlagSchema;
|
|
4
|
+
export declare function run(subcommand: string | undefined, args: string[], flags: Flags): Promise<void>;
|
|
5
|
+
export declare function balance(flags: Flags): Promise<void>;
|
|
6
|
+
export declare function history(flags: Flags): Promise<void>;
|
|
7
|
+
export declare function topup(amountStr: string, flags: Flags): Promise<void>;
|
|
8
|
+
export declare function setup(_flags: Flags): Promise<void>;
|
package/dist/commands/billing.js
CHANGED
|
@@ -3,11 +3,46 @@ import { hq } from '@myapihq/sdk';
|
|
|
3
3
|
import { requireConfig } from '../config.js';
|
|
4
4
|
import { success, error, printTable, info, printJson } from '../output.js';
|
|
5
5
|
import { formatDate } from '../utils.js';
|
|
6
|
-
export
|
|
6
|
+
export const SCHEMA = {};
|
|
7
|
+
const SUBCOMMAND_USAGE = {
|
|
8
|
+
'balance': 'myapi billing balance [--json]',
|
|
9
|
+
'history': 'myapi billing history [--json]',
|
|
10
|
+
'topup': `myapi billing topup <amount> [--yes]
|
|
11
|
+
|
|
12
|
+
Amount is in whole dollars (e.g. "10" charges $10).
|
|
13
|
+
Confirmation is required for amounts of $50 or more — pass --yes to skip it.
|
|
14
|
+
|
|
15
|
+
Example: myapi billing topup 10`,
|
|
16
|
+
'setup': 'myapi billing setup',
|
|
17
|
+
};
|
|
18
|
+
export async function run(subcommand, args, flags) {
|
|
19
|
+
if (!subcommand || (flags.help && !subcommand)) {
|
|
20
|
+
info(`Usage: myapi billing <subcommand>
|
|
21
|
+
|
|
22
|
+
Subcommands:
|
|
23
|
+
balance Check balance, credits, and payment method status
|
|
24
|
+
history View recent transactions and top-ups
|
|
25
|
+
topup Top up your balance (whole dollars)
|
|
26
|
+
setup Open a checkout link to add or update payment method`);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
7
29
|
if (flags.help) {
|
|
8
|
-
|
|
30
|
+
const usage = SUBCOMMAND_USAGE[subcommand];
|
|
31
|
+
if (usage)
|
|
32
|
+
info(`Usage: ${usage}`);
|
|
33
|
+
else
|
|
34
|
+
info(`Unknown subcommand: ${subcommand}. Run "myapi billing --help" for the list.`);
|
|
9
35
|
return;
|
|
10
36
|
}
|
|
37
|
+
switch (subcommand) {
|
|
38
|
+
case 'balance': return balance(flags);
|
|
39
|
+
case 'history': return history(flags);
|
|
40
|
+
case 'topup': return topup(args[0], flags);
|
|
41
|
+
case 'setup': return setup(flags);
|
|
42
|
+
default: error(`Unknown subcommand: ${subcommand}. Run "myapi billing --help" for available subcommands.`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export async function balance(flags) {
|
|
11
46
|
const config = requireConfig();
|
|
12
47
|
const result = await hq.getBalance(config.api_key);
|
|
13
48
|
if (flags.json) {
|
|
@@ -24,37 +59,27 @@ export async function balance(flags) {
|
|
|
24
59
|
info(`Balance: ${result.balance_display} | Credits: ${result.credits_display} (not usable for domains) | Payment method: ${pm}`);
|
|
25
60
|
}
|
|
26
61
|
export async function history(flags) {
|
|
27
|
-
if (flags.help) {
|
|
28
|
-
info('Usage: myapi billing history [--json]\n\nShows your recent billing transactions and top-ups.\n\nFlags:\n --json Output raw JSON');
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
62
|
const config = requireConfig();
|
|
32
63
|
const items = await hq.getBillingHistory(config.api_key);
|
|
33
64
|
if (flags.json) {
|
|
34
65
|
printJson(items);
|
|
35
66
|
return;
|
|
36
67
|
}
|
|
37
|
-
if (items.length === 0) {
|
|
38
|
-
info('No transactions yet.');
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
68
|
const formattedItems = items.map(item => ({
|
|
42
69
|
Type: item.type || 'unknown',
|
|
43
70
|
Amount: item.amount_display,
|
|
44
71
|
Status: item.status ? item.status.charAt(0).toUpperCase() + item.status.slice(1) : '',
|
|
45
72
|
Date: formatDate(item.created_at),
|
|
46
73
|
}));
|
|
47
|
-
printTable(formattedItems
|
|
74
|
+
printTable(formattedItems, {
|
|
75
|
+
flags,
|
|
76
|
+
empty: 'No transactions yet.',
|
|
77
|
+
});
|
|
48
78
|
}
|
|
49
79
|
export async function topup(amountStr, flags) {
|
|
50
|
-
if (flags.help) {
|
|
51
|
-
info('Usage: myapi billing topup <amount>\n\nAmount is in whole dollars (e.g. "10" charges $10).\nConfirmation is required for amounts of $50 or more. Use --yes to skip it.\nExample: myapi billing topup 10\n\nFlags:\n --yes Skip confirmation prompt for large amounts');
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
80
|
const amount = Math.round(parseFloat(amountStr));
|
|
55
81
|
if (!amountStr || isNaN(amount) || amount <= 0) {
|
|
56
|
-
error(
|
|
57
|
-
return;
|
|
82
|
+
error('Amount must be a positive whole number of dollars (e.g. myapi billing topup 10)');
|
|
58
83
|
}
|
|
59
84
|
if (!flags.yes && !flags.y && amount >= 50) {
|
|
60
85
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -69,11 +94,7 @@ export async function topup(amountStr, flags) {
|
|
|
69
94
|
const result = await hq.topUp(config.api_key, amount);
|
|
70
95
|
success(`Top up successful! New balance: ${result.new_balance_display}`);
|
|
71
96
|
}
|
|
72
|
-
export async function setup(
|
|
73
|
-
if (flags.help) {
|
|
74
|
-
info('Usage: myapi billing setup\n\nGenerates a secure checkout link to add or update your payment method.');
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
97
|
+
export async function setup(_flags) {
|
|
77
98
|
const config = requireConfig();
|
|
78
99
|
const result = await hq.setupPayment(config.api_key);
|
|
79
100
|
success(`Open this URL in your browser to set up payment:\n${result.url}`);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
1
|
+
import type { FlagSchema } from '../flags.js';
|
|
2
|
+
import type { Flags } from '../helpers.js';
|
|
3
|
+
export declare const SCHEMA: FlagSchema;
|
|
4
|
+
export declare function setOrg(id: string, _flags: Flags, via?: string): Promise<void>;
|
|
5
|
+
export declare function setFunnel(id: string, _flags: Flags, via?: string): Promise<void>;
|
|
6
|
+
export declare function setDomain(domain: string, _flags: Flags, via?: string): Promise<void>;
|
|
7
|
+
export declare function view(flags: Flags, _via?: string): Promise<void>;
|
|
8
|
+
export declare function run(subcommand: string | undefined, args: string[], flags: Flags): Promise<void>;
|
package/dist/commands/config.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { hq, funnel as sdkFunnel } from '@myapihq/sdk';
|
|
2
2
|
import { requireConfig, saveConfig } from '../config.js';
|
|
3
|
-
import { success, error, info } from '../output.js';
|
|
3
|
+
import { success, error, info, printJson } from '../output.js';
|
|
4
|
+
export const SCHEMA = {
|
|
5
|
+
_via: 'string',
|
|
6
|
+
};
|
|
4
7
|
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
5
|
-
export async function setOrg(id,
|
|
6
|
-
if (!id
|
|
7
|
-
info(`Usage: myapi ${via} set-org <id
|
|
8
|
+
export async function setOrg(id, _flags, via = 'auth config') {
|
|
9
|
+
if (!id) {
|
|
10
|
+
info(`Usage: myapi ${via} set-org <id>`);
|
|
8
11
|
return;
|
|
9
12
|
}
|
|
10
13
|
if (!UUID_RE.test(id))
|
|
@@ -16,9 +19,9 @@ export async function setOrg(id, flags, via = 'auth config') {
|
|
|
16
19
|
saveConfig(config);
|
|
17
20
|
success(`Default organization set to: ${org.name || org.id}`);
|
|
18
21
|
}
|
|
19
|
-
export async function setFunnel(id,
|
|
20
|
-
if (!id
|
|
21
|
-
info(`Usage: myapi ${via} set-funnel <id
|
|
22
|
+
export async function setFunnel(id, _flags, via = 'auth config') {
|
|
23
|
+
if (!id) {
|
|
24
|
+
info(`Usage: myapi ${via} set-funnel <id>`);
|
|
22
25
|
return;
|
|
23
26
|
}
|
|
24
27
|
if (!UUID_RE.test(id))
|
|
@@ -28,14 +31,15 @@ export async function setFunnel(id, flags, via = 'auth config') {
|
|
|
28
31
|
if (!orgId)
|
|
29
32
|
error('No default organization set. Run: myapi auth config set-org <id>');
|
|
30
33
|
info('› Validating…');
|
|
31
|
-
const
|
|
32
|
-
|
|
34
|
+
const rawFunnel = await sdkFunnel.getFunnel(config.api_key, orgId, id);
|
|
35
|
+
const funnelId = rawFunnel.funnel?.id ?? rawFunnel.id;
|
|
36
|
+
config.default_funnel = funnelId;
|
|
33
37
|
saveConfig(config);
|
|
34
|
-
success(`Default funnel set to: ${
|
|
38
|
+
success(`Default funnel set to: ${funnelId}`);
|
|
35
39
|
}
|
|
36
|
-
export async function setDomain(domain,
|
|
37
|
-
if (!domain
|
|
38
|
-
info(`Usage: myapi ${via} set-domain <domain
|
|
40
|
+
export async function setDomain(domain, _flags, via = 'auth config') {
|
|
41
|
+
if (!domain) {
|
|
42
|
+
info(`Usage: myapi ${via} set-domain <domain>`);
|
|
39
43
|
return;
|
|
40
44
|
}
|
|
41
45
|
const config = requireConfig();
|
|
@@ -43,30 +47,61 @@ export async function setDomain(domain, flags, via = 'auth config') {
|
|
|
43
47
|
saveConfig(config);
|
|
44
48
|
success(`Default domain set to: ${domain}`);
|
|
45
49
|
}
|
|
46
|
-
export async function view(flags,
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
export async function view(flags, _via = 'auth config') {
|
|
51
|
+
const config = requireConfig();
|
|
52
|
+
if (flags.json) {
|
|
53
|
+
printJson({
|
|
54
|
+
default_org: config.default_org ?? null,
|
|
55
|
+
default_funnel: config.default_funnel ?? null,
|
|
56
|
+
default_domain: config.default_domain ?? null,
|
|
57
|
+
});
|
|
49
58
|
return;
|
|
50
59
|
}
|
|
51
|
-
const config = requireConfig();
|
|
52
60
|
info(`Default Org: ${config.default_org || 'Not set'}`);
|
|
53
61
|
info(`Default Funnel: ${config.default_funnel || 'Not set'}`);
|
|
54
62
|
info(`Default Domain: ${config.default_domain || 'Not set'}`);
|
|
55
63
|
}
|
|
64
|
+
// ── Dispatcher ───────────────────────────────────────────────────────────────
|
|
65
|
+
function subcommandUsage(via) {
|
|
66
|
+
return {
|
|
67
|
+
'view': `myapi ${via} view [--json]`,
|
|
68
|
+
'set-org': `myapi ${via} set-org <id>\n\nSets the default organization for all commands that require --org.\nThe ID is validated against the API before saving.`,
|
|
69
|
+
'set-funnel': `myapi ${via} set-funnel <id>\n\nSets the default funnel. Must belong to your current default org.\nThe ID is validated against the API before saving.`,
|
|
70
|
+
'set-domain': `myapi ${via} set-domain <domain>\n\nSets the default domain used by domain commands when the domain arg is omitted.`,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
56
73
|
export async function run(subcommand, args, flags) {
|
|
57
74
|
const via = flags._via || 'auth config';
|
|
58
75
|
if (!subcommand || (flags.help && !subcommand)) {
|
|
59
|
-
info(`Usage: myapi ${via} <subcommand
|
|
76
|
+
info(`Usage: myapi ${via} <subcommand>
|
|
77
|
+
|
|
78
|
+
Manages CLI defaults (org, funnel, domain) so you don't have to pass --org / --domain on every command.
|
|
79
|
+
|
|
80
|
+
Subcommands:
|
|
81
|
+
view Show current defaults
|
|
82
|
+
set-org Set default organization (validates access)
|
|
83
|
+
set-funnel Set default funnel (must be owned by default org)
|
|
84
|
+
set-domain Set default domain
|
|
85
|
+
|
|
86
|
+
Examples:
|
|
87
|
+
myapi ${via} set-org <id>
|
|
88
|
+
myapi ${via} set-funnel <id>
|
|
89
|
+
myapi ${via} view`);
|
|
60
90
|
return;
|
|
61
91
|
}
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
92
|
+
if (flags.help) {
|
|
93
|
+
const usage = subcommandUsage(via)[subcommand];
|
|
94
|
+
if (usage)
|
|
95
|
+
info(`Usage: ${usage}`);
|
|
96
|
+
else
|
|
97
|
+
info(`Unknown subcommand: ${subcommand}. Run "myapi ${via} --help" for the list.`);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
switch (subcommand) {
|
|
101
|
+
case 'view': return view(flags, via);
|
|
102
|
+
case 'set-org': return setOrg(args[0], flags, via);
|
|
103
|
+
case 'set-funnel': return setFunnel(args[0], flags, via);
|
|
104
|
+
case 'set-domain': return setDomain(args[0], flags, via);
|
|
105
|
+
default: error(`Unknown subcommand: ${subcommand}. Run "myapi ${via} --help" for a list of valid subcommands.`);
|
|
106
|
+
}
|
|
72
107
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
1
|
+
import type { FlagSchema } from '../flags.js';
|
|
2
|
+
import { type Flags } from '../helpers.js';
|
|
3
|
+
export declare const SCHEMA: FlagSchema;
|
|
4
|
+
export declare function check(domainArg: string, flags: Flags): Promise<void>;
|
|
5
|
+
export declare function register(domainArg: string, flags: Flags): Promise<void>;
|
|
6
|
+
export declare function list(flags: Flags): Promise<void>;
|
|
7
|
+
export declare function assign(domainArg: string, flags: Flags): Promise<void>;
|
|
8
|
+
export declare function unassign(domainArg: string, flags: Flags): Promise<void>;
|
|
9
|
+
export declare function status(domainArg: string, flags: Flags): Promise<void>;
|
|
10
|
+
export declare function settings(domainArg: string, flags: Flags): Promise<void>;
|
|
11
|
+
export declare function updateSettings(domainArg: string, flags: Flags): Promise<void>;
|
|
12
|
+
export declare function run(subcommand: string | undefined, args: string[], flags: Flags): Promise<void>;
|