@myapihq/sdk 1.0.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/client.d.ts +6 -0
- package/dist/client.js +51 -0
- package/dist/domain.d.ts +32 -0
- package/dist/domain.js +36 -0
- package/dist/email.d.ts +144 -0
- package/dist/email.js +116 -0
- package/dist/funnel.d.ts +31 -0
- package/dist/funnel.js +28 -0
- package/dist/hq.d.ts +84 -0
- package/dist/hq.js +80 -0
- package/dist/image.d.ts +21 -0
- package/dist/image.js +16 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +50 -0
- package/dist/pixel.d.ts +65 -0
- package/dist/pixel.js +44 -0
- package/dist/storage.d.ts +10 -0
- package/dist/storage.js +48 -0
- package/dist/types.d.ts +17 -0
- package/dist/types.js +2 -0
- package/dist/webhook.d.ts +20 -0
- package/dist/webhook.js +20 -0
- package/dist/workflow.d.ts +56 -0
- package/dist/workflow.js +40 -0
- package/package.json +15 -0
- package/src/client.ts +59 -0
- package/src/domain.ts +54 -0
- package/src/email.ts +102 -0
- package/src/funnel.ts +29 -0
- package/src/hq.ts +109 -0
- package/src/image.ts +31 -0
- package/src/index.ts +11 -0
- package/src/pixel.ts +61 -0
- package/src/storage.ts +55 -0
- package/src/types.ts +13 -0
- package/src/webhook.ts +22 -0
- package/src/workflow.ts +51 -0
- package/tsconfig.json +14 -0
package/dist/client.d.ts
ADDED
package/dist/client.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
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/domain.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
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/domain.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
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/email.d.ts
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
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/email.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
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/funnel.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
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/funnel.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
}
|
package/dist/hq.d.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export interface Org {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
tagline?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
business_sector?: string;
|
|
7
|
+
logo_url?: string;
|
|
8
|
+
favicon_url?: string;
|
|
9
|
+
og_image_url?: string;
|
|
10
|
+
color_palette?: Record<string, string>;
|
|
11
|
+
font_family?: string;
|
|
12
|
+
imagery_style?: string;
|
|
13
|
+
headline?: string;
|
|
14
|
+
subheadline?: string;
|
|
15
|
+
cta_text?: string;
|
|
16
|
+
value_propositions?: string[];
|
|
17
|
+
social_links?: Record<string, string>;
|
|
18
|
+
canonical_url?: string;
|
|
19
|
+
privacy_policy_url?: string;
|
|
20
|
+
cookie_policy_url?: string;
|
|
21
|
+
terms_url?: string;
|
|
22
|
+
gdpr_enabled?: boolean;
|
|
23
|
+
default_language?: string;
|
|
24
|
+
tracking?: Record<string, unknown>;
|
|
25
|
+
created_at: string;
|
|
26
|
+
updated_at: string;
|
|
27
|
+
}
|
|
28
|
+
export type OrgPayload = Omit<Org, 'id' | 'created_at' | 'updated_at'>;
|
|
29
|
+
export declare function createAgentAccount(): Promise<{
|
|
30
|
+
account_id: string;
|
|
31
|
+
pin: string;
|
|
32
|
+
token: string;
|
|
33
|
+
}>;
|
|
34
|
+
export declare function recoverAgentToken(pin: string): Promise<{
|
|
35
|
+
token: string;
|
|
36
|
+
}>;
|
|
37
|
+
export declare function createApiKey(jwtToken: string, name: string): Promise<{
|
|
38
|
+
api_key: string;
|
|
39
|
+
id: string;
|
|
40
|
+
prefix: string;
|
|
41
|
+
}>;
|
|
42
|
+
export declare function listApiKeys(apiKey: string): Promise<{
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
prefix: string;
|
|
46
|
+
created_at: string;
|
|
47
|
+
}[]>;
|
|
48
|
+
export declare function revokeApiKey(apiKey: string, keyId: string): Promise<void>;
|
|
49
|
+
export declare function linkAgent(apiKey: string, pin: string): Promise<void>;
|
|
50
|
+
export declare function listLinkedAgents(apiKey: string): Promise<{
|
|
51
|
+
account_id: string;
|
|
52
|
+
created_at: string;
|
|
53
|
+
}[]>;
|
|
54
|
+
export declare function createOrg(apiKey: string, payload: OrgPayload): Promise<Org>;
|
|
55
|
+
export declare function importOrg(apiKey: string, domain: string, autoAccept?: boolean): Promise<{
|
|
56
|
+
job_id: string;
|
|
57
|
+
status: string;
|
|
58
|
+
}>;
|
|
59
|
+
export declare function getOrgImportStatus(apiKey: string, jobId: string): Promise<{
|
|
60
|
+
status: string;
|
|
61
|
+
brand_preview: unknown;
|
|
62
|
+
}>;
|
|
63
|
+
export declare function confirmOrgImport(apiKey: string, jobId: string, overrides?: Partial<OrgPayload>): Promise<Org>;
|
|
64
|
+
export declare function listOrgs(apiKey: string): Promise<Org[]>;
|
|
65
|
+
export declare function getOrg(apiKey: string, orgId: string): Promise<Org>;
|
|
66
|
+
export declare function updateOrg(apiKey: string, orgId: string, payload: Partial<OrgPayload>): Promise<Org>;
|
|
67
|
+
export declare function deleteOrg(apiKey: string, orgId: string): Promise<void>;
|
|
68
|
+
export declare function getBalance(apiKey: string): Promise<{
|
|
69
|
+
balance_cents: number;
|
|
70
|
+
balance_display: string;
|
|
71
|
+
has_payment_method: boolean;
|
|
72
|
+
}>;
|
|
73
|
+
export declare function getBillingHistory(apiKey: string): Promise<{
|
|
74
|
+
amount_cents: number;
|
|
75
|
+
status: string;
|
|
76
|
+
created_at: string;
|
|
77
|
+
}[]>;
|
|
78
|
+
export declare function setupPayment(apiKey: string): Promise<{
|
|
79
|
+
url: string;
|
|
80
|
+
}>;
|
|
81
|
+
export declare function topUp(apiKey: string, amountCents: number): Promise<{
|
|
82
|
+
new_balance_cents: number;
|
|
83
|
+
new_balance_display: string;
|
|
84
|
+
}>;
|
package/dist/hq.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAgentAccount = createAgentAccount;
|
|
4
|
+
exports.recoverAgentToken = recoverAgentToken;
|
|
5
|
+
exports.createApiKey = createApiKey;
|
|
6
|
+
exports.listApiKeys = listApiKeys;
|
|
7
|
+
exports.revokeApiKey = revokeApiKey;
|
|
8
|
+
exports.linkAgent = linkAgent;
|
|
9
|
+
exports.listLinkedAgents = listLinkedAgents;
|
|
10
|
+
exports.createOrg = createOrg;
|
|
11
|
+
exports.importOrg = importOrg;
|
|
12
|
+
exports.getOrgImportStatus = getOrgImportStatus;
|
|
13
|
+
exports.confirmOrgImport = confirmOrgImport;
|
|
14
|
+
exports.listOrgs = listOrgs;
|
|
15
|
+
exports.getOrg = getOrg;
|
|
16
|
+
exports.updateOrg = updateOrg;
|
|
17
|
+
exports.deleteOrg = deleteOrg;
|
|
18
|
+
exports.getBalance = getBalance;
|
|
19
|
+
exports.getBillingHistory = getBillingHistory;
|
|
20
|
+
exports.setupPayment = setupPayment;
|
|
21
|
+
exports.topUp = topUp;
|
|
22
|
+
const client_1 = require("./client");
|
|
23
|
+
const BASE_URL = 'https://api.myapihq.com';
|
|
24
|
+
async function createAgentAccount() {
|
|
25
|
+
return (0, client_1.request)('POST', `${BASE_URL}/hq/account/agent/create`);
|
|
26
|
+
}
|
|
27
|
+
async function recoverAgentToken(pin) {
|
|
28
|
+
return (0, client_1.request)('POST', `${BASE_URL}/hq/account/agent/token`, undefined, { pin });
|
|
29
|
+
}
|
|
30
|
+
async function createApiKey(jwtToken, name) {
|
|
31
|
+
return (0, client_1.request)('POST', `${BASE_URL}/hq/account/create/key`, jwtToken, { name });
|
|
32
|
+
}
|
|
33
|
+
async function listApiKeys(apiKey) {
|
|
34
|
+
return (0, client_1.request)('GET', `${BASE_URL}/hq/account/keys`, apiKey);
|
|
35
|
+
}
|
|
36
|
+
async function revokeApiKey(apiKey, keyId) {
|
|
37
|
+
return (0, client_1.request)('DELETE', `${BASE_URL}/hq/account/delete/key/${encodeURIComponent(keyId)}`, apiKey);
|
|
38
|
+
}
|
|
39
|
+
async function linkAgent(apiKey, pin) {
|
|
40
|
+
return (0, client_1.request)('POST', `${BASE_URL}/hq/account/link-agent`, apiKey, { pin });
|
|
41
|
+
}
|
|
42
|
+
async function listLinkedAgents(apiKey) {
|
|
43
|
+
return (0, client_1.request)('GET', `${BASE_URL}/hq/account/agents`, apiKey);
|
|
44
|
+
}
|
|
45
|
+
async function createOrg(apiKey, payload) {
|
|
46
|
+
return (0, client_1.request)('POST', `${BASE_URL}/hq/orgs`, apiKey, payload);
|
|
47
|
+
}
|
|
48
|
+
async function importOrg(apiKey, domain, autoAccept) {
|
|
49
|
+
return (0, client_1.request)('POST', `${BASE_URL}/hq/org-imports`, apiKey, { domain, auto_accept: autoAccept });
|
|
50
|
+
}
|
|
51
|
+
async function getOrgImportStatus(apiKey, jobId) {
|
|
52
|
+
return (0, client_1.request)('GET', `${BASE_URL}/hq/org-imports/${encodeURIComponent(jobId)}`, apiKey);
|
|
53
|
+
}
|
|
54
|
+
async function confirmOrgImport(apiKey, jobId, overrides) {
|
|
55
|
+
return (0, client_1.request)('POST', `${BASE_URL}/hq/org-imports/${encodeURIComponent(jobId)}/confirm`, apiKey, overrides);
|
|
56
|
+
}
|
|
57
|
+
async function listOrgs(apiKey) {
|
|
58
|
+
return (0, client_1.request)('GET', `${BASE_URL}/hq/orgs`, apiKey);
|
|
59
|
+
}
|
|
60
|
+
async function getOrg(apiKey, orgId) {
|
|
61
|
+
return (0, client_1.request)('GET', `${BASE_URL}/hq/orgs/${encodeURIComponent(orgId)}`, apiKey);
|
|
62
|
+
}
|
|
63
|
+
async function updateOrg(apiKey, orgId, payload) {
|
|
64
|
+
return (0, client_1.request)('PATCH', `${BASE_URL}/hq/orgs/${encodeURIComponent(orgId)}`, apiKey, payload);
|
|
65
|
+
}
|
|
66
|
+
async function deleteOrg(apiKey, orgId) {
|
|
67
|
+
return (0, client_1.request)('DELETE', `${BASE_URL}/hq/orgs/${encodeURIComponent(orgId)}`, apiKey);
|
|
68
|
+
}
|
|
69
|
+
async function getBalance(apiKey) {
|
|
70
|
+
return (0, client_1.request)('GET', `${BASE_URL}/hq/billing/balance`, apiKey);
|
|
71
|
+
}
|
|
72
|
+
async function getBillingHistory(apiKey) {
|
|
73
|
+
return (0, client_1.request)('GET', `${BASE_URL}/hq/billing/history`, apiKey);
|
|
74
|
+
}
|
|
75
|
+
async function setupPayment(apiKey) {
|
|
76
|
+
return (0, client_1.request)('POST', `${BASE_URL}/hq/billing/setup-payment`, apiKey);
|
|
77
|
+
}
|
|
78
|
+
async function topUp(apiKey, amountCents) {
|
|
79
|
+
return (0, client_1.request)('POST', `${BASE_URL}/hq/billing/topup`, apiKey, { amount_cents: amountCents });
|
|
80
|
+
}
|
package/dist/image.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface ImageJob {
|
|
2
|
+
job_id: string;
|
|
3
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
4
|
+
url?: string;
|
|
5
|
+
error?: string;
|
|
6
|
+
prompt: string;
|
|
7
|
+
aspect_ratio: string;
|
|
8
|
+
created_at: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function generateImage(apiKey: string, payload: {
|
|
11
|
+
prompt: string;
|
|
12
|
+
aspect_ratio?: '1:1' | '16:9' | '9:16' | '4:3' | '3:4';
|
|
13
|
+
style?: string;
|
|
14
|
+
colors?: string;
|
|
15
|
+
has_text?: boolean;
|
|
16
|
+
}): Promise<{
|
|
17
|
+
job_id: string;
|
|
18
|
+
status: string;
|
|
19
|
+
}>;
|
|
20
|
+
export declare function getImageJob(apiKey: string, jobId: string): Promise<ImageJob>;
|
|
21
|
+
export declare function listImages(apiKey: string): Promise<ImageJob[]>;
|
package/dist/image.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateImage = generateImage;
|
|
4
|
+
exports.getImageJob = getImageJob;
|
|
5
|
+
exports.listImages = listImages;
|
|
6
|
+
const client_1 = require("./client");
|
|
7
|
+
const BASE_URL = 'https://api.myimageapi.com';
|
|
8
|
+
async function generateImage(apiKey, payload) {
|
|
9
|
+
return (0, client_1.request)('POST', `${BASE_URL}/image/generate`, apiKey, payload);
|
|
10
|
+
}
|
|
11
|
+
async function getImageJob(apiKey, jobId) {
|
|
12
|
+
return (0, client_1.request)('GET', `${BASE_URL}/image/jobs/${encodeURIComponent(jobId)}`, apiKey);
|
|
13
|
+
}
|
|
14
|
+
async function listImages(apiKey) {
|
|
15
|
+
return (0, client_1.request)('GET', `${BASE_URL}/image/list`, apiKey);
|
|
16
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './types';
|
|
2
|
+
export * from './client';
|
|
3
|
+
export * as hq from './hq';
|
|
4
|
+
export * as domain from './domain';
|
|
5
|
+
export * as email from './email';
|
|
6
|
+
export * as funnel from './funnel';
|
|
7
|
+
export * as image from './image';
|
|
8
|
+
export * as pixel from './pixel';
|
|
9
|
+
export * as storage from './storage';
|
|
10
|
+
export * as webhook from './webhook';
|
|
11
|
+
export * as workflow from './workflow';
|