@myapihq/sdk 1.0.41 → 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/config.d.ts +10 -0
- package/dist/config.js +13 -0
- package/dist/domain.js +10 -10
- package/dist/email.d.ts +20 -14
- package/dist/email.js +69 -45
- package/dist/funnel.js +7 -7
- package/dist/hq.d.ts +18 -0
- package/dist/hq.js +36 -16
- package/dist/image.js +5 -5
- package/dist/index.js +0 -1
- package/dist/pixel.js +5 -5
- package/dist/storage.js +5 -5
- package/dist/url.js +2 -2
- package/dist/webhook.d.ts +3 -4
- package/dist/webhook.js +5 -5
- package/dist/workflow.d.ts +15 -2
- package/dist/workflow.js +10 -10
- package/package.json +1 -1
- package/src/config.ts +10 -0
- package/src/domain.ts +2 -1
- package/src/email.ts +82 -30
- package/src/funnel.ts +2 -1
- package/src/hq.ts +34 -2
- package/src/image.ts +2 -1
- package/src/index.ts +0 -1
- package/src/pixel.ts +2 -1
- package/src/storage.ts +2 -1
- package/src/url.ts +2 -1
- package/src/webhook.ts +16 -3
- package/src/workflow.ts +35 -3
- package/src/client.d.ts +0 -6
- package/src/client.js +0 -51
- package/src/domain.d.ts +0 -32
- package/src/domain.js +0 -36
- package/src/email.d.ts +0 -144
- package/src/email.js +0 -116
- package/src/funnel.d.ts +0 -31
- package/src/funnel.js +0 -28
- package/src/hq.d.ts +0 -85
- package/src/hq.js +0 -80
- package/src/image.d.ts +0 -21
- package/src/image.js +0 -16
- package/src/index.d.ts +0 -11
- package/src/index.js +0 -51
- package/src/pixel.d.ts +0 -65
- package/src/pixel.js +0 -44
- package/src/storage.d.ts +0 -10
- package/src/storage.js +0 -48
- package/src/types.d.ts +0 -17
- package/src/types.js +0 -2
- package/src/webhook.d.ts +0 -20
- package/src/webhook.js +0 -20
- package/src/workflow.d.ts +0 -56
- package/src/workflow.js +0 -40
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const HQ_BASE: string;
|
|
2
|
+
export declare const DOMAIN_BASE: string;
|
|
3
|
+
export declare const FUNNEL_BASE: string;
|
|
4
|
+
export declare const IMAGE_BASE: string;
|
|
5
|
+
export declare const WEBHOOK_BASE: string;
|
|
6
|
+
export declare const WORKFLOW_BASE: string;
|
|
7
|
+
export declare const EMAIL_BASE: string;
|
|
8
|
+
export declare const STORAGE_BASE: string;
|
|
9
|
+
export declare const URL_BASE: string;
|
|
10
|
+
export declare const PIXEL_BASE: string;
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PIXEL_BASE = exports.URL_BASE = exports.STORAGE_BASE = exports.EMAIL_BASE = exports.WORKFLOW_BASE = exports.WEBHOOK_BASE = exports.IMAGE_BASE = exports.FUNNEL_BASE = exports.DOMAIN_BASE = exports.HQ_BASE = void 0;
|
|
4
|
+
exports.HQ_BASE = process.env.MYAPI_HQ_URL ?? process.env.MYAPI_API_BASE ?? 'https://api.myapihq.com';
|
|
5
|
+
exports.DOMAIN_BASE = process.env.MYAPI_DOMAIN_URL ?? 'https://api.mydomainapi.com';
|
|
6
|
+
exports.FUNNEL_BASE = process.env.MYAPI_FUNNEL_URL ?? 'https://api.myfunnelapi.com';
|
|
7
|
+
exports.IMAGE_BASE = process.env.MYAPI_IMAGE_URL ?? 'https://api.myimageapi.com';
|
|
8
|
+
exports.WEBHOOK_BASE = process.env.MYAPI_WEBHOOK_URL ?? 'https://api.mywebhookapi.com';
|
|
9
|
+
exports.WORKFLOW_BASE = process.env.MYAPI_WORKFLOW_URL ?? 'https://api.myworkflowapi.com';
|
|
10
|
+
exports.EMAIL_BASE = process.env.MYAPI_EMAIL_URL ?? 'https://api.myemailapi.com';
|
|
11
|
+
exports.STORAGE_BASE = process.env.MYAPI_STORAGE_URL ?? 'https://api.mystorageapi.com';
|
|
12
|
+
exports.URL_BASE = process.env.MYAPI_URL_URL ?? 'https://api.myurlto.com';
|
|
13
|
+
exports.PIXEL_BASE = process.env.MYAPI_PIXEL_URL ?? 'https://api.mypixelapi.com';
|
package/dist/domain.js
CHANGED
|
@@ -10,32 +10,32 @@ exports.unassignDomain = unassignDomain;
|
|
|
10
10
|
exports.getDomainSettings = getDomainSettings;
|
|
11
11
|
exports.updateDomainSettings = updateDomainSettings;
|
|
12
12
|
const client_1 = require("./client");
|
|
13
|
-
const
|
|
13
|
+
const config_1 = require("./config");
|
|
14
14
|
async function checkDomain(apiKey, orgId, domain) {
|
|
15
|
-
return (0, client_1.request)('GET', `${
|
|
15
|
+
return (0, client_1.request)('GET', `${config_1.DOMAIN_BASE}/domain/orgs/${encodeURIComponent(orgId)}/check/available/${encodeURIComponent(domain)}`, apiKey);
|
|
16
16
|
}
|
|
17
17
|
async function registerDomain(apiKey, orgId, domain, years) {
|
|
18
|
-
return (0, client_1.request)('POST', `${
|
|
18
|
+
return (0, client_1.request)('POST', `${config_1.DOMAIN_BASE}/domain/orgs/${encodeURIComponent(orgId)}/register`, apiKey, { domain, years });
|
|
19
19
|
}
|
|
20
20
|
async function importDomain(apiKey, orgId, payload) {
|
|
21
|
-
return (0, client_1.request)('POST', `${
|
|
21
|
+
return (0, client_1.request)('POST', `${config_1.DOMAIN_BASE}/domain/orgs/${encodeURIComponent(orgId)}/import`, apiKey, payload);
|
|
22
22
|
}
|
|
23
23
|
async function listDomains(apiKey, orgId, filter) {
|
|
24
24
|
const query = filter ? `?filter=${encodeURIComponent(filter)}` : '';
|
|
25
|
-
return (0, client_1.request)('GET', `${
|
|
25
|
+
return (0, client_1.request)('GET', `${config_1.DOMAIN_BASE}/domain/orgs/${encodeURIComponent(orgId)}/list${query}`, apiKey);
|
|
26
26
|
}
|
|
27
27
|
async function getDomainStatus(apiKey, orgId, domain) {
|
|
28
|
-
return (0, client_1.request)('GET', `${
|
|
28
|
+
return (0, client_1.request)('GET', `${config_1.DOMAIN_BASE}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/status`, apiKey);
|
|
29
29
|
}
|
|
30
30
|
async function assignDomain(apiKey, orgId, domain) {
|
|
31
|
-
return (0, client_1.request)('POST', `${
|
|
31
|
+
return (0, client_1.request)('POST', `${config_1.DOMAIN_BASE}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/assign`, apiKey, { org_id: orgId });
|
|
32
32
|
}
|
|
33
33
|
async function unassignDomain(apiKey, orgId, domain) {
|
|
34
|
-
return (0, client_1.request)('POST', `${
|
|
34
|
+
return (0, client_1.request)('POST', `${config_1.DOMAIN_BASE}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/assign`, apiKey, { org_id: null });
|
|
35
35
|
}
|
|
36
36
|
async function getDomainSettings(apiKey, orgId, domain) {
|
|
37
|
-
return (0, client_1.request)('GET', `${
|
|
37
|
+
return (0, client_1.request)('GET', `${config_1.DOMAIN_BASE}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/settings`, apiKey);
|
|
38
38
|
}
|
|
39
39
|
async function updateDomainSettings(apiKey, orgId, domain, payload) {
|
|
40
|
-
return (0, client_1.request)('POST', `${
|
|
40
|
+
return (0, client_1.request)('POST', `${config_1.DOMAIN_BASE}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/settings`, apiKey, payload);
|
|
41
41
|
}
|
package/dist/email.d.ts
CHANGED
|
@@ -52,21 +52,21 @@ export interface CampaignStats {
|
|
|
52
52
|
page_visits: number;
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
export declare function createMailbox(apiKey: string,
|
|
55
|
+
export declare function createMailbox(apiKey: string, domain: string, username: string, displayName?: string): Promise<{
|
|
56
56
|
address: string;
|
|
57
57
|
created_at: string;
|
|
58
58
|
}>;
|
|
59
|
-
export declare function listMailboxes(apiKey: string,
|
|
59
|
+
export declare function listMailboxes(apiKey: string, options?: {
|
|
60
60
|
domain?: string;
|
|
61
61
|
filter?: 'unassigned';
|
|
62
62
|
}): Promise<{
|
|
63
63
|
address: string;
|
|
64
64
|
created_at: string;
|
|
65
65
|
}[]>;
|
|
66
|
-
export declare function activateSending(apiKey: string,
|
|
66
|
+
export declare function activateSending(apiKey: string, address: string): Promise<{
|
|
67
67
|
status: string;
|
|
68
68
|
}>;
|
|
69
|
-
export declare function sendEmail(apiKey: string,
|
|
69
|
+
export declare function sendEmail(apiKey: string, payload: {
|
|
70
70
|
from: string;
|
|
71
71
|
to: string[];
|
|
72
72
|
subject: string;
|
|
@@ -77,21 +77,21 @@ export declare function sendEmail(apiKey: string, orgId: string, payload: {
|
|
|
77
77
|
}): Promise<{
|
|
78
78
|
message_id: string;
|
|
79
79
|
}>;
|
|
80
|
-
export declare function getEmailStatus(apiKey: string,
|
|
80
|
+
export declare function getEmailStatus(apiKey: string, messageId: string): Promise<{
|
|
81
81
|
status: string;
|
|
82
82
|
delivered_at?: string;
|
|
83
83
|
}>;
|
|
84
|
-
export declare function getSentEmails(apiKey: string,
|
|
85
|
-
export declare function getInbox(apiKey: string,
|
|
86
|
-
export declare function getOutbox(apiKey: string,
|
|
87
|
-
export declare function getMessage(apiKey: string,
|
|
88
|
-
export declare function startWarmup(apiKey: string,
|
|
84
|
+
export declare function getSentEmails(apiKey: string, limit?: number, offset?: number): Promise<EmailMessage[]>;
|
|
85
|
+
export declare function getInbox(apiKey: string, address: string): Promise<EmailMessage[]>;
|
|
86
|
+
export declare function getOutbox(apiKey: string, address: string): Promise<EmailMessage[]>;
|
|
87
|
+
export declare function getMessage(apiKey: string, messageId: string, address: string): Promise<EmailMessage>;
|
|
88
|
+
export declare function startWarmup(apiKey: string, address: string): Promise<{
|
|
89
89
|
warmup_status: string;
|
|
90
90
|
}>;
|
|
91
|
-
export declare function pauseWarmup(apiKey: string,
|
|
92
|
-
export declare function resumeWarmup(apiKey: string,
|
|
93
|
-
export declare function stopWarmup(apiKey: string,
|
|
94
|
-
export declare function getWarmupStats(apiKey: string,
|
|
91
|
+
export declare function pauseWarmup(apiKey: string, address: string): Promise<void>;
|
|
92
|
+
export declare function resumeWarmup(apiKey: string, address: string): Promise<void>;
|
|
93
|
+
export declare function stopWarmup(apiKey: string, address: string): Promise<void>;
|
|
94
|
+
export declare function getWarmupStats(apiKey: string, address: string): Promise<{
|
|
95
95
|
sent: number;
|
|
96
96
|
landed_inbox: number;
|
|
97
97
|
landed_spam: number;
|
|
@@ -114,6 +114,7 @@ export declare function getTemplateJobStatus(apiKey: string, orgId: string, jobI
|
|
|
114
114
|
preview_url: string;
|
|
115
115
|
};
|
|
116
116
|
}>;
|
|
117
|
+
export declare function getTemplate(apiKey: string, orgId: string, templateId: string): Promise<EmailTemplate>;
|
|
117
118
|
export declare function editTemplate(apiKey: string, orgId: string, templateId: string, prompt: string): Promise<{
|
|
118
119
|
template_id: string;
|
|
119
120
|
preview_url: string;
|
|
@@ -136,6 +137,11 @@ export declare function uploadContactList(apiKey: string, orgId: string, campaig
|
|
|
136
137
|
total: number;
|
|
137
138
|
status: string;
|
|
138
139
|
}>;
|
|
140
|
+
export declare function uploadContactsFile(apiKey: string, orgId: string, campaignId: string, file: Blob | ArrayBuffer | Uint8Array, filename?: string): Promise<{
|
|
141
|
+
list_id: string;
|
|
142
|
+
total: number;
|
|
143
|
+
status: string;
|
|
144
|
+
}>;
|
|
139
145
|
export declare function getContactUploadStatus(apiKey: string, orgId: string, campaignId: string): Promise<{
|
|
140
146
|
upload_status: 'ready' | 'validating' | 'failed';
|
|
141
147
|
total: number;
|
package/dist/email.js
CHANGED
|
@@ -16,12 +16,14 @@ exports.stopWarmup = stopWarmup;
|
|
|
16
16
|
exports.getWarmupStats = getWarmupStats;
|
|
17
17
|
exports.generateTemplate = generateTemplate;
|
|
18
18
|
exports.getTemplateJobStatus = getTemplateJobStatus;
|
|
19
|
+
exports.getTemplate = getTemplate;
|
|
19
20
|
exports.editTemplate = editTemplate;
|
|
20
21
|
exports.sendTestEmail = sendTestEmail;
|
|
21
22
|
exports.listTemplates = listTemplates;
|
|
22
23
|
exports.deleteTemplate = deleteTemplate;
|
|
23
24
|
exports.createCampaign = createCampaign;
|
|
24
25
|
exports.uploadContactList = uploadContactList;
|
|
26
|
+
exports.uploadContactsFile = uploadContactsFile;
|
|
25
27
|
exports.getContactUploadStatus = getContactUploadStatus;
|
|
26
28
|
exports.startCampaign = startCampaign;
|
|
27
29
|
exports.pauseCampaign = pauseCampaign;
|
|
@@ -31,100 +33,122 @@ exports.listCampaigns = listCampaigns;
|
|
|
31
33
|
exports.getCampaign = getCampaign;
|
|
32
34
|
exports.updateCampaign = updateCampaign;
|
|
33
35
|
const client_1 = require("./client");
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
const config_1 = require("./config");
|
|
37
|
+
// ── Mailbox ops (account-scoped) ─────────────────────────────────────────────
|
|
38
|
+
async function createMailbox(apiKey, domain, username, displayName) {
|
|
39
|
+
return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/mailboxes/create`, apiKey, { domain, username, display_name: displayName });
|
|
37
40
|
}
|
|
38
|
-
async function listMailboxes(apiKey,
|
|
41
|
+
async function listMailboxes(apiKey, options) {
|
|
39
42
|
const query = new URLSearchParams();
|
|
40
43
|
if (options?.domain)
|
|
41
44
|
query.append('domain', options.domain);
|
|
42
45
|
if (options?.filter)
|
|
43
46
|
query.append('filter', options.filter);
|
|
44
47
|
const qStr = query.toString();
|
|
45
|
-
return (0, client_1.request)('GET', `${
|
|
48
|
+
return (0, client_1.request)('GET', `${config_1.EMAIL_BASE}/email/mailboxes${qStr ? '?' + qStr : ''}`, apiKey);
|
|
46
49
|
}
|
|
47
|
-
async function activateSending(apiKey,
|
|
48
|
-
return (0, client_1.request)('POST', `${
|
|
50
|
+
async function activateSending(apiKey, address) {
|
|
51
|
+
return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/sending/activate`, apiKey, { address });
|
|
49
52
|
}
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
// ── Sending and reading (account-scoped) ─────────────────────────────────────
|
|
54
|
+
async function sendEmail(apiKey, payload) {
|
|
55
|
+
return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/send`, apiKey, payload);
|
|
52
56
|
}
|
|
53
|
-
async function getEmailStatus(apiKey,
|
|
54
|
-
return (0, client_1.request)('GET', `${
|
|
57
|
+
async function getEmailStatus(apiKey, messageId) {
|
|
58
|
+
return (0, client_1.request)('GET', `${config_1.EMAIL_BASE}/email/status/${encodeURIComponent(messageId)}`, apiKey);
|
|
55
59
|
}
|
|
56
|
-
async function getSentEmails(apiKey,
|
|
57
|
-
return (0, client_1.request)('GET', `${
|
|
60
|
+
async function getSentEmails(apiKey, limit = 50, offset = 0) {
|
|
61
|
+
return (0, client_1.request)('GET', `${config_1.EMAIL_BASE}/email/sent?limit=${limit}&offset=${offset}`, apiKey);
|
|
58
62
|
}
|
|
59
|
-
async function getInbox(apiKey,
|
|
60
|
-
return (0, client_1.request)('GET', `${
|
|
63
|
+
async function getInbox(apiKey, address) {
|
|
64
|
+
return (0, client_1.request)('GET', `${config_1.EMAIL_BASE}/email/inbox/${encodeURIComponent(address)}`, apiKey);
|
|
61
65
|
}
|
|
62
|
-
async function getOutbox(apiKey,
|
|
63
|
-
return (0, client_1.request)('GET', `${
|
|
66
|
+
async function getOutbox(apiKey, address) {
|
|
67
|
+
return (0, client_1.request)('GET', `${config_1.EMAIL_BASE}/email/outbox/${encodeURIComponent(address)}`, apiKey);
|
|
64
68
|
}
|
|
65
|
-
async function getMessage(apiKey,
|
|
66
|
-
return (0, client_1.request)('GET', `${
|
|
69
|
+
async function getMessage(apiKey, messageId, address) {
|
|
70
|
+
return (0, client_1.request)('GET', `${config_1.EMAIL_BASE}/email/message/${encodeURIComponent(messageId)}?address=${encodeURIComponent(address)}`, apiKey);
|
|
67
71
|
}
|
|
68
|
-
|
|
69
|
-
|
|
72
|
+
// ── Warmup (account-scoped) ──────────────────────────────────────────────────
|
|
73
|
+
async function startWarmup(apiKey, address) {
|
|
74
|
+
return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/warmup/start`, apiKey, { address });
|
|
70
75
|
}
|
|
71
|
-
async function pauseWarmup(apiKey,
|
|
72
|
-
return (0, client_1.request)('POST', `${
|
|
76
|
+
async function pauseWarmup(apiKey, address) {
|
|
77
|
+
return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/warmup/pause`, apiKey, { address });
|
|
73
78
|
}
|
|
74
|
-
async function resumeWarmup(apiKey,
|
|
75
|
-
return (0, client_1.request)('POST', `${
|
|
79
|
+
async function resumeWarmup(apiKey, address) {
|
|
80
|
+
return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/warmup/resume`, apiKey, { address });
|
|
76
81
|
}
|
|
77
|
-
async function stopWarmup(apiKey,
|
|
78
|
-
return (0, client_1.request)('POST', `${
|
|
82
|
+
async function stopWarmup(apiKey, address) {
|
|
83
|
+
return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/warmup/stop`, apiKey, { address });
|
|
79
84
|
}
|
|
80
|
-
async function getWarmupStats(apiKey,
|
|
81
|
-
return (0, client_1.request)('GET', `${
|
|
85
|
+
async function getWarmupStats(apiKey, address) {
|
|
86
|
+
return (0, client_1.request)('GET', `${config_1.EMAIL_BASE}/email/warmup/stats/${encodeURIComponent(address)}`, apiKey);
|
|
82
87
|
}
|
|
88
|
+
// ── Templates (org-scoped — brand context drives generation) ─────────────────
|
|
83
89
|
async function generateTemplate(apiKey, orgId, payload) {
|
|
84
|
-
return (0, client_1.request)('POST', `${
|
|
90
|
+
return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/templates/generate`, apiKey, payload);
|
|
85
91
|
}
|
|
86
92
|
async function getTemplateJobStatus(apiKey, orgId, jobId) {
|
|
87
|
-
return (0, client_1.request)('GET', `${
|
|
93
|
+
return (0, client_1.request)('GET', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/template-jobs/${encodeURIComponent(jobId)}`, apiKey);
|
|
94
|
+
}
|
|
95
|
+
async function getTemplate(apiKey, orgId, templateId) {
|
|
96
|
+
return (0, client_1.request)('GET', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/templates/${encodeURIComponent(templateId)}`, apiKey);
|
|
88
97
|
}
|
|
89
98
|
async function editTemplate(apiKey, orgId, templateId, prompt) {
|
|
90
|
-
return (0, client_1.request)('POST', `${
|
|
99
|
+
return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/templates/${encodeURIComponent(templateId)}/edit`, apiKey, { prompt });
|
|
91
100
|
}
|
|
92
101
|
async function sendTestEmail(apiKey, orgId, templateId, to) {
|
|
93
|
-
return (0, client_1.request)('POST', `${
|
|
102
|
+
return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/templates/${encodeURIComponent(templateId)}/send-test`, apiKey, { to });
|
|
94
103
|
}
|
|
95
104
|
async function listTemplates(apiKey, orgId) {
|
|
96
|
-
return (0, client_1.request)('GET', `${
|
|
105
|
+
return (0, client_1.request)('GET', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/templates`, apiKey);
|
|
97
106
|
}
|
|
98
107
|
async function deleteTemplate(apiKey, orgId, templateId) {
|
|
99
|
-
return (0, client_1.request)('DELETE', `${
|
|
108
|
+
return (0, client_1.request)('DELETE', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/templates/${encodeURIComponent(templateId)}`, apiKey);
|
|
100
109
|
}
|
|
110
|
+
// ── Campaigns (org-scoped) ───────────────────────────────────────────────────
|
|
101
111
|
async function createCampaign(apiKey, orgId, payload) {
|
|
102
|
-
return (0, client_1.request)('POST', `${
|
|
112
|
+
return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/campaigns`, apiKey, payload);
|
|
103
113
|
}
|
|
104
114
|
async function uploadContactList(apiKey, orgId, campaignId, emails) {
|
|
105
|
-
return (0, client_1.request)('POST', `${
|
|
115
|
+
return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}/contacts/upload-list`, apiKey, { emails });
|
|
116
|
+
}
|
|
117
|
+
async function uploadContactsFile(apiKey, orgId, campaignId, file, filename = 'contacts.csv') {
|
|
118
|
+
const form = new FormData();
|
|
119
|
+
const blob = file instanceof Blob ? file : new Blob([file]);
|
|
120
|
+
form.append('file', blob, filename);
|
|
121
|
+
const res = await fetch(`${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}/contacts/upload-file`, {
|
|
122
|
+
method: 'POST',
|
|
123
|
+
headers: { Authorization: `Bearer ${apiKey}` },
|
|
124
|
+
body: form,
|
|
125
|
+
});
|
|
126
|
+
const json = await res.json();
|
|
127
|
+
if (!res.ok || !json.success)
|
|
128
|
+
throw new Error(json.error?.code || json.error || 'upload_failed');
|
|
129
|
+
return json.data;
|
|
106
130
|
}
|
|
107
131
|
async function getContactUploadStatus(apiKey, orgId, campaignId) {
|
|
108
|
-
return (0, client_1.request)('GET', `${
|
|
132
|
+
return (0, client_1.request)('GET', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}/contacts/status`, apiKey);
|
|
109
133
|
}
|
|
110
134
|
async function startCampaign(apiKey, orgId, campaignId) {
|
|
111
|
-
return (0, client_1.request)('POST', `${
|
|
135
|
+
return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}/start`, apiKey);
|
|
112
136
|
}
|
|
113
137
|
async function pauseCampaign(apiKey, orgId, campaignId) {
|
|
114
|
-
return (0, client_1.request)('POST', `${
|
|
138
|
+
return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}/pause`, apiKey);
|
|
115
139
|
}
|
|
116
140
|
async function resumeCampaign(apiKey, orgId, campaignId) {
|
|
117
|
-
return (0, client_1.request)('POST', `${
|
|
141
|
+
return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}/resume`, apiKey);
|
|
118
142
|
}
|
|
119
143
|
async function getCampaignStats(apiKey, orgId, campaignId) {
|
|
120
|
-
return (0, client_1.request)('GET', `${
|
|
144
|
+
return (0, client_1.request)('GET', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}/stats`, apiKey);
|
|
121
145
|
}
|
|
122
146
|
async function listCampaigns(apiKey, orgId) {
|
|
123
|
-
return (0, client_1.request)('GET', `${
|
|
147
|
+
return (0, client_1.request)('GET', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/campaigns`, apiKey);
|
|
124
148
|
}
|
|
125
149
|
async function getCampaign(apiKey, orgId, campaignId) {
|
|
126
|
-
return (0, client_1.request)('GET', `${
|
|
150
|
+
return (0, client_1.request)('GET', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}`, apiKey);
|
|
127
151
|
}
|
|
128
152
|
async function updateCampaign(apiKey, orgId, campaignId, payload) {
|
|
129
|
-
return (0, client_1.request)('PATCH', `${
|
|
153
|
+
return (0, client_1.request)('PATCH', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}`, apiKey, payload);
|
|
130
154
|
}
|
package/dist/funnel.js
CHANGED
|
@@ -7,22 +7,22 @@ exports.deleteFunnel = deleteFunnel;
|
|
|
7
7
|
exports.pushFunnelPage = pushFunnelPage;
|
|
8
8
|
exports.verifyFunnel = verifyFunnel;
|
|
9
9
|
const client_1 = require("./client");
|
|
10
|
-
const
|
|
10
|
+
const config_1 = require("./config");
|
|
11
11
|
async function createFunnel(apiKey, orgId) {
|
|
12
|
-
return (0, client_1.request)('POST', `${
|
|
12
|
+
return (0, client_1.request)('POST', `${config_1.FUNNEL_BASE}/funnel/orgs/${encodeURIComponent(orgId)}/funnels`, apiKey, {});
|
|
13
13
|
}
|
|
14
14
|
async function getFunnel(apiKey, orgId, funnelId) {
|
|
15
|
-
return (0, client_1.request)('GET', `${
|
|
15
|
+
return (0, client_1.request)('GET', `${config_1.FUNNEL_BASE}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}`, apiKey);
|
|
16
16
|
}
|
|
17
17
|
async function listFunnels(apiKey, orgId) {
|
|
18
|
-
return (0, client_1.request)('GET', `${
|
|
18
|
+
return (0, client_1.request)('GET', `${config_1.FUNNEL_BASE}/funnel/orgs/${encodeURIComponent(orgId)}/funnels`, apiKey);
|
|
19
19
|
}
|
|
20
20
|
async function deleteFunnel(apiKey, orgId, funnelId) {
|
|
21
|
-
return (0, client_1.request)('DELETE', `${
|
|
21
|
+
return (0, client_1.request)('DELETE', `${config_1.FUNNEL_BASE}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}`, apiKey);
|
|
22
22
|
}
|
|
23
23
|
async function pushFunnelPage(apiKey, orgId, funnelId, payload) {
|
|
24
|
-
return (0, client_1.request)('POST', `${
|
|
24
|
+
return (0, client_1.request)('POST', `${config_1.FUNNEL_BASE}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/push-page`, apiKey, payload);
|
|
25
25
|
}
|
|
26
26
|
async function verifyFunnel(apiKey, orgId, funnelId, opts) {
|
|
27
|
-
return (0, client_1.request)('POST', `${
|
|
27
|
+
return (0, client_1.request)('POST', `${config_1.FUNNEL_BASE}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/verify`, apiKey, opts || {});
|
|
28
28
|
}
|
package/dist/hq.d.ts
CHANGED
|
@@ -27,6 +27,24 @@ export interface Org {
|
|
|
27
27
|
updated_at: string;
|
|
28
28
|
}
|
|
29
29
|
export type OrgPayload = Omit<Org, 'id' | 'created_at' | 'updated_at'>;
|
|
30
|
+
export interface AuthResult {
|
|
31
|
+
api_key: string;
|
|
32
|
+
account_id: string;
|
|
33
|
+
default_org: string;
|
|
34
|
+
default_funnel: string;
|
|
35
|
+
}
|
|
36
|
+
export interface AccountInfo {
|
|
37
|
+
account_id: string;
|
|
38
|
+
email?: string;
|
|
39
|
+
is_anonymous?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export declare function createAnonymousAccount(): Promise<AuthResult & {
|
|
42
|
+
subdomain_url: string;
|
|
43
|
+
}>;
|
|
44
|
+
export declare function sendCode(email: string): Promise<void>;
|
|
45
|
+
export declare function verifyCode(email: string, code: string): Promise<AuthResult>;
|
|
46
|
+
export declare function upgradeAccount(apiKey: string, email: string): Promise<AuthResult>;
|
|
47
|
+
export declare function getAccount(apiKey: string): Promise<AccountInfo>;
|
|
30
48
|
export declare function createApiKey(apiKey: string, name: string): Promise<{
|
|
31
49
|
api_key: string;
|
|
32
50
|
id: string;
|
package/dist/hq.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAnonymousAccount = createAnonymousAccount;
|
|
4
|
+
exports.sendCode = sendCode;
|
|
5
|
+
exports.verifyCode = verifyCode;
|
|
6
|
+
exports.upgradeAccount = upgradeAccount;
|
|
7
|
+
exports.getAccount = getAccount;
|
|
3
8
|
exports.createApiKey = createApiKey;
|
|
4
9
|
exports.listApiKeys = listApiKeys;
|
|
5
10
|
exports.revokeApiKey = revokeApiKey;
|
|
@@ -16,49 +21,64 @@ exports.getBillingHistory = getBillingHistory;
|
|
|
16
21
|
exports.setupPayment = setupPayment;
|
|
17
22
|
exports.topUp = topUp;
|
|
18
23
|
const client_1 = require("./client");
|
|
19
|
-
const
|
|
24
|
+
const config_1 = require("./config");
|
|
25
|
+
async function createAnonymousAccount() {
|
|
26
|
+
return (0, client_1.request)('POST', `${config_1.HQ_BASE}/hq/account/anonymous`, undefined, {});
|
|
27
|
+
}
|
|
28
|
+
async function sendCode(email) {
|
|
29
|
+
return (0, client_1.request)('POST', `${config_1.HQ_BASE}/hq/account/send-code`, undefined, { email });
|
|
30
|
+
}
|
|
31
|
+
async function verifyCode(email, code) {
|
|
32
|
+
return (0, client_1.request)('POST', `${config_1.HQ_BASE}/hq/account/verify-code`, undefined, { email, code });
|
|
33
|
+
}
|
|
34
|
+
async function upgradeAccount(apiKey, email) {
|
|
35
|
+
return (0, client_1.request)('PATCH', `${config_1.HQ_BASE}/hq/account/upgrade`, apiKey, { email });
|
|
36
|
+
}
|
|
37
|
+
async function getAccount(apiKey) {
|
|
38
|
+
return (0, client_1.request)('GET', `${config_1.HQ_BASE}/hq/account/me`, apiKey);
|
|
39
|
+
}
|
|
20
40
|
async function createApiKey(apiKey, name) {
|
|
21
|
-
return (0, client_1.request)('POST', `${
|
|
41
|
+
return (0, client_1.request)('POST', `${config_1.HQ_BASE}/hq/account/create/key`, apiKey, { name });
|
|
22
42
|
}
|
|
23
43
|
async function listApiKeys(apiKey) {
|
|
24
|
-
return (0, client_1.request)('GET', `${
|
|
44
|
+
return (0, client_1.request)('GET', `${config_1.HQ_BASE}/hq/account/keys`, apiKey);
|
|
25
45
|
}
|
|
26
46
|
async function revokeApiKey(apiKey, keyId) {
|
|
27
|
-
return (0, client_1.request)('DELETE', `${
|
|
47
|
+
return (0, client_1.request)('DELETE', `${config_1.HQ_BASE}/hq/account/delete/key/${encodeURIComponent(keyId)}`, apiKey);
|
|
28
48
|
}
|
|
29
49
|
async function createOrg(apiKey, payload) {
|
|
30
|
-
return (0, client_1.request)('POST', `${
|
|
50
|
+
return (0, client_1.request)('POST', `${config_1.HQ_BASE}/hq/orgs`, apiKey, payload);
|
|
31
51
|
}
|
|
32
52
|
async function importOrg(apiKey, orgId, domain, autoAccept) {
|
|
33
|
-
return (0, client_1.request)('POST', `${
|
|
53
|
+
return (0, client_1.request)('POST', `${config_1.HQ_BASE}/hq/org-imports`, apiKey, { domain, org_id: orgId, auto_accept: autoAccept });
|
|
34
54
|
}
|
|
35
55
|
async function getOrgImportStatus(apiKey, jobId) {
|
|
36
|
-
return (0, client_1.request)('GET', `${
|
|
56
|
+
return (0, client_1.request)('GET', `${config_1.HQ_BASE}/hq/org-imports/${encodeURIComponent(jobId)}`, apiKey);
|
|
37
57
|
}
|
|
38
58
|
async function confirmOrgImport(apiKey, jobId, overrides) {
|
|
39
|
-
return (0, client_1.request)('POST', `${
|
|
59
|
+
return (0, client_1.request)('POST', `${config_1.HQ_BASE}/hq/org-imports/${encodeURIComponent(jobId)}/confirm`, apiKey, overrides);
|
|
40
60
|
}
|
|
41
61
|
async function listOrgs(apiKey) {
|
|
42
|
-
return (0, client_1.request)('GET', `${
|
|
62
|
+
return (0, client_1.request)('GET', `${config_1.HQ_BASE}/hq/orgs`, apiKey);
|
|
43
63
|
}
|
|
44
64
|
async function getOrg(apiKey, orgId) {
|
|
45
|
-
return (0, client_1.request)('GET', `${
|
|
65
|
+
return (0, client_1.request)('GET', `${config_1.HQ_BASE}/hq/orgs/${encodeURIComponent(orgId)}`, apiKey);
|
|
46
66
|
}
|
|
47
67
|
async function updateOrg(apiKey, orgId, payload) {
|
|
48
|
-
return (0, client_1.request)('PATCH', `${
|
|
68
|
+
return (0, client_1.request)('PATCH', `${config_1.HQ_BASE}/hq/orgs/${encodeURIComponent(orgId)}`, apiKey, payload);
|
|
49
69
|
}
|
|
50
70
|
async function deleteOrg(apiKey, orgId) {
|
|
51
|
-
return (0, client_1.request)('DELETE', `${
|
|
71
|
+
return (0, client_1.request)('DELETE', `${config_1.HQ_BASE}/hq/orgs/${encodeURIComponent(orgId)}`, apiKey);
|
|
52
72
|
}
|
|
53
73
|
async function getBalance(apiKey) {
|
|
54
|
-
return (0, client_1.request)('GET', `${
|
|
74
|
+
return (0, client_1.request)('GET', `${config_1.HQ_BASE}/hq/billing/balance`, apiKey);
|
|
55
75
|
}
|
|
56
76
|
async function getBillingHistory(apiKey) {
|
|
57
|
-
return (0, client_1.request)('GET', `${
|
|
77
|
+
return (0, client_1.request)('GET', `${config_1.HQ_BASE}/hq/billing/history`, apiKey);
|
|
58
78
|
}
|
|
59
79
|
async function setupPayment(apiKey) {
|
|
60
|
-
return (0, client_1.request)('POST', `${
|
|
80
|
+
return (0, client_1.request)('POST', `${config_1.HQ_BASE}/hq/billing/setup-payment`, apiKey);
|
|
61
81
|
}
|
|
62
82
|
async function topUp(apiKey, amountDollars) {
|
|
63
|
-
return (0, client_1.request)('POST', `${
|
|
83
|
+
return (0, client_1.request)('POST', `${config_1.HQ_BASE}/hq/billing/topup`, apiKey, { amount_dollars: amountDollars });
|
|
64
84
|
}
|
package/dist/image.js
CHANGED
|
@@ -5,16 +5,16 @@ exports.getImageJob = getImageJob;
|
|
|
5
5
|
exports.listImages = listImages;
|
|
6
6
|
exports.deleteImage = deleteImage;
|
|
7
7
|
const client_1 = require("./client");
|
|
8
|
-
const
|
|
8
|
+
const config_1 = require("./config");
|
|
9
9
|
async function generateImage(apiKey, orgId, payload) {
|
|
10
|
-
return (0, client_1.request)('POST', `${
|
|
10
|
+
return (0, client_1.request)('POST', `${config_1.IMAGE_BASE}/image/orgs/${encodeURIComponent(orgId)}/generate`, apiKey, payload);
|
|
11
11
|
}
|
|
12
12
|
async function getImageJob(apiKey, orgId, jobId) {
|
|
13
|
-
return (0, client_1.request)('GET', `${
|
|
13
|
+
return (0, client_1.request)('GET', `${config_1.IMAGE_BASE}/image/orgs/${encodeURIComponent(orgId)}/jobs/${encodeURIComponent(jobId)}`, apiKey);
|
|
14
14
|
}
|
|
15
15
|
async function listImages(apiKey, orgId) {
|
|
16
|
-
return (0, client_1.request)('GET', `${
|
|
16
|
+
return (0, client_1.request)('GET', `${config_1.IMAGE_BASE}/image/orgs/${encodeURIComponent(orgId)}/list`, apiKey);
|
|
17
17
|
}
|
|
18
18
|
async function deleteImage(apiKey, orgId, jobId) {
|
|
19
|
-
return (0, client_1.request)('DELETE', `${
|
|
19
|
+
return (0, client_1.request)('DELETE', `${config_1.IMAGE_BASE}/image/orgs/${encodeURIComponent(orgId)}/images/${encodeURIComponent(jobId)}`, apiKey);
|
|
20
20
|
}
|
package/dist/index.js
CHANGED
|
@@ -37,7 +37,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.url = exports.workflow = exports.webhook = exports.storage = exports.pixel = exports.image = exports.funnel = exports.email = exports.domain = exports.hq = void 0;
|
|
40
|
-
// AUTO-GENERATED by scripts/generate-indexes.js — do not edit manually
|
|
41
40
|
__exportStar(require("./types"), exports);
|
|
42
41
|
__exportStar(require("./client"), exports);
|
|
43
42
|
exports.hq = __importStar(require("./hq"));
|
package/dist/pixel.js
CHANGED
|
@@ -5,7 +5,7 @@ exports.getVisits = getVisits;
|
|
|
5
5
|
exports.getEvents = getEvents;
|
|
6
6
|
exports.getIdentity = getIdentity;
|
|
7
7
|
const client_1 = require("./client");
|
|
8
|
-
const
|
|
8
|
+
const config_1 = require("./config");
|
|
9
9
|
async function getInteractions(apiKey, orgId, params) {
|
|
10
10
|
const qs = new URLSearchParams();
|
|
11
11
|
for (const [key, val] of Object.entries(params)) {
|
|
@@ -14,7 +14,7 @@ async function getInteractions(apiKey, orgId, params) {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
const queryString = qs.toString();
|
|
17
|
-
const url = `${
|
|
17
|
+
const url = `${config_1.PIXEL_BASE}/pixel/orgs/${encodeURIComponent(orgId)}/interactions${queryString ? `?${queryString}` : ''}`;
|
|
18
18
|
return (0, client_1.request)('GET', url, apiKey);
|
|
19
19
|
}
|
|
20
20
|
async function getVisits(apiKey, orgId, params) {
|
|
@@ -25,7 +25,7 @@ async function getVisits(apiKey, orgId, params) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
const queryString = qs.toString();
|
|
28
|
-
const url = `${
|
|
28
|
+
const url = `${config_1.PIXEL_BASE}/pixel/orgs/${encodeURIComponent(orgId)}/visits${queryString ? `?${queryString}` : ''}`;
|
|
29
29
|
return (0, client_1.request)('GET', url, apiKey);
|
|
30
30
|
}
|
|
31
31
|
async function getEvents(apiKey, orgId, params) {
|
|
@@ -36,9 +36,9 @@ async function getEvents(apiKey, orgId, params) {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
const queryString = qs.toString();
|
|
39
|
-
const url = `${
|
|
39
|
+
const url = `${config_1.PIXEL_BASE}/pixel/orgs/${encodeURIComponent(orgId)}/events${queryString ? `?${queryString}` : ''}`;
|
|
40
40
|
return (0, client_1.request)('GET', url, apiKey);
|
|
41
41
|
}
|
|
42
42
|
async function getIdentity(apiKey, orgId, pixelId) {
|
|
43
|
-
return (0, client_1.request)('GET', `${
|
|
43
|
+
return (0, client_1.request)('GET', `${config_1.PIXEL_BASE}/pixel/orgs/${encodeURIComponent(orgId)}/identity/${encodeURIComponent(pixelId)}`, apiKey);
|
|
44
44
|
}
|
package/dist/storage.js
CHANGED
|
@@ -5,9 +5,9 @@ exports.uploadAsset = uploadAsset;
|
|
|
5
5
|
exports.listAssets = listAssets;
|
|
6
6
|
exports.deleteAsset = deleteAsset;
|
|
7
7
|
const client_1 = require("./client");
|
|
8
|
-
const
|
|
8
|
+
const config_1 = require("./config");
|
|
9
9
|
async function ingestAsset(apiKey, orgId, url, name) {
|
|
10
|
-
return (0, client_1.request)('POST', `${
|
|
10
|
+
return (0, client_1.request)('POST', `${config_1.STORAGE_BASE}/storage/orgs/${encodeURIComponent(orgId)}/assets/ingest`, apiKey, { url, name });
|
|
11
11
|
}
|
|
12
12
|
async function uploadAsset(apiKey, orgId, file, contentType, name) {
|
|
13
13
|
const headers = {
|
|
@@ -18,7 +18,7 @@ async function uploadAsset(apiKey, orgId, file, contentType, name) {
|
|
|
18
18
|
if (name) {
|
|
19
19
|
formData.append('name', name);
|
|
20
20
|
}
|
|
21
|
-
const response = await fetch(`${
|
|
21
|
+
const response = await fetch(`${config_1.STORAGE_BASE}/storage/orgs/${encodeURIComponent(orgId)}/assets/upload`, {
|
|
22
22
|
method: 'POST',
|
|
23
23
|
headers,
|
|
24
24
|
body: formData
|
|
@@ -41,8 +41,8 @@ async function uploadAsset(apiKey, orgId, file, contentType, name) {
|
|
|
41
41
|
return apiResponse.data;
|
|
42
42
|
}
|
|
43
43
|
async function listAssets(apiKey, orgId) {
|
|
44
|
-
return (0, client_1.request)('GET', `${
|
|
44
|
+
return (0, client_1.request)('GET', `${config_1.STORAGE_BASE}/storage/orgs/${encodeURIComponent(orgId)}/assets`, apiKey);
|
|
45
45
|
}
|
|
46
46
|
async function deleteAsset(apiKey, orgId, assetId) {
|
|
47
|
-
return (0, client_1.request)('DELETE', `${
|
|
47
|
+
return (0, client_1.request)('DELETE', `${config_1.STORAGE_BASE}/storage/orgs/${encodeURIComponent(orgId)}/assets/${encodeURIComponent(assetId)}`, apiKey);
|
|
48
48
|
}
|
package/dist/url.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.shortenUrl = shortenUrl;
|
|
4
4
|
const client_1 = require("./client");
|
|
5
|
-
const
|
|
5
|
+
const config_1 = require("./config");
|
|
6
6
|
async function shortenUrl(apiKey, orgId, url) {
|
|
7
|
-
return (0, client_1.request)('POST', `${
|
|
7
|
+
return (0, client_1.request)('POST', `${config_1.URL_BASE}/url/orgs/${encodeURIComponent(orgId)}/shorten`, apiKey, { url });
|
|
8
8
|
}
|