@myapihq/sdk 1.0.12 → 1.0.14

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/src/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/src/email.ts CHANGED
@@ -4,7 +4,8 @@ const BASE_URL = 'https://api.myemailapi.com';
4
4
 
5
5
  export interface EmailMessage { message_id: string; from: string; subject: string; body?: string; received_at: string }
6
6
  export interface EmailTemplate { id: string; name: string; subject: string; preview_url: string; created_at: string; updated_at: string }
7
- export interface Campaign { id: string; name: string; status: string; template_id: string; from_address: string; rate_per_minute: number; per_hour_limit: number; created_at: string }
7
+ export interface WarmupConfig { enabled: boolean; start: number; increment: number; max: number; }
8
+ export interface Campaign { id: string; name: string; status: string; template_id: string; from_address: string; per_day_limit: number; warmup_config?: WarmupConfig; created_at: string }
8
9
  export interface CampaignStats {
9
10
  campaign: Campaign;
10
11
  validation: { total: number; valid: number; invalid: number; pending: number; list_status: string };
@@ -15,22 +16,32 @@ export interface CampaignStats {
15
16
  export async function createMailbox(apiKey: string, orgId: string, domain: string, username: string): Promise<{ address: string; created_at: string }> {
16
17
  return request('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/mailboxes/create`, apiKey, { domain, username });
17
18
  }
18
- export async function listMailboxes(apiKey: string, orgId: string): Promise<{ address: string; created_at: string }[]> {
19
- return request('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/mailboxes`, apiKey);
19
+ export async function listMailboxes(apiKey: string, orgId: string, options?: { domain?: string; filter?: 'unassigned' }): Promise<{ address: string; created_at: string }[]> {
20
+ const query = new URLSearchParams();
21
+ if (options?.domain) query.append('domain', options.domain);
22
+ if (options?.filter) query.append('filter', options.filter);
23
+ const qStr = query.toString();
24
+ return request('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/mailboxes${qStr ? '?' + qStr : ''}`, apiKey);
20
25
  }
21
26
  export async function activateSending(apiKey: string, orgId: string, address: string): Promise<{ status: string }> {
22
27
  return request('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/sending/activate`, apiKey, { address });
23
28
  }
24
29
 
25
- export async function sendEmail(apiKey: string, orgId: string, payload: { from: string; to: string[]; subject: string; html?: string; text?: string; }): Promise<{ message_id: string }> {
30
+ export async function sendEmail(apiKey: string, orgId: string, payload: { from: string; to: string[]; subject: string; html?: string; text?: string; template_id?: string; template_vars?: Record<string, string> }): Promise<{ message_id: string }> {
26
31
  return request('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/send`, apiKey, payload);
27
32
  }
28
33
  export async function getEmailStatus(apiKey: string, orgId: string, messageId: string): Promise<{ status: string; delivered_at?: string }> {
29
34
  return request('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/status/${encodeURIComponent(messageId)}`, apiKey);
30
35
  }
36
+ export async function getSentEmails(apiKey: string, orgId: string, limit: number = 50, offset: number = 0): Promise<EmailMessage[]> {
37
+ return request('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/sent?limit=${limit}&offset=${offset}`, apiKey);
38
+ }
31
39
  export async function getInbox(apiKey: string, orgId: string, address: string): Promise<EmailMessage[]> {
32
40
  return request('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/inbox/${encodeURIComponent(address)}`, apiKey);
33
41
  }
42
+ export async function getOutbox(apiKey: string, orgId: string, address: string): Promise<EmailMessage[]> {
43
+ return request('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/outbox/${encodeURIComponent(address)}`, apiKey);
44
+ }
34
45
  export async function getMessage(apiKey: string, orgId: string, messageId: string, address: string): Promise<EmailMessage> {
35
46
  return request('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/message/${encodeURIComponent(messageId)}?address=${encodeURIComponent(address)}`, apiKey);
36
47
  }
@@ -70,7 +81,7 @@ export async function deleteTemplate(apiKey: string, orgId: string, templateId:
70
81
  return request('DELETE', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/templates/${encodeURIComponent(templateId)}`, apiKey);
71
82
  }
72
83
 
73
- export async function createCampaign(apiKey: string, orgId: string, payload: { name: string; template_id: string; from_address: string; rate_per_minute?: number; per_hour_limit?: number; }): Promise<Campaign> {
84
+ export async function createCampaign(apiKey: string, orgId: string, payload: { name: string; template_id: string; from_address: string; per_day_limit?: number; warmup_config?: WarmupConfig | null; }): Promise<Campaign> {
74
85
  return request('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/campaigns`, apiKey, payload);
75
86
  }
76
87
  export async function uploadContactList(apiKey: string, orgId: string, campaignId: string, emails: string[]): Promise<{ list_id: string; total: number; status: string }> {
@@ -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/src/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/src/funnel.ts CHANGED
@@ -22,17 +22,8 @@ export async function deleteFunnel(apiKey: string, orgId: string, funnelId: stri
22
22
  return request('DELETE', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}`, apiKey);
23
23
  }
24
24
 
25
- export async function previewFunnel(apiKey: string, orgId: string, funnelId: string): Promise<{ preview_url: string }> {
26
- return request('POST', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/preview`, apiKey);
27
- }
28
- export async function publishFunnel(apiKey: string, orgId: string, funnelId: string): Promise<{ status: string }> {
29
- return request('POST', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/publish`, apiKey);
30
- }
31
- export async function getPublishStatus(apiKey: string, orgId: string, funnelId: string): Promise<{ status: string }> {
32
- return request('GET', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/publish/status`, apiKey);
33
- }
34
- export async function pushPage(apiKey: string, orgId: string, funnelId: string, slug: string, html: string): Promise<{ status: string }> {
35
- return request('POST', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/push-page`, apiKey, { slug, html });
25
+ export async function pushFunnelPage(apiKey: string, orgId: string, funnelId: string, payload: { slug: string; html: string }): Promise<{ url: string }> {
26
+ return request('POST', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/push-page`, apiKey, payload);
36
27
  }
37
28
  export async function verifyFunnel(apiKey: string, orgId: string, funnelId: string, opts?: { html?: string; slug?: string }): Promise<VerifyResult> {
38
29
  return request('POST', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/verify`, apiKey, opts || {});
package/src/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/src/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/src/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/src/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/src/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';
package/src/index.js ADDED
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
+ };
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ 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
+ __exportStar(require("./types"), exports);
42
+ __exportStar(require("./client"), exports);
43
+ exports.hq = __importStar(require("./hq"));
44
+ exports.domain = __importStar(require("./domain"));
45
+ exports.email = __importStar(require("./email"));
46
+ exports.funnel = __importStar(require("./funnel"));
47
+ exports.image = __importStar(require("./image"));
48
+ exports.pixel = __importStar(require("./pixel"));
49
+ exports.storage = __importStar(require("./storage"));
50
+ exports.webhook = __importStar(require("./webhook"));
51
+ exports.workflow = __importStar(require("./workflow"));
package/src/index.ts CHANGED
@@ -10,3 +10,4 @@ export * as pixel from './pixel';
10
10
  export * as storage from './storage';
11
11
  export * as webhook from './webhook';
12
12
  export * as workflow from './workflow';
13
+ export * as url from './url';
package/src/pixel.d.ts ADDED
@@ -0,0 +1,65 @@
1
+ export interface InteractionsResponse {
2
+ interactions: (Visit | PixelEvent)[];
3
+ total_visits: number;
4
+ total_events: number;
5
+ limit: number;
6
+ offset: number;
7
+ }
8
+ export interface Visit {
9
+ type: 'visit';
10
+ pixel_id: string;
11
+ from_url: string;
12
+ to_url: string;
13
+ ts: string;
14
+ }
15
+ export interface PixelEvent {
16
+ type: 'event';
17
+ pixel_id: string;
18
+ event_type: 'sent' | 'open' | 'click' | 'page_visit';
19
+ url?: string;
20
+ campaign_id?: string;
21
+ ts: string;
22
+ }
23
+ export declare function getInteractions(apiKey: string, params: {
24
+ website?: string;
25
+ domain?: string;
26
+ campaign_id?: string;
27
+ from?: string;
28
+ to?: string;
29
+ limit?: number;
30
+ offset?: number;
31
+ }): Promise<InteractionsResponse>;
32
+ export declare function getVisits(apiKey: string, params: {
33
+ website: string;
34
+ from?: string;
35
+ to?: string;
36
+ limit?: number;
37
+ offset?: number;
38
+ }): Promise<{
39
+ visits: Visit[];
40
+ total: number;
41
+ limit: number;
42
+ offset: number;
43
+ }>;
44
+ export declare function getEvents(apiKey: string, params: {
45
+ campaign_id?: string;
46
+ domain?: string;
47
+ from?: string;
48
+ to?: string;
49
+ limit?: number;
50
+ offset?: number;
51
+ }): Promise<{
52
+ events: PixelEvent[];
53
+ total: number;
54
+ limit: number;
55
+ offset: number;
56
+ }>;
57
+ export declare function getIdentity(apiKey: string, pixelId: string): Promise<{
58
+ uuid: string;
59
+ is_resolved: boolean;
60
+ nodes: Record<string, {
61
+ type: string;
62
+ probability: number;
63
+ }>;
64
+ latency_ms: number;
65
+ }>;
package/src/pixel.js ADDED
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getInteractions = getInteractions;
4
+ exports.getVisits = getVisits;
5
+ exports.getEvents = getEvents;
6
+ exports.getIdentity = getIdentity;
7
+ const client_1 = require("./client");
8
+ const BASE_URL = 'https://api.mypixelapi.com';
9
+ async function getInteractions(apiKey, params) {
10
+ const qs = new URLSearchParams();
11
+ for (const [key, val] of Object.entries(params)) {
12
+ if (val !== undefined && val !== null) {
13
+ qs.set(key, String(val));
14
+ }
15
+ }
16
+ const queryString = qs.toString();
17
+ const url = `${BASE_URL}/pixel/interactions${queryString ? `?${queryString}` : ''}`;
18
+ return (0, client_1.request)('GET', url, apiKey);
19
+ }
20
+ async function getVisits(apiKey, params) {
21
+ const qs = new URLSearchParams();
22
+ for (const [key, val] of Object.entries(params)) {
23
+ if (val !== undefined && val !== null) {
24
+ qs.set(key, String(val));
25
+ }
26
+ }
27
+ const queryString = qs.toString();
28
+ const url = `${BASE_URL}/pixel/visits${queryString ? `?${queryString}` : ''}`;
29
+ return (0, client_1.request)('GET', url, apiKey);
30
+ }
31
+ async function getEvents(apiKey, params) {
32
+ const qs = new URLSearchParams();
33
+ for (const [key, val] of Object.entries(params)) {
34
+ if (val !== undefined && val !== null) {
35
+ qs.set(key, String(val));
36
+ }
37
+ }
38
+ const queryString = qs.toString();
39
+ const url = `${BASE_URL}/pixel/events${queryString ? `?${queryString}` : ''}`;
40
+ return (0, client_1.request)('GET', url, apiKey);
41
+ }
42
+ async function getIdentity(apiKey, pixelId) {
43
+ return (0, client_1.request)('GET', `${BASE_URL}/pixel/identity/${encodeURIComponent(pixelId)}`, apiKey);
44
+ }
@@ -0,0 +1,10 @@
1
+ export interface Asset {
2
+ asset_id: string;
3
+ url: string;
4
+ name: string;
5
+ created_at: string;
6
+ }
7
+ export declare function ingestAsset(apiKey: string, orgId: string, url: string, name?: string): Promise<Asset>;
8
+ export declare function uploadAsset(apiKey: string, orgId: string, file: Blob | Buffer, contentType: 'image/jpeg' | 'image/png', name?: string): Promise<Asset>;
9
+ export declare function listAssets(apiKey: string, orgId: string): Promise<Asset[]>;
10
+ export declare function deleteAsset(apiKey: string, orgId: string, assetId: string): Promise<void>;