@myapihq/cli 1.3.13 → 2.1.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/account.d.ts +7 -1
- package/dist/commands/account.js +356 -18
- package/dist/commands/authproduct.d.ts +7 -0
- package/dist/commands/authproduct.js +286 -0
- package/dist/commands/billing-auto-recharge.test.d.ts +1 -0
- package/dist/commands/billing-auto-recharge.test.js +103 -0
- package/dist/commands/billing.d.ts +3 -0
- package/dist/commands/billing.js +116 -1
- package/dist/commands/config.js +1 -1
- package/dist/commands/container.d.ts +1 -0
- package/dist/commands/container.js +115 -11
- package/dist/commands/doctor-setup.test.js +86 -1
- package/dist/commands/doctor.d.ts +8 -0
- package/dist/commands/doctor.js +70 -15
- package/dist/commands/domain.js +2 -2
- package/dist/commands/email/index.js +0 -13
- package/dist/commands/fn.d.ts +1 -0
- package/dist/commands/fn.js +64 -12
- package/dist/commands/keys.js +3 -3
- package/dist/commands/queue.d.ts +1 -0
- package/dist/commands/queue.js +10 -0
- package/dist/commands/setup.js +8 -8
- package/dist/commands/status.d.ts +1 -1
- package/dist/commands/status.js +23 -27
- package/dist/commands/storage.js +3 -1
- package/dist/commands/workflow.js +21 -6
- package/dist/completion.js +5 -4
- package/dist/config.js +1 -1
- package/dist/exposes.test.js +1 -2
- package/dist/index.js +57 -33
- package/dist/registrant.js +5 -5
- package/dist/sdk-queue.test.js +3 -2
- package/dist/skills/my-api-hq/README.md +1 -0
- package/dist/skills/my-api-hq/SKILL.md +27 -14
- package/dist/skills/my-auth-api/README.md +33 -0
- package/dist/skills/my-auth-api/SKILL.md +112 -0
- package/dist/skills/my-auth-api/claude/.claude-plugin/plugin.json +6 -0
- package/dist/skills/my-auth-api/openapi/.gitkeep +0 -0
- package/dist/skills/my-crm-api/SKILL.md +1 -1
- package/dist/skills/my-domain-api/SKILL.md +5 -5
- package/dist/skills/my-email-api/README.md +2 -3
- package/dist/skills/my-email-api/SKILL.md +7 -18
- package/dist/skills/my-email-api/claude/.claude-plugin/plugin.json +1 -1
- package/dist/skills/my-email-verify-api/SKILL.md +1 -1
- package/dist/skills/my-email-verify-api/claude/.claude-plugin/plugin.json +1 -1
- package/dist/skills/my-funnel-api/SKILL.md +1 -1
- package/dist/skills/my-git-api/README.md +43 -0
- package/dist/skills/my-git-api/SKILL.md +115 -0
- package/dist/skills/my-git-api/claude/.claude-plugin/plugin.json +6 -0
- package/dist/skills/my-git-api/openapi/.gitkeep +0 -0
- package/dist/skills/my-llm-api/README.md +1 -1
- package/dist/skills/my-llm-api/claude/.claude-plugin/plugin.json +1 -1
- package/package.json +2 -2
- package/dist/commands/auth.d.ts +0 -11
- package/dist/commands/auth.js +0 -345
- package/dist/commands/email/campaign.d.ts +0 -4
- package/dist/commands/email/campaign.js +0 -200
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { email as sdkEmail } from '@myapihq/sdk';
|
|
2
|
-
import { requireConfig } from '../../config.js';
|
|
3
|
-
import { success, error, printTable, printJson, info } from '../../output.js';
|
|
4
|
-
import { requireOrg } from '../../helpers.js';
|
|
5
|
-
export const EXPOSES = [
|
|
6
|
-
'POST /email/orgs/{org_id}/campaigns',
|
|
7
|
-
'GET /email/orgs/{org_id}/campaigns',
|
|
8
|
-
'GET /email/orgs/{org_id}/campaigns/{campaign_id}',
|
|
9
|
-
'PATCH /email/orgs/{org_id}/campaigns/{campaign_id}',
|
|
10
|
-
'POST /email/orgs/{org_id}/campaigns/{campaign_id}/contacts/upload-list',
|
|
11
|
-
'POST /email/orgs/{org_id}/campaigns/{campaign_id}/contacts/upload-file',
|
|
12
|
-
'GET /email/orgs/{org_id}/campaigns/{campaign_id}/contacts/status',
|
|
13
|
-
'POST /email/orgs/{org_id}/campaigns/{campaign_id}/start',
|
|
14
|
-
'POST /email/orgs/{org_id}/campaigns/{campaign_id}/pause',
|
|
15
|
-
'POST /email/orgs/{org_id}/campaigns/{campaign_id}/resume',
|
|
16
|
-
'GET /email/orgs/{org_id}/campaigns/{campaign_id}/stats',
|
|
17
|
-
];
|
|
18
|
-
async function create(nameArg, flags) {
|
|
19
|
-
const config = requireConfig();
|
|
20
|
-
const orgId = requireOrg(flags, config, 'myapi email campaign create <name> --template-id <id> --from <email> [--per-day <n>] [--org <id>]');
|
|
21
|
-
const name = nameArg || flags.name;
|
|
22
|
-
if (!name || !flags['template-id'] || !flags.from) {
|
|
23
|
-
error('Missing required arguments.\nUsage: myapi email campaign create <name> --template-id <id> --from <email> [--per-day <n>] [--org <id>]\n or: myapi email campaign create --name <name> --template-id <id> --from <email> [--per-day <n>] [--org <id>]');
|
|
24
|
-
}
|
|
25
|
-
const perDayLimit = flags['per-day'];
|
|
26
|
-
const res = await sdkEmail.createCampaign(config.api_key, orgId, {
|
|
27
|
-
name,
|
|
28
|
-
template_id: flags['template-id'],
|
|
29
|
-
from_address: flags.from,
|
|
30
|
-
per_day_limit: perDayLimit,
|
|
31
|
-
});
|
|
32
|
-
success(`Campaign created! ID: ${res.id}`);
|
|
33
|
-
}
|
|
34
|
-
async function list(flags) {
|
|
35
|
-
const config = requireConfig();
|
|
36
|
-
const orgId = requireOrg(flags, config, 'myapi email campaign list [--org <id>]');
|
|
37
|
-
const campaigns = await sdkEmail.listCampaigns(config.api_key, orgId);
|
|
38
|
-
if (flags.json) {
|
|
39
|
-
printJson(campaigns);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
// Drops warmup_config — a nested object that renders as "[object Object]"
|
|
43
|
-
// in a table. The scalar fields below are what a listing needs; the full
|
|
44
|
-
// config is in `myapi email campaign get <id>` and `--json`.
|
|
45
|
-
printTable(campaigns.map(c => ({
|
|
46
|
-
id: c.id,
|
|
47
|
-
name: c.name,
|
|
48
|
-
status: c.status,
|
|
49
|
-
template_id: c.template_id,
|
|
50
|
-
from_address: c.from_address,
|
|
51
|
-
per_day_limit: c.per_day_limit,
|
|
52
|
-
created_at: c.created_at,
|
|
53
|
-
})), {
|
|
54
|
-
flags,
|
|
55
|
-
empty: 'No campaigns yet. Create one with: myapi email campaign create',
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
async function get(id, flags) {
|
|
59
|
-
const config = requireConfig();
|
|
60
|
-
const orgId = requireOrg(flags, config, 'myapi email campaign get <id> [--org <id>]');
|
|
61
|
-
if (!id)
|
|
62
|
-
error('Missing required arguments.\nUsage: myapi email campaign get <id> [--org <id>]');
|
|
63
|
-
const c = await sdkEmail.getCampaign(config.api_key, orgId, id);
|
|
64
|
-
printJson(c);
|
|
65
|
-
}
|
|
66
|
-
async function update(id, flags) {
|
|
67
|
-
const config = requireConfig();
|
|
68
|
-
const orgId = requireOrg(flags, config, 'myapi email campaign update <id> [--name <str>] [--per-day <n>] [--org <id>]');
|
|
69
|
-
if (!id)
|
|
70
|
-
error('Missing required arguments.\nUsage: myapi email campaign update <id> [--name <str>] [--per-day <n>] [--org <id>]');
|
|
71
|
-
const payload = {};
|
|
72
|
-
if (flags.name)
|
|
73
|
-
payload.name = flags.name;
|
|
74
|
-
if (flags['per-day'])
|
|
75
|
-
payload.per_day_limit = flags['per-day'];
|
|
76
|
-
if (!payload.name && payload.per_day_limit === undefined) {
|
|
77
|
-
error('Nothing to update. Pass at least one of --name, --per-day.');
|
|
78
|
-
}
|
|
79
|
-
const res = await sdkEmail.updateCampaign(config.api_key, orgId, id, payload);
|
|
80
|
-
success(`Campaign ${res.id} updated`);
|
|
81
|
-
}
|
|
82
|
-
async function uploadContacts(id, flags) {
|
|
83
|
-
const config = requireConfig();
|
|
84
|
-
const orgId = requireOrg(flags, config, 'myapi email campaign upload-contacts <campaign_id> --emails <a@x,b@y> [--org <id>]');
|
|
85
|
-
if (!id || !flags.emails) {
|
|
86
|
-
error('Missing required arguments.\nUsage: myapi email campaign upload-contacts <campaign_id> --emails <a@x,b@y> [--org <id>]');
|
|
87
|
-
}
|
|
88
|
-
const emails = flags.emails.split(',').map(s => s.trim()).filter(Boolean);
|
|
89
|
-
const res = await sdkEmail.uploadContactList(config.api_key, orgId, id, emails);
|
|
90
|
-
success(`Uploaded ${res.total} contacts (status: ${res.status})`);
|
|
91
|
-
}
|
|
92
|
-
async function uploadContactsFile(id, flags) {
|
|
93
|
-
const config = requireConfig();
|
|
94
|
-
const orgId = requireOrg(flags, config, 'myapi email campaign upload-contacts-file <campaign_id> --file <path> [--org <id>]');
|
|
95
|
-
if (!id || !flags.file) {
|
|
96
|
-
error('Missing required arguments.\nUsage: myapi email campaign upload-contacts-file <campaign_id> --file <path> [--org <id>]');
|
|
97
|
-
}
|
|
98
|
-
// Defer fs require to keep the unimported-cost low for users who never
|
|
99
|
-
// touch this command. Plain JS readFile fits — the SDK accepts a Buffer.
|
|
100
|
-
const fs = await import('node:fs');
|
|
101
|
-
const path = await import('node:path');
|
|
102
|
-
const filePath = flags.file;
|
|
103
|
-
if (!fs.existsSync(filePath))
|
|
104
|
-
error(`File not found: ${filePath}`);
|
|
105
|
-
const buf = fs.readFileSync(filePath);
|
|
106
|
-
const res = await sdkEmail.uploadContactsFile(config.api_key, orgId, id, buf, path.basename(filePath));
|
|
107
|
-
success(`Uploaded ${res.total} contacts from ${filePath} (status: ${res.status})`);
|
|
108
|
-
}
|
|
109
|
-
async function start(id, flags) {
|
|
110
|
-
const config = requireConfig();
|
|
111
|
-
const orgId = requireOrg(flags, config, 'myapi email campaign start <id> [--org <id>]');
|
|
112
|
-
if (!id)
|
|
113
|
-
error('Missing required arguments.\nUsage: myapi email campaign start <id> [--org <id>]');
|
|
114
|
-
const status = await sdkEmail.getContactUploadStatus(config.api_key, orgId, id);
|
|
115
|
-
if (status.upload_status !== 'ready') {
|
|
116
|
-
error(`Contacts not ready (current status: ${status.upload_status})`);
|
|
117
|
-
}
|
|
118
|
-
const res = await sdkEmail.startCampaign(config.api_key, orgId, id);
|
|
119
|
-
success(`Campaign started (status: ${res.status})`);
|
|
120
|
-
}
|
|
121
|
-
async function pause(id, flags) {
|
|
122
|
-
const config = requireConfig();
|
|
123
|
-
const orgId = requireOrg(flags, config, 'myapi email campaign pause <id> [--org <id>]');
|
|
124
|
-
if (!id)
|
|
125
|
-
error('Missing required arguments.\nUsage: myapi email campaign pause <id> [--org <id>]');
|
|
126
|
-
await sdkEmail.pauseCampaign(config.api_key, orgId, id);
|
|
127
|
-
success(`Campaign ${id} paused`);
|
|
128
|
-
}
|
|
129
|
-
async function resume(id, flags) {
|
|
130
|
-
const config = requireConfig();
|
|
131
|
-
const orgId = requireOrg(flags, config, 'myapi email campaign resume <id> [--org <id>]');
|
|
132
|
-
if (!id)
|
|
133
|
-
error('Missing required arguments.\nUsage: myapi email campaign resume <id> [--org <id>]');
|
|
134
|
-
await sdkEmail.resumeCampaign(config.api_key, orgId, id);
|
|
135
|
-
success(`Campaign ${id} resumed`);
|
|
136
|
-
}
|
|
137
|
-
async function stats(id, flags) {
|
|
138
|
-
const config = requireConfig();
|
|
139
|
-
const orgId = requireOrg(flags, config, 'myapi email campaign stats <id> [--org <id>]');
|
|
140
|
-
if (!id)
|
|
141
|
-
error('Missing required arguments.\nUsage: myapi email campaign stats <id> [--org <id>]');
|
|
142
|
-
const res = await sdkEmail.getCampaignStats(config.api_key, orgId, id);
|
|
143
|
-
printJson(res);
|
|
144
|
-
}
|
|
145
|
-
const USAGE = {
|
|
146
|
-
'create': `myapi email campaign create <name> --template-id <id> --from <email> [--per-day <n>] [--org <id>]
|
|
147
|
-
myapi email campaign create --name <name> --template-id <id> --from <email> [--per-day <n>] [--org <id>]
|
|
148
|
-
|
|
149
|
-
Either form works; the positional name is the recommended shape.`,
|
|
150
|
-
'list': 'myapi email campaign list [--org <id>]',
|
|
151
|
-
'get': 'myapi email campaign get <id> [--org <id>]',
|
|
152
|
-
'update': 'myapi email campaign update <id> [--name <str>] [--per-day <n>] [--org <id>]',
|
|
153
|
-
'upload-contacts': 'myapi email campaign upload-contacts <campaign_id> --emails <a@x,b@y> [--org <id>]',
|
|
154
|
-
'upload-contacts-file': 'myapi email campaign upload-contacts-file <campaign_id> --file <path> [--org <id>]',
|
|
155
|
-
'start': 'myapi email campaign start <id> [--org <id>]',
|
|
156
|
-
'pause': 'myapi email campaign pause <id> [--org <id>]',
|
|
157
|
-
'resume': 'myapi email campaign resume <id> [--org <id>]',
|
|
158
|
-
'stats': 'myapi email campaign stats <id> [--org <id>]',
|
|
159
|
-
};
|
|
160
|
-
export async function run(sub, args, flags) {
|
|
161
|
-
if (!sub || (flags.help && !sub)) {
|
|
162
|
-
info(`Usage: myapi email campaign <subcommand>
|
|
163
|
-
|
|
164
|
-
Subcommands:
|
|
165
|
-
create <name> Create a campaign (--template-id --from)
|
|
166
|
-
get <id> Get a single campaign
|
|
167
|
-
list List campaigns
|
|
168
|
-
pause <id> Pause a campaign
|
|
169
|
-
resume <id> Resume a campaign
|
|
170
|
-
start <id> Start a campaign
|
|
171
|
-
stats <id> Get campaign stats
|
|
172
|
-
update <id> Patch name / per-day-limit
|
|
173
|
-
upload-contacts <id> Upload contact list (--emails a@x,b@y)
|
|
174
|
-
upload-contacts-file <id> Upload contacts from a CSV file (--file path/to/contacts.csv)
|
|
175
|
-
|
|
176
|
-
All commands accept --org <id> (or set default: myapi config set-org <id>).`);
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
if (flags.help) {
|
|
180
|
-
const usage = USAGE[sub];
|
|
181
|
-
if (usage)
|
|
182
|
-
info(`Usage: ${usage}`);
|
|
183
|
-
else
|
|
184
|
-
info(`Unknown subcommand: ${sub}. Run "myapi email campaign --help" for the list.`);
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
switch (sub) {
|
|
188
|
-
case 'create': return create(args[0], flags);
|
|
189
|
-
case 'list': return list(flags);
|
|
190
|
-
case 'get': return get(args[0], flags);
|
|
191
|
-
case 'update': return update(args[0], flags);
|
|
192
|
-
case 'upload-contacts': return uploadContacts(args[0], flags);
|
|
193
|
-
case 'upload-contacts-file': return uploadContactsFile(args[0], flags);
|
|
194
|
-
case 'start': return start(args[0], flags);
|
|
195
|
-
case 'pause': return pause(args[0], flags);
|
|
196
|
-
case 'resume': return resume(args[0], flags);
|
|
197
|
-
case 'stats': return stats(args[0], flags);
|
|
198
|
-
default: error(`Unknown subcommand: ${sub}. Run "myapi email campaign --help" for the list.`);
|
|
199
|
-
}
|
|
200
|
-
}
|