@myapihq/cli 1.0.5 → 1.0.7
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.js +5 -16
- package/dist/commands/billing.js +28 -5
- package/dist/commands/keys.d.ts +3 -0
- package/dist/commands/keys.js +80 -0
- package/dist/commands/org.js +40 -8
- package/dist/commands/setup.js +10 -99
- package/dist/index.js +33 -13
- package/package.json +1 -1
- package/src/commands/billing.ts +30 -3
- package/src/commands/keys.ts +47 -0
- package/src/commands/org.ts +39 -5
- package/src/commands/setup.ts +10 -109
- package/src/index.ts +29 -11
- package/tsconfig.json +3 -6
- package/dist/cli/src/commands/account.d.ts +0 -4
- package/dist/cli/src/commands/account.js +0 -91
- package/dist/cli/src/commands/billing.d.ts +0 -4
- package/dist/cli/src/commands/billing.js +0 -34
- package/dist/cli/src/commands/domain.d.ts +0 -5
- package/dist/cli/src/commands/domain.js +0 -56
- package/dist/cli/src/commands/email.d.ts +0 -8
- package/dist/cli/src/commands/email.js +0 -95
- package/dist/cli/src/commands/funnel.d.ts +0 -3
- package/dist/cli/src/commands/funnel.js +0 -37
- package/dist/cli/src/commands/image.d.ts +0 -2
- package/dist/cli/src/commands/image.js +0 -47
- package/dist/cli/src/commands/org.d.ts +0 -5
- package/dist/cli/src/commands/org.js +0 -67
- package/dist/cli/src/commands/setup.d.ts +0 -1
- package/dist/cli/src/commands/setup.js +0 -165
- package/dist/cli/src/commands/storage.d.ts +0 -3
- package/dist/cli/src/commands/storage.js +0 -36
- package/dist/cli/src/commands/webhook.d.ts +0 -3
- package/dist/cli/src/commands/webhook.js +0 -28
- package/dist/cli/src/commands/workflow.d.ts +0 -5
- package/dist/cli/src/commands/workflow.js +0 -57
- package/dist/cli/src/config.d.ts +0 -8
- package/dist/cli/src/config.js +0 -69
- package/dist/cli/src/index.d.ts +0 -2
- package/dist/cli/src/index.js +0 -117
- package/dist/cli/src/output.d.ts +0 -5
- package/dist/cli/src/output.js +0 -42
- package/dist/cli/src/utils.d.ts +0 -5
- package/dist/cli/src/utils.js +0 -34
- package/dist/sdk/src/client.d.ts +0 -6
- package/dist/sdk/src/client.js +0 -51
- package/dist/sdk/src/domain.d.ts +0 -32
- package/dist/sdk/src/domain.js +0 -36
- package/dist/sdk/src/email.d.ts +0 -144
- package/dist/sdk/src/email.js +0 -116
- package/dist/sdk/src/funnel.d.ts +0 -31
- package/dist/sdk/src/funnel.js +0 -28
- package/dist/sdk/src/hq.d.ts +0 -84
- package/dist/sdk/src/hq.js +0 -80
- package/dist/sdk/src/image.d.ts +0 -21
- package/dist/sdk/src/image.js +0 -16
- package/dist/sdk/src/index.d.ts +0 -11
- package/dist/sdk/src/index.js +0 -51
- package/dist/sdk/src/pixel.d.ts +0 -65
- package/dist/sdk/src/pixel.js +0 -44
- package/dist/sdk/src/storage.d.ts +0 -10
- package/dist/sdk/src/storage.js +0 -48
- package/dist/sdk/src/types.d.ts +0 -17
- package/dist/sdk/src/types.js +0 -2
- package/dist/sdk/src/webhook.d.ts +0 -20
- package/dist/sdk/src/webhook.js +0 -20
- package/dist/sdk/src/workflow.d.ts +0 -56
- package/dist/sdk/src/workflow.js +0 -40
- package/src/commands/account.ts +0 -63
package/dist/cli/src/index.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
// AUTO-GENERATED by scripts/generate-indexes.js — do not edit manually
|
|
38
|
-
const utils_js_1 = require("./utils.js");
|
|
39
|
-
const output_js_1 = require("./output.js");
|
|
40
|
-
const sdk_1 = require("@myapihq/sdk");
|
|
41
|
-
const accountCmd = __importStar(require("./commands/account.js"));
|
|
42
|
-
const billingCmd = __importStar(require("./commands/billing.js"));
|
|
43
|
-
const orgCmd = __importStar(require("./commands/org.js"));
|
|
44
|
-
const setupCmd = __importStar(require("./commands/setup.js"));
|
|
45
|
-
async function main() {
|
|
46
|
-
const { args, flags } = (0, utils_js_1.parseArgs)(process.argv.slice(2));
|
|
47
|
-
if (args.length === 0) {
|
|
48
|
-
printHelp();
|
|
49
|
-
process.exit(0);
|
|
50
|
-
}
|
|
51
|
-
const [command, subcommand, ...restArgs] = args;
|
|
52
|
-
try {
|
|
53
|
-
switch (command) {
|
|
54
|
-
case 'setup':
|
|
55
|
-
await setupCmd.setup();
|
|
56
|
-
break;
|
|
57
|
-
case 'account':
|
|
58
|
-
if (subcommand === 'create')
|
|
59
|
-
await accountCmd.create();
|
|
60
|
-
else if (subcommand === 'token')
|
|
61
|
-
await accountCmd.token(flags);
|
|
62
|
-
else if (subcommand === 'keys')
|
|
63
|
-
await accountCmd.listKeys(flags);
|
|
64
|
-
else if (subcommand === 'revoke')
|
|
65
|
-
await accountCmd.revokeKey(restArgs[0], flags);
|
|
66
|
-
else
|
|
67
|
-
printHelp();
|
|
68
|
-
break;
|
|
69
|
-
case 'org':
|
|
70
|
-
if (subcommand === 'list')
|
|
71
|
-
await orgCmd.list(flags);
|
|
72
|
-
else if (subcommand === 'create')
|
|
73
|
-
await orgCmd.create(flags);
|
|
74
|
-
else
|
|
75
|
-
printHelp();
|
|
76
|
-
break;
|
|
77
|
-
case 'billing':
|
|
78
|
-
if (subcommand === 'balance')
|
|
79
|
-
await billingCmd.balance(flags);
|
|
80
|
-
else if (subcommand === 'history')
|
|
81
|
-
await billingCmd.history(flags);
|
|
82
|
-
else if (subcommand === 'topup')
|
|
83
|
-
await billingCmd.topup(restArgs[0], flags);
|
|
84
|
-
else if (subcommand === 'setup')
|
|
85
|
-
await billingCmd.setup(flags);
|
|
86
|
-
else
|
|
87
|
-
printHelp();
|
|
88
|
-
break;
|
|
89
|
-
default:
|
|
90
|
-
printHelp();
|
|
91
|
-
process.exit(0);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
catch (err) {
|
|
95
|
-
if (err instanceof sdk_1.MyApiError) {
|
|
96
|
-
if (err.status === 402)
|
|
97
|
-
(0, output_js_1.error)('Insufficient balance. Run: myapi billing topup <amount>');
|
|
98
|
-
else if (err.status === 401)
|
|
99
|
-
(0, output_js_1.error)('Invalid API key. Run: myapi setup');
|
|
100
|
-
}
|
|
101
|
-
(0, output_js_1.error)(err.message || String(err));
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
function printHelp() {
|
|
105
|
-
(0, output_js_1.info)(`myapi - MyAPI command-line interface
|
|
106
|
-
|
|
107
|
-
Usage: myapi <command> [subcommand] [args]
|
|
108
|
-
|
|
109
|
-
Commands:
|
|
110
|
-
account
|
|
111
|
-
billing
|
|
112
|
-
org
|
|
113
|
-
setup
|
|
114
|
-
|
|
115
|
-
Run "myapi <command>" for subcommand help.`);
|
|
116
|
-
}
|
|
117
|
-
main().catch(err => { (0, output_js_1.error)(err.message || String(err)); });
|
package/dist/cli/src/output.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare function success(message: string): void;
|
|
2
|
-
export declare function error(message: string): never;
|
|
3
|
-
export declare function info(message: string): void;
|
|
4
|
-
export declare function printJson(data: unknown): void;
|
|
5
|
-
export declare function printTable(rows: Record<string, unknown>[]): void;
|
package/dist/cli/src/output.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.success = success;
|
|
4
|
-
exports.error = error;
|
|
5
|
-
exports.info = info;
|
|
6
|
-
exports.printJson = printJson;
|
|
7
|
-
exports.printTable = printTable;
|
|
8
|
-
function success(message) {
|
|
9
|
-
console.log(`\x1b[32m✓\x1b[0m ${message}`);
|
|
10
|
-
}
|
|
11
|
-
function error(message) {
|
|
12
|
-
console.error(`\x1b[31m✗\x1b[0m ${message}`);
|
|
13
|
-
process.exit(1);
|
|
14
|
-
}
|
|
15
|
-
function info(message) {
|
|
16
|
-
console.log(message);
|
|
17
|
-
}
|
|
18
|
-
function printJson(data) {
|
|
19
|
-
console.log(JSON.stringify(data, null, 2));
|
|
20
|
-
}
|
|
21
|
-
function printTable(rows) {
|
|
22
|
-
if (process.argv.includes('--json')) {
|
|
23
|
-
printJson(rows);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (rows.length === 0) {
|
|
27
|
-
console.log("No data found.");
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const columns = Object.keys(rows[0]);
|
|
31
|
-
const colWidths = columns.map(col => {
|
|
32
|
-
return Math.max(col.length, ...rows.map(row => String(row[col] ?? '').length));
|
|
33
|
-
});
|
|
34
|
-
const printRow = (row) => {
|
|
35
|
-
console.log(row.map((cell, i) => cell.padEnd(colWidths[i] + 2)).join(''));
|
|
36
|
-
};
|
|
37
|
-
printRow(columns);
|
|
38
|
-
console.log(colWidths.map(w => '-'.repeat(w + 2)).join(''));
|
|
39
|
-
for (const row of rows) {
|
|
40
|
-
printRow(columns.map(col => String(row[col] ?? '')));
|
|
41
|
-
}
|
|
42
|
-
}
|
package/dist/cli/src/utils.d.ts
DELETED
package/dist/cli/src/utils.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseArgs = parseArgs;
|
|
4
|
-
exports.sleep = sleep;
|
|
5
|
-
function parseArgs(argv) {
|
|
6
|
-
const args = [];
|
|
7
|
-
const flags = {};
|
|
8
|
-
for (let i = 0; i < argv.length; i++) {
|
|
9
|
-
const arg = argv[i];
|
|
10
|
-
if (arg.startsWith('--')) {
|
|
11
|
-
if (arg.includes('=')) {
|
|
12
|
-
const [key, value] = arg.slice(2).split('=', 2);
|
|
13
|
-
flags[key] = value;
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
const next = argv[i + 1];
|
|
17
|
-
if (next && !next.startsWith('--')) {
|
|
18
|
-
flags[arg.slice(2)] = next;
|
|
19
|
-
i++;
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
flags[arg.slice(2)] = true;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
args.push(arg);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return { args, flags };
|
|
31
|
-
}
|
|
32
|
-
function sleep(ms) {
|
|
33
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
34
|
-
}
|
package/dist/sdk/src/client.d.ts
DELETED
package/dist/sdk/src/client.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MyApiError = void 0;
|
|
4
|
-
exports.request = request;
|
|
5
|
-
class MyApiError extends Error {
|
|
6
|
-
code;
|
|
7
|
-
status;
|
|
8
|
-
constructor(code, status) {
|
|
9
|
-
super(code);
|
|
10
|
-
this.code = code;
|
|
11
|
-
this.status = status;
|
|
12
|
-
this.name = 'MyApiError';
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.MyApiError = MyApiError;
|
|
16
|
-
async function request(method, url, apiKey, body) {
|
|
17
|
-
const headers = {};
|
|
18
|
-
if (apiKey) {
|
|
19
|
-
headers['Authorization'] = `Bearer ${apiKey}`;
|
|
20
|
-
}
|
|
21
|
-
if (body !== undefined) {
|
|
22
|
-
headers['Content-Type'] = 'application/json';
|
|
23
|
-
}
|
|
24
|
-
const options = {
|
|
25
|
-
method,
|
|
26
|
-
headers,
|
|
27
|
-
};
|
|
28
|
-
if (body !== undefined) {
|
|
29
|
-
options.body = JSON.stringify(body);
|
|
30
|
-
}
|
|
31
|
-
const response = await fetch(url, options);
|
|
32
|
-
if (response.status === 204) {
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
let result;
|
|
36
|
-
try {
|
|
37
|
-
result = await response.json();
|
|
38
|
-
}
|
|
39
|
-
catch {
|
|
40
|
-
throw new MyApiError('invalid_json_response', response.status);
|
|
41
|
-
}
|
|
42
|
-
if (!response.ok) {
|
|
43
|
-
const code = result?.error || 'unknown_error';
|
|
44
|
-
throw new MyApiError(code, response.status);
|
|
45
|
-
}
|
|
46
|
-
const apiResponse = result;
|
|
47
|
-
if (!apiResponse.success) {
|
|
48
|
-
throw new MyApiError(apiResponse.error || 'unknown_error', response.status);
|
|
49
|
-
}
|
|
50
|
-
return apiResponse.data;
|
|
51
|
-
}
|
package/dist/sdk/src/domain.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export interface DomainRecord {
|
|
2
|
-
domain: string;
|
|
3
|
-
status: string;
|
|
4
|
-
expires_at?: string;
|
|
5
|
-
created_at: string;
|
|
6
|
-
}
|
|
7
|
-
export interface DomainSettings {
|
|
8
|
-
domain: string;
|
|
9
|
-
security_level: string;
|
|
10
|
-
browser_check: string;
|
|
11
|
-
ai_bots_protection: string;
|
|
12
|
-
is_robots_txt_managed: boolean;
|
|
13
|
-
}
|
|
14
|
-
export declare function checkDomain(apiKey: string, domain: string): Promise<{
|
|
15
|
-
available: boolean;
|
|
16
|
-
price_cents: number;
|
|
17
|
-
}>;
|
|
18
|
-
export declare function registerDomain(apiKey: string, domain: string, years?: number): Promise<DomainRecord>;
|
|
19
|
-
export declare function importDomain(apiKey: string, payload: {
|
|
20
|
-
domain: string;
|
|
21
|
-
namecheap_api_user?: string;
|
|
22
|
-
namecheap_api_key?: string;
|
|
23
|
-
}): Promise<DomainRecord>;
|
|
24
|
-
export declare function listDomains(apiKey: string): Promise<DomainRecord[]>;
|
|
25
|
-
export declare function getDomainStatus(apiKey: string, domain: string): Promise<DomainRecord>;
|
|
26
|
-
export declare function renewDomain(apiKey: string, domain: string, years?: number): Promise<DomainRecord>;
|
|
27
|
-
export declare function getDomainSettings(apiKey: string, domain: string): Promise<DomainSettings>;
|
|
28
|
-
export declare function updateDomainSettings(apiKey: string, domain: string, payload: {
|
|
29
|
-
security_level?: 'essentially_off' | 'medium' | 'high' | 'under_attack';
|
|
30
|
-
browser_check?: 'on' | 'off';
|
|
31
|
-
purge_cache?: boolean;
|
|
32
|
-
}): Promise<DomainSettings>;
|
package/dist/sdk/src/domain.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkDomain = checkDomain;
|
|
4
|
-
exports.registerDomain = registerDomain;
|
|
5
|
-
exports.importDomain = importDomain;
|
|
6
|
-
exports.listDomains = listDomains;
|
|
7
|
-
exports.getDomainStatus = getDomainStatus;
|
|
8
|
-
exports.renewDomain = renewDomain;
|
|
9
|
-
exports.getDomainSettings = getDomainSettings;
|
|
10
|
-
exports.updateDomainSettings = updateDomainSettings;
|
|
11
|
-
const client_1 = require("./client");
|
|
12
|
-
const BASE_URL = 'https://api.mydomainapi.com';
|
|
13
|
-
async function checkDomain(apiKey, domain) {
|
|
14
|
-
return (0, client_1.request)('GET', `${BASE_URL}/domain/check/${encodeURIComponent(domain)}`, apiKey);
|
|
15
|
-
}
|
|
16
|
-
async function registerDomain(apiKey, domain, years) {
|
|
17
|
-
return (0, client_1.request)('POST', `${BASE_URL}/domain/register`, apiKey, { domain, years });
|
|
18
|
-
}
|
|
19
|
-
async function importDomain(apiKey, payload) {
|
|
20
|
-
return (0, client_1.request)('POST', `${BASE_URL}/domain/import`, apiKey, payload);
|
|
21
|
-
}
|
|
22
|
-
async function listDomains(apiKey) {
|
|
23
|
-
return (0, client_1.request)('GET', `${BASE_URL}/domain/list/me`, apiKey);
|
|
24
|
-
}
|
|
25
|
-
async function getDomainStatus(apiKey, domain) {
|
|
26
|
-
return (0, client_1.request)('GET', `${BASE_URL}/domain/status/${encodeURIComponent(domain)}`, apiKey);
|
|
27
|
-
}
|
|
28
|
-
async function renewDomain(apiKey, domain, years) {
|
|
29
|
-
return (0, client_1.request)('POST', `${BASE_URL}/domain/renew/${encodeURIComponent(domain)}`, apiKey, { years });
|
|
30
|
-
}
|
|
31
|
-
async function getDomainSettings(apiKey, domain) {
|
|
32
|
-
return (0, client_1.request)('GET', `${BASE_URL}/domain/settings/${encodeURIComponent(domain)}`, apiKey);
|
|
33
|
-
}
|
|
34
|
-
async function updateDomainSettings(apiKey, domain, payload) {
|
|
35
|
-
return (0, client_1.request)('POST', `${BASE_URL}/domain/settings/${encodeURIComponent(domain)}`, apiKey, payload);
|
|
36
|
-
}
|
package/dist/sdk/src/email.d.ts
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
export interface EmailMessage {
|
|
2
|
-
message_id: string;
|
|
3
|
-
from: string;
|
|
4
|
-
subject: string;
|
|
5
|
-
body?: string;
|
|
6
|
-
received_at: string;
|
|
7
|
-
}
|
|
8
|
-
export interface EmailTemplate {
|
|
9
|
-
id: string;
|
|
10
|
-
name: string;
|
|
11
|
-
subject: string;
|
|
12
|
-
preview_url: string;
|
|
13
|
-
created_at: string;
|
|
14
|
-
updated_at: string;
|
|
15
|
-
}
|
|
16
|
-
export interface Campaign {
|
|
17
|
-
id: string;
|
|
18
|
-
name: string;
|
|
19
|
-
status: string;
|
|
20
|
-
template_id: string;
|
|
21
|
-
from_address: string;
|
|
22
|
-
rate_per_minute: number;
|
|
23
|
-
per_hour_limit: number;
|
|
24
|
-
created_at: string;
|
|
25
|
-
}
|
|
26
|
-
export interface CampaignStats {
|
|
27
|
-
campaign: Campaign;
|
|
28
|
-
validation: {
|
|
29
|
-
total: number;
|
|
30
|
-
valid: number;
|
|
31
|
-
invalid: number;
|
|
32
|
-
pending: number;
|
|
33
|
-
list_status: string;
|
|
34
|
-
};
|
|
35
|
-
dispatch: {
|
|
36
|
-
sent: number;
|
|
37
|
-
remaining: number;
|
|
38
|
-
sent_this_hour: number;
|
|
39
|
-
hour_limit: number;
|
|
40
|
-
last_dispatch_at: string;
|
|
41
|
-
};
|
|
42
|
-
engagement: {
|
|
43
|
-
sent: number;
|
|
44
|
-
opens: number;
|
|
45
|
-
clicks: number;
|
|
46
|
-
page_visits: number;
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
export declare function createMailbox(apiKey: string, domain: string, username: string): Promise<{
|
|
50
|
-
address: string;
|
|
51
|
-
created_at: string;
|
|
52
|
-
}>;
|
|
53
|
-
export declare function listMailboxes(apiKey: string): Promise<{
|
|
54
|
-
address: string;
|
|
55
|
-
created_at: string;
|
|
56
|
-
}[]>;
|
|
57
|
-
export declare function activateSending(apiKey: string, address: string): Promise<{
|
|
58
|
-
status: string;
|
|
59
|
-
}>;
|
|
60
|
-
export declare function sendEmail(apiKey: string, payload: {
|
|
61
|
-
from: string;
|
|
62
|
-
to: string[];
|
|
63
|
-
subject: string;
|
|
64
|
-
html?: string;
|
|
65
|
-
text?: string;
|
|
66
|
-
}): Promise<{
|
|
67
|
-
message_id: string;
|
|
68
|
-
}>;
|
|
69
|
-
export declare function getEmailStatus(apiKey: string, messageId: string): Promise<{
|
|
70
|
-
status: string;
|
|
71
|
-
delivered_at?: string;
|
|
72
|
-
}>;
|
|
73
|
-
export declare function getInbox(apiKey: string, address: string): Promise<EmailMessage[]>;
|
|
74
|
-
export declare function getMessage(apiKey: string, messageId: string, address: string): Promise<EmailMessage>;
|
|
75
|
-
export declare function startWarmup(apiKey: string, address: string): Promise<{
|
|
76
|
-
warmup_status: string;
|
|
77
|
-
}>;
|
|
78
|
-
export declare function pauseWarmup(apiKey: string, address: string): Promise<void>;
|
|
79
|
-
export declare function resumeWarmup(apiKey: string, address: string): Promise<void>;
|
|
80
|
-
export declare function stopWarmup(apiKey: string, address: string): Promise<void>;
|
|
81
|
-
export declare function getWarmupStats(apiKey: string, address: string): Promise<{
|
|
82
|
-
sent: number;
|
|
83
|
-
landed_inbox: number;
|
|
84
|
-
landed_spam: number;
|
|
85
|
-
health_score: number;
|
|
86
|
-
}>;
|
|
87
|
-
export declare function generateTemplate(apiKey: string, payload: {
|
|
88
|
-
org_id: string;
|
|
89
|
-
prompt: string;
|
|
90
|
-
name: string;
|
|
91
|
-
}): Promise<{
|
|
92
|
-
job_id: string;
|
|
93
|
-
template_id: string;
|
|
94
|
-
status: string;
|
|
95
|
-
preview_url: string;
|
|
96
|
-
}>;
|
|
97
|
-
export declare function getTemplateJobStatus(apiKey: string, jobId: string): Promise<{
|
|
98
|
-
status: 'processing' | 'completed' | 'failed';
|
|
99
|
-
template_id: string;
|
|
100
|
-
result?: {
|
|
101
|
-
subject: string;
|
|
102
|
-
preview_url: string;
|
|
103
|
-
};
|
|
104
|
-
}>;
|
|
105
|
-
export declare function editTemplate(apiKey: string, templateId: string, prompt: string): Promise<{
|
|
106
|
-
template_id: string;
|
|
107
|
-
preview_url: string;
|
|
108
|
-
}>;
|
|
109
|
-
export declare function sendTestEmail(apiKey: string, templateId: string, to: string): Promise<{
|
|
110
|
-
ok: boolean;
|
|
111
|
-
message_id: string;
|
|
112
|
-
}>;
|
|
113
|
-
export declare function listTemplates(apiKey: string): Promise<EmailTemplate[]>;
|
|
114
|
-
export declare function deleteTemplate(apiKey: string, templateId: string): Promise<void>;
|
|
115
|
-
export declare function createCampaign(apiKey: string, payload: {
|
|
116
|
-
name: string;
|
|
117
|
-
template_id: string;
|
|
118
|
-
from_address: string;
|
|
119
|
-
rate_per_minute?: number;
|
|
120
|
-
per_hour_limit?: number;
|
|
121
|
-
}): Promise<Campaign>;
|
|
122
|
-
export declare function uploadContactList(apiKey: string, campaignId: string, emails: string[]): Promise<{
|
|
123
|
-
list_id: string;
|
|
124
|
-
total: number;
|
|
125
|
-
status: string;
|
|
126
|
-
}>;
|
|
127
|
-
export declare function getContactUploadStatus(apiKey: string, campaignId: string): Promise<{
|
|
128
|
-
upload_status: 'ready' | 'validating' | 'failed';
|
|
129
|
-
total: number;
|
|
130
|
-
valid_count: number;
|
|
131
|
-
invalid_count: number;
|
|
132
|
-
}>;
|
|
133
|
-
export declare function startCampaign(apiKey: string, campaignId: string): Promise<{
|
|
134
|
-
status: string;
|
|
135
|
-
}>;
|
|
136
|
-
export declare function pauseCampaign(apiKey: string, campaignId: string): Promise<void>;
|
|
137
|
-
export declare function resumeCampaign(apiKey: string, campaignId: string): Promise<void>;
|
|
138
|
-
export declare function getCampaignStats(apiKey: string, campaignId: string): Promise<CampaignStats>;
|
|
139
|
-
export declare function listCampaigns(apiKey: string): Promise<Campaign[]>;
|
|
140
|
-
export declare function getCampaign(apiKey: string, campaignId: string): Promise<Campaign>;
|
|
141
|
-
export declare function updateCampaign(apiKey: string, campaignId: string, payload: {
|
|
142
|
-
name?: string;
|
|
143
|
-
per_day_limit?: number;
|
|
144
|
-
}): Promise<Campaign>;
|
package/dist/sdk/src/email.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createMailbox = createMailbox;
|
|
4
|
-
exports.listMailboxes = listMailboxes;
|
|
5
|
-
exports.activateSending = activateSending;
|
|
6
|
-
exports.sendEmail = sendEmail;
|
|
7
|
-
exports.getEmailStatus = getEmailStatus;
|
|
8
|
-
exports.getInbox = getInbox;
|
|
9
|
-
exports.getMessage = getMessage;
|
|
10
|
-
exports.startWarmup = startWarmup;
|
|
11
|
-
exports.pauseWarmup = pauseWarmup;
|
|
12
|
-
exports.resumeWarmup = resumeWarmup;
|
|
13
|
-
exports.stopWarmup = stopWarmup;
|
|
14
|
-
exports.getWarmupStats = getWarmupStats;
|
|
15
|
-
exports.generateTemplate = generateTemplate;
|
|
16
|
-
exports.getTemplateJobStatus = getTemplateJobStatus;
|
|
17
|
-
exports.editTemplate = editTemplate;
|
|
18
|
-
exports.sendTestEmail = sendTestEmail;
|
|
19
|
-
exports.listTemplates = listTemplates;
|
|
20
|
-
exports.deleteTemplate = deleteTemplate;
|
|
21
|
-
exports.createCampaign = createCampaign;
|
|
22
|
-
exports.uploadContactList = uploadContactList;
|
|
23
|
-
exports.getContactUploadStatus = getContactUploadStatus;
|
|
24
|
-
exports.startCampaign = startCampaign;
|
|
25
|
-
exports.pauseCampaign = pauseCampaign;
|
|
26
|
-
exports.resumeCampaign = resumeCampaign;
|
|
27
|
-
exports.getCampaignStats = getCampaignStats;
|
|
28
|
-
exports.listCampaigns = listCampaigns;
|
|
29
|
-
exports.getCampaign = getCampaign;
|
|
30
|
-
exports.updateCampaign = updateCampaign;
|
|
31
|
-
const client_1 = require("./client");
|
|
32
|
-
const BASE_URL = 'https://api.myemailapi.com';
|
|
33
|
-
async function createMailbox(apiKey, domain, username) {
|
|
34
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/mailbox/create`, apiKey, { domain, username });
|
|
35
|
-
}
|
|
36
|
-
async function listMailboxes(apiKey) {
|
|
37
|
-
return (0, client_1.request)('GET', `${BASE_URL}/email/mailbox/list/me`, apiKey);
|
|
38
|
-
}
|
|
39
|
-
async function activateSending(apiKey, address) {
|
|
40
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/sending/activate`, apiKey, { address });
|
|
41
|
-
}
|
|
42
|
-
async function sendEmail(apiKey, payload) {
|
|
43
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/send`, apiKey, payload);
|
|
44
|
-
}
|
|
45
|
-
async function getEmailStatus(apiKey, messageId) {
|
|
46
|
-
return (0, client_1.request)('GET', `${BASE_URL}/email/status/${encodeURIComponent(messageId)}`, apiKey);
|
|
47
|
-
}
|
|
48
|
-
async function getInbox(apiKey, address) {
|
|
49
|
-
return (0, client_1.request)('GET', `${BASE_URL}/email/inbox/${encodeURIComponent(address)}`, apiKey);
|
|
50
|
-
}
|
|
51
|
-
async function getMessage(apiKey, messageId, address) {
|
|
52
|
-
return (0, client_1.request)('GET', `${BASE_URL}/email/message/${encodeURIComponent(messageId)}?address=${encodeURIComponent(address)}`, apiKey);
|
|
53
|
-
}
|
|
54
|
-
async function startWarmup(apiKey, address) {
|
|
55
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/warmup/start`, apiKey, { address });
|
|
56
|
-
}
|
|
57
|
-
async function pauseWarmup(apiKey, address) {
|
|
58
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/warmup/pause`, apiKey, { address });
|
|
59
|
-
}
|
|
60
|
-
async function resumeWarmup(apiKey, address) {
|
|
61
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/warmup/resume`, apiKey, { address });
|
|
62
|
-
}
|
|
63
|
-
async function stopWarmup(apiKey, address) {
|
|
64
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/warmup/stop`, apiKey, { address });
|
|
65
|
-
}
|
|
66
|
-
async function getWarmupStats(apiKey, address) {
|
|
67
|
-
return (0, client_1.request)('GET', `${BASE_URL}/email/warmup/stats/${encodeURIComponent(address)}`, apiKey);
|
|
68
|
-
}
|
|
69
|
-
async function generateTemplate(apiKey, payload) {
|
|
70
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/templates/generate`, apiKey, payload);
|
|
71
|
-
}
|
|
72
|
-
async function getTemplateJobStatus(apiKey, jobId) {
|
|
73
|
-
return (0, client_1.request)('GET', `${BASE_URL}/email/template-jobs/${encodeURIComponent(jobId)}`, apiKey);
|
|
74
|
-
}
|
|
75
|
-
async function editTemplate(apiKey, templateId, prompt) {
|
|
76
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/templates/${encodeURIComponent(templateId)}/edit`, apiKey, { prompt });
|
|
77
|
-
}
|
|
78
|
-
async function sendTestEmail(apiKey, templateId, to) {
|
|
79
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/templates/${encodeURIComponent(templateId)}/send-test`, apiKey, { to });
|
|
80
|
-
}
|
|
81
|
-
async function listTemplates(apiKey) {
|
|
82
|
-
return (0, client_1.request)('GET', `${BASE_URL}/email/templates`, apiKey);
|
|
83
|
-
}
|
|
84
|
-
async function deleteTemplate(apiKey, templateId) {
|
|
85
|
-
return (0, client_1.request)('DELETE', `${BASE_URL}/email/templates/${encodeURIComponent(templateId)}`, apiKey);
|
|
86
|
-
}
|
|
87
|
-
async function createCampaign(apiKey, payload) {
|
|
88
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/campaigns`, apiKey, payload);
|
|
89
|
-
}
|
|
90
|
-
async function uploadContactList(apiKey, campaignId, emails) {
|
|
91
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}/contacts/upload-list`, apiKey, { emails });
|
|
92
|
-
}
|
|
93
|
-
async function getContactUploadStatus(apiKey, campaignId) {
|
|
94
|
-
return (0, client_1.request)('GET', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}/contacts/status`, apiKey);
|
|
95
|
-
}
|
|
96
|
-
async function startCampaign(apiKey, campaignId) {
|
|
97
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}/start`, apiKey);
|
|
98
|
-
}
|
|
99
|
-
async function pauseCampaign(apiKey, campaignId) {
|
|
100
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}/pause`, apiKey);
|
|
101
|
-
}
|
|
102
|
-
async function resumeCampaign(apiKey, campaignId) {
|
|
103
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}/resume`, apiKey);
|
|
104
|
-
}
|
|
105
|
-
async function getCampaignStats(apiKey, campaignId) {
|
|
106
|
-
return (0, client_1.request)('GET', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}/stats`, apiKey);
|
|
107
|
-
}
|
|
108
|
-
async function listCampaigns(apiKey) {
|
|
109
|
-
return (0, client_1.request)('GET', `${BASE_URL}/email/campaigns`, apiKey);
|
|
110
|
-
}
|
|
111
|
-
async function getCampaign(apiKey, campaignId) {
|
|
112
|
-
return (0, client_1.request)('GET', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}`, apiKey);
|
|
113
|
-
}
|
|
114
|
-
async function updateCampaign(apiKey, campaignId, payload) {
|
|
115
|
-
return (0, client_1.request)('PATCH', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}`, apiKey, payload);
|
|
116
|
-
}
|
package/dist/sdk/src/funnel.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export interface Funnel {
|
|
2
|
-
id: string;
|
|
3
|
-
org_id: string;
|
|
4
|
-
domain: string;
|
|
5
|
-
created_at: string;
|
|
6
|
-
}
|
|
7
|
-
export interface VerifyResult {
|
|
8
|
-
pages?: Array<{
|
|
9
|
-
slug: string;
|
|
10
|
-
tests: VerifyTest[];
|
|
11
|
-
}>;
|
|
12
|
-
tests?: VerifyTest[];
|
|
13
|
-
}
|
|
14
|
-
export interface VerifyTest {
|
|
15
|
-
type: 'link' | 'webhook';
|
|
16
|
-
url: string;
|
|
17
|
-
passed: boolean;
|
|
18
|
-
details: string;
|
|
19
|
-
}
|
|
20
|
-
export declare function createFunnel(apiKey: string, orgId: string, domain: string): Promise<Funnel>;
|
|
21
|
-
export declare function pushPage(apiKey: string, funnelId: string, slug: string, html: string): Promise<{
|
|
22
|
-
status: string;
|
|
23
|
-
key: string;
|
|
24
|
-
}>;
|
|
25
|
-
export declare function verifyFunnel(apiKey: string, funnelId: string, opts?: {
|
|
26
|
-
html?: string;
|
|
27
|
-
slug?: string;
|
|
28
|
-
}): Promise<VerifyResult>;
|
|
29
|
-
export declare function listFunnels(apiKey: string): Promise<Funnel[]>;
|
|
30
|
-
export declare function getFunnel(apiKey: string, funnelId: string): Promise<Funnel>;
|
|
31
|
-
export declare function deleteFunnel(apiKey: string, funnelId: string): Promise<void>;
|
package/dist/sdk/src/funnel.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createFunnel = createFunnel;
|
|
4
|
-
exports.pushPage = pushPage;
|
|
5
|
-
exports.verifyFunnel = verifyFunnel;
|
|
6
|
-
exports.listFunnels = listFunnels;
|
|
7
|
-
exports.getFunnel = getFunnel;
|
|
8
|
-
exports.deleteFunnel = deleteFunnel;
|
|
9
|
-
const client_1 = require("./client");
|
|
10
|
-
const BASE_URL = 'https://api.myfunnelapi.com';
|
|
11
|
-
async function createFunnel(apiKey, orgId, domain) {
|
|
12
|
-
return (0, client_1.request)('POST', `${BASE_URL}/funnel/funnels/create-raw`, apiKey, { org_id: orgId, domain });
|
|
13
|
-
}
|
|
14
|
-
async function pushPage(apiKey, funnelId, slug, html) {
|
|
15
|
-
return (0, client_1.request)('POST', `${BASE_URL}/funnel/funnels/${encodeURIComponent(funnelId)}/push-page`, apiKey, { slug, html });
|
|
16
|
-
}
|
|
17
|
-
async function verifyFunnel(apiKey, funnelId, opts) {
|
|
18
|
-
return (0, client_1.request)('POST', `${BASE_URL}/funnel/funnels/${encodeURIComponent(funnelId)}/verify`, apiKey, opts || {});
|
|
19
|
-
}
|
|
20
|
-
async function listFunnels(apiKey) {
|
|
21
|
-
return (0, client_1.request)('GET', `${BASE_URL}/funnel/funnels`, apiKey);
|
|
22
|
-
}
|
|
23
|
-
async function getFunnel(apiKey, funnelId) {
|
|
24
|
-
return (0, client_1.request)('GET', `${BASE_URL}/funnel/funnels/${encodeURIComponent(funnelId)}`, apiKey);
|
|
25
|
-
}
|
|
26
|
-
async function deleteFunnel(apiKey, funnelId) {
|
|
27
|
-
return (0, client_1.request)('DELETE', `${BASE_URL}/funnel/funnels/${encodeURIComponent(funnelId)}`, apiKey);
|
|
28
|
-
}
|