@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/dist/email.d.ts +18 -5
- package/dist/email.js +16 -2
- package/dist/funnel.d.ts +5 -11
- package/dist/funnel.js +3 -15
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/url.d.ts +5 -0
- package/dist/url.js +8 -0
- package/dist/webhook.d.ts +3 -3
- package/dist/webhook.js +7 -7
- package/dist/workflow.d.ts +9 -10
- package/dist/workflow.js +18 -18
- package/package.json +1 -1
- package/src/client.d.ts +6 -0
- package/src/client.js +51 -0
- package/src/domain.d.ts +32 -0
- package/src/domain.js +36 -0
- package/src/email.d.ts +144 -0
- package/src/email.js +116 -0
- package/src/email.ts +16 -5
- package/src/funnel.d.ts +31 -0
- package/src/funnel.js +28 -0
- package/src/funnel.ts +2 -11
- package/src/hq.d.ts +84 -0
- package/src/hq.js +80 -0
- package/src/image.d.ts +21 -0
- package/src/image.js +16 -0
- package/src/index.d.ts +11 -0
- package/src/index.js +51 -0
- package/src/index.ts +1 -0
- package/src/pixel.d.ts +65 -0
- package/src/pixel.js +44 -0
- package/src/storage.d.ts +10 -0
- package/src/storage.js +48 -0
- package/src/types.d.ts +17 -0
- package/src/types.js +2 -0
- package/src/url.ts +12 -0
- package/src/webhook.d.ts +20 -0
- package/src/webhook.js +20 -0
- package/src/webhook.ts +7 -7
- package/src/workflow.d.ts +56 -0
- package/src/workflow.js +40 -0
- package/src/workflow.ts +18 -19
package/dist/email.d.ts
CHANGED
|
@@ -13,14 +13,20 @@ export interface EmailTemplate {
|
|
|
13
13
|
created_at: string;
|
|
14
14
|
updated_at: string;
|
|
15
15
|
}
|
|
16
|
+
export interface WarmupConfig {
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
start: number;
|
|
19
|
+
increment: number;
|
|
20
|
+
max: number;
|
|
21
|
+
}
|
|
16
22
|
export interface Campaign {
|
|
17
23
|
id: string;
|
|
18
24
|
name: string;
|
|
19
25
|
status: string;
|
|
20
26
|
template_id: string;
|
|
21
27
|
from_address: string;
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
per_day_limit: number;
|
|
29
|
+
warmup_config?: WarmupConfig;
|
|
24
30
|
created_at: string;
|
|
25
31
|
}
|
|
26
32
|
export interface CampaignStats {
|
|
@@ -50,7 +56,10 @@ export declare function createMailbox(apiKey: string, orgId: string, domain: str
|
|
|
50
56
|
address: string;
|
|
51
57
|
created_at: string;
|
|
52
58
|
}>;
|
|
53
|
-
export declare function listMailboxes(apiKey: string, orgId: string
|
|
59
|
+
export declare function listMailboxes(apiKey: string, orgId: string, options?: {
|
|
60
|
+
domain?: string;
|
|
61
|
+
filter?: 'unassigned';
|
|
62
|
+
}): Promise<{
|
|
54
63
|
address: string;
|
|
55
64
|
created_at: string;
|
|
56
65
|
}[]>;
|
|
@@ -63,6 +72,8 @@ export declare function sendEmail(apiKey: string, orgId: string, payload: {
|
|
|
63
72
|
subject: string;
|
|
64
73
|
html?: string;
|
|
65
74
|
text?: string;
|
|
75
|
+
template_id?: string;
|
|
76
|
+
template_vars?: Record<string, string>;
|
|
66
77
|
}): Promise<{
|
|
67
78
|
message_id: string;
|
|
68
79
|
}>;
|
|
@@ -70,7 +81,9 @@ export declare function getEmailStatus(apiKey: string, orgId: string, messageId:
|
|
|
70
81
|
status: string;
|
|
71
82
|
delivered_at?: string;
|
|
72
83
|
}>;
|
|
84
|
+
export declare function getSentEmails(apiKey: string, orgId: string, limit?: number, offset?: number): Promise<EmailMessage[]>;
|
|
73
85
|
export declare function getInbox(apiKey: string, orgId: string, address: string): Promise<EmailMessage[]>;
|
|
86
|
+
export declare function getOutbox(apiKey: string, orgId: string, address: string): Promise<EmailMessage[]>;
|
|
74
87
|
export declare function getMessage(apiKey: string, orgId: string, messageId: string, address: string): Promise<EmailMessage>;
|
|
75
88
|
export declare function startWarmup(apiKey: string, orgId: string, address: string): Promise<{
|
|
76
89
|
warmup_status: string;
|
|
@@ -115,8 +128,8 @@ export declare function createCampaign(apiKey: string, orgId: string, payload: {
|
|
|
115
128
|
name: string;
|
|
116
129
|
template_id: string;
|
|
117
130
|
from_address: string;
|
|
118
|
-
|
|
119
|
-
|
|
131
|
+
per_day_limit?: number;
|
|
132
|
+
warmup_config?: WarmupConfig | null;
|
|
120
133
|
}): Promise<Campaign>;
|
|
121
134
|
export declare function uploadContactList(apiKey: string, orgId: string, campaignId: string, emails: string[]): Promise<{
|
|
122
135
|
list_id: string;
|
package/dist/email.js
CHANGED
|
@@ -5,7 +5,9 @@ exports.listMailboxes = listMailboxes;
|
|
|
5
5
|
exports.activateSending = activateSending;
|
|
6
6
|
exports.sendEmail = sendEmail;
|
|
7
7
|
exports.getEmailStatus = getEmailStatus;
|
|
8
|
+
exports.getSentEmails = getSentEmails;
|
|
8
9
|
exports.getInbox = getInbox;
|
|
10
|
+
exports.getOutbox = getOutbox;
|
|
9
11
|
exports.getMessage = getMessage;
|
|
10
12
|
exports.startWarmup = startWarmup;
|
|
11
13
|
exports.pauseWarmup = pauseWarmup;
|
|
@@ -33,8 +35,14 @@ const BASE_URL = 'https://api.myemailapi.com';
|
|
|
33
35
|
async function createMailbox(apiKey, orgId, domain, username) {
|
|
34
36
|
return (0, client_1.request)('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/mailboxes/create`, apiKey, { domain, username });
|
|
35
37
|
}
|
|
36
|
-
async function listMailboxes(apiKey, orgId) {
|
|
37
|
-
|
|
38
|
+
async function listMailboxes(apiKey, orgId, options) {
|
|
39
|
+
const query = new URLSearchParams();
|
|
40
|
+
if (options?.domain)
|
|
41
|
+
query.append('domain', options.domain);
|
|
42
|
+
if (options?.filter)
|
|
43
|
+
query.append('filter', options.filter);
|
|
44
|
+
const qStr = query.toString();
|
|
45
|
+
return (0, client_1.request)('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/mailboxes${qStr ? '?' + qStr : ''}`, apiKey);
|
|
38
46
|
}
|
|
39
47
|
async function activateSending(apiKey, orgId, address) {
|
|
40
48
|
return (0, client_1.request)('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/sending/activate`, apiKey, { address });
|
|
@@ -45,9 +53,15 @@ async function sendEmail(apiKey, orgId, payload) {
|
|
|
45
53
|
async function getEmailStatus(apiKey, orgId, messageId) {
|
|
46
54
|
return (0, client_1.request)('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/status/${encodeURIComponent(messageId)}`, apiKey);
|
|
47
55
|
}
|
|
56
|
+
async function getSentEmails(apiKey, orgId, limit = 50, offset = 0) {
|
|
57
|
+
return (0, client_1.request)('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/sent?limit=${limit}&offset=${offset}`, apiKey);
|
|
58
|
+
}
|
|
48
59
|
async function getInbox(apiKey, orgId, address) {
|
|
49
60
|
return (0, client_1.request)('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/inbox/${encodeURIComponent(address)}`, apiKey);
|
|
50
61
|
}
|
|
62
|
+
async function getOutbox(apiKey, orgId, address) {
|
|
63
|
+
return (0, client_1.request)('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/outbox/${encodeURIComponent(address)}`, apiKey);
|
|
64
|
+
}
|
|
51
65
|
async function getMessage(apiKey, orgId, messageId, address) {
|
|
52
66
|
return (0, client_1.request)('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/message/${encodeURIComponent(messageId)}?address=${encodeURIComponent(address)}`, apiKey);
|
|
53
67
|
}
|
package/dist/funnel.d.ts
CHANGED
|
@@ -21,17 +21,11 @@ export declare function createFunnel(apiKey: string, orgId: string, domain: stri
|
|
|
21
21
|
export declare function getFunnel(apiKey: string, orgId: string, funnelId: string): Promise<Funnel>;
|
|
22
22
|
export declare function listFunnels(apiKey: string, orgId: string): Promise<Funnel[]>;
|
|
23
23
|
export declare function deleteFunnel(apiKey: string, orgId: string, funnelId: string): Promise<void>;
|
|
24
|
-
export declare function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}>;
|
|
30
|
-
export declare function getPublishStatus(apiKey: string, orgId: string, funnelId: string): Promise<{
|
|
31
|
-
status: string;
|
|
32
|
-
}>;
|
|
33
|
-
export declare function pushPage(apiKey: string, orgId: string, funnelId: string, slug: string, html: string): Promise<{
|
|
34
|
-
status: string;
|
|
24
|
+
export declare function pushFunnelPage(apiKey: string, orgId: string, funnelId: string, payload: {
|
|
25
|
+
slug: string;
|
|
26
|
+
html: string;
|
|
27
|
+
}): Promise<{
|
|
28
|
+
url: string;
|
|
35
29
|
}>;
|
|
36
30
|
export declare function verifyFunnel(apiKey: string, orgId: string, funnelId: string, opts?: {
|
|
37
31
|
html?: string;
|
package/dist/funnel.js
CHANGED
|
@@ -4,10 +4,7 @@ exports.createFunnel = createFunnel;
|
|
|
4
4
|
exports.getFunnel = getFunnel;
|
|
5
5
|
exports.listFunnels = listFunnels;
|
|
6
6
|
exports.deleteFunnel = deleteFunnel;
|
|
7
|
-
exports.
|
|
8
|
-
exports.publishFunnel = publishFunnel;
|
|
9
|
-
exports.getPublishStatus = getPublishStatus;
|
|
10
|
-
exports.pushPage = pushPage;
|
|
7
|
+
exports.pushFunnelPage = pushFunnelPage;
|
|
11
8
|
exports.verifyFunnel = verifyFunnel;
|
|
12
9
|
const client_1 = require("./client");
|
|
13
10
|
const BASE_URL = 'https://api.myfunnelapi.com';
|
|
@@ -23,17 +20,8 @@ async function listFunnels(apiKey, orgId) {
|
|
|
23
20
|
async function deleteFunnel(apiKey, orgId, funnelId) {
|
|
24
21
|
return (0, client_1.request)('DELETE', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}`, apiKey);
|
|
25
22
|
}
|
|
26
|
-
async function
|
|
27
|
-
return (0, client_1.request)('POST', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/
|
|
28
|
-
}
|
|
29
|
-
async function publishFunnel(apiKey, orgId, funnelId) {
|
|
30
|
-
return (0, client_1.request)('POST', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/publish`, apiKey);
|
|
31
|
-
}
|
|
32
|
-
async function getPublishStatus(apiKey, orgId, funnelId) {
|
|
33
|
-
return (0, client_1.request)('GET', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/publish/status`, apiKey);
|
|
34
|
-
}
|
|
35
|
-
async function pushPage(apiKey, orgId, funnelId, slug, html) {
|
|
36
|
-
return (0, client_1.request)('POST', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/push-page`, apiKey, { slug, html });
|
|
23
|
+
async function pushFunnelPage(apiKey, orgId, funnelId, payload) {
|
|
24
|
+
return (0, client_1.request)('POST', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/push-page`, apiKey, payload);
|
|
37
25
|
}
|
|
38
26
|
async function verifyFunnel(apiKey, orgId, funnelId, opts) {
|
|
39
27
|
return (0, client_1.request)('POST', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/verify`, apiKey, opts || {});
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
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;
|
|
39
|
+
exports.url = exports.workflow = exports.webhook = exports.storage = exports.pixel = exports.image = exports.funnel = exports.email = exports.domain = exports.hq = void 0;
|
|
40
40
|
// AUTO-GENERATED by scripts/generate-indexes.js — do not edit manually
|
|
41
41
|
__exportStar(require("./types"), exports);
|
|
42
42
|
__exportStar(require("./client"), exports);
|
|
@@ -49,3 +49,4 @@ exports.pixel = __importStar(require("./pixel"));
|
|
|
49
49
|
exports.storage = __importStar(require("./storage"));
|
|
50
50
|
exports.webhook = __importStar(require("./webhook"));
|
|
51
51
|
exports.workflow = __importStar(require("./workflow"));
|
|
52
|
+
exports.url = __importStar(require("./url"));
|
package/dist/url.d.ts
ADDED
package/dist/url.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shortenUrl = shortenUrl;
|
|
4
|
+
const client_1 = require("./client");
|
|
5
|
+
const BASE_URL = 'https://api.myurlto.com';
|
|
6
|
+
async function shortenUrl(apiKey, orgId, url) {
|
|
7
|
+
return (0, client_1.request)('POST', `${BASE_URL}/url/orgs/${encodeURIComponent(orgId)}/shorten`, apiKey, { url });
|
|
8
|
+
}
|
package/dist/webhook.d.ts
CHANGED
|
@@ -15,6 +15,6 @@ export interface Delivery {
|
|
|
15
15
|
created_at: string;
|
|
16
16
|
}
|
|
17
17
|
export declare function createEndpoint(apiKey: string, orgId: string, name: string, description?: string): Promise<WebhookEndpoint>;
|
|
18
|
-
export declare function listEndpoints(apiKey: string): Promise<WebhookEndpoint[]>;
|
|
19
|
-
export declare function deleteEndpoint(apiKey: string, endpointId: string): Promise<void>;
|
|
20
|
-
export declare function getDelivery(apiKey: string, deliveryId: string): Promise<Delivery>;
|
|
18
|
+
export declare function listEndpoints(apiKey: string, orgId: string): Promise<WebhookEndpoint[]>;
|
|
19
|
+
export declare function deleteEndpoint(apiKey: string, orgId: string, endpointId: string): Promise<void>;
|
|
20
|
+
export declare function getDelivery(apiKey: string, orgId: string, deliveryId: string): Promise<Delivery>;
|
package/dist/webhook.js
CHANGED
|
@@ -7,14 +7,14 @@ exports.getDelivery = getDelivery;
|
|
|
7
7
|
const client_1 = require("./client");
|
|
8
8
|
const BASE_URL = 'https://api.mywebhookapi.com';
|
|
9
9
|
async function createEndpoint(apiKey, orgId, name, description) {
|
|
10
|
-
return (0, client_1.request)('POST', `${BASE_URL}/webhook/endpoints`, apiKey, {
|
|
10
|
+
return (0, client_1.request)('POST', `${BASE_URL}/webhook/orgs/${encodeURIComponent(orgId)}/endpoints`, apiKey, { name, description });
|
|
11
11
|
}
|
|
12
|
-
async function listEndpoints(apiKey) {
|
|
13
|
-
return (0, client_1.request)('GET', `${BASE_URL}/webhook/endpoints`, apiKey);
|
|
12
|
+
async function listEndpoints(apiKey, orgId) {
|
|
13
|
+
return (0, client_1.request)('GET', `${BASE_URL}/webhook/orgs/${encodeURIComponent(orgId)}/endpoints`, apiKey);
|
|
14
14
|
}
|
|
15
|
-
async function deleteEndpoint(apiKey, endpointId) {
|
|
16
|
-
return (0, client_1.request)('DELETE', `${BASE_URL}/webhook/endpoints/${encodeURIComponent(endpointId)}`, apiKey);
|
|
15
|
+
async function deleteEndpoint(apiKey, orgId, endpointId) {
|
|
16
|
+
return (0, client_1.request)('DELETE', `${BASE_URL}/webhook/orgs/${encodeURIComponent(orgId)}/endpoints/${encodeURIComponent(endpointId)}`, apiKey);
|
|
17
17
|
}
|
|
18
|
-
async function getDelivery(apiKey, deliveryId) {
|
|
19
|
-
return (0, client_1.request)('GET', `${BASE_URL}/webhook/deliveries/${encodeURIComponent(deliveryId)}`, apiKey);
|
|
18
|
+
async function getDelivery(apiKey, orgId, deliveryId) {
|
|
19
|
+
return (0, client_1.request)('GET', `${BASE_URL}/webhook/orgs/${encodeURIComponent(orgId)}/deliveries/${encodeURIComponent(deliveryId)}`, apiKey);
|
|
20
20
|
}
|
package/dist/workflow.d.ts
CHANGED
|
@@ -32,25 +32,24 @@ export interface WorkflowRun {
|
|
|
32
32
|
finished_at?: string;
|
|
33
33
|
created_at: string;
|
|
34
34
|
}
|
|
35
|
-
export declare function createWorkflow(apiKey: string, payload: {
|
|
36
|
-
org_id: string;
|
|
35
|
+
export declare function createWorkflow(apiKey: string, orgId: string, payload: {
|
|
37
36
|
name: string;
|
|
38
37
|
trigger_config: {
|
|
39
38
|
endpoint_id: string;
|
|
40
39
|
};
|
|
41
40
|
steps: WorkflowStep[];
|
|
42
41
|
}): Promise<Workflow>;
|
|
43
|
-
export declare function listWorkflows(apiKey: string): Promise<Workflow[]>;
|
|
44
|
-
export declare function getWorkflow(apiKey: string, workflowId: string): Promise<Workflow>;
|
|
45
|
-
export declare function updateWorkflow(apiKey: string, workflowId: string, payload: {
|
|
42
|
+
export declare function listWorkflows(apiKey: string, orgId: string): Promise<Workflow[]>;
|
|
43
|
+
export declare function getWorkflow(apiKey: string, orgId: string, workflowId: string): Promise<Workflow>;
|
|
44
|
+
export declare function updateWorkflow(apiKey: string, orgId: string, workflowId: string, payload: {
|
|
46
45
|
name?: string;
|
|
47
46
|
trigger_config?: {
|
|
48
47
|
endpoint_id: string;
|
|
49
48
|
};
|
|
50
49
|
steps?: WorkflowStep[];
|
|
51
50
|
}): Promise<Workflow>;
|
|
52
|
-
export declare function enableWorkflow(apiKey: string, workflowId: string): Promise<void>;
|
|
53
|
-
export declare function disableWorkflow(apiKey: string, workflowId: string): Promise<void>;
|
|
54
|
-
export declare function deleteWorkflow(apiKey: string, workflowId: string): Promise<void>;
|
|
55
|
-
export declare function listWorkflowRuns(apiKey: string, workflowId: string): Promise<WorkflowRun[]>;
|
|
56
|
-
export declare function getWorkflowRun(apiKey: string, runId: string): Promise<WorkflowRun>;
|
|
51
|
+
export declare function enableWorkflow(apiKey: string, orgId: string, workflowId: string): Promise<void>;
|
|
52
|
+
export declare function disableWorkflow(apiKey: string, orgId: string, workflowId: string): Promise<void>;
|
|
53
|
+
export declare function deleteWorkflow(apiKey: string, orgId: string, workflowId: string): Promise<void>;
|
|
54
|
+
export declare function listWorkflowRuns(apiKey: string, orgId: string, workflowId: string): Promise<WorkflowRun[]>;
|
|
55
|
+
export declare function getWorkflowRun(apiKey: string, orgId: string, runId: string): Promise<WorkflowRun>;
|
package/dist/workflow.js
CHANGED
|
@@ -11,30 +11,30 @@ exports.listWorkflowRuns = listWorkflowRuns;
|
|
|
11
11
|
exports.getWorkflowRun = getWorkflowRun;
|
|
12
12
|
const client_1 = require("./client");
|
|
13
13
|
const BASE_URL = 'https://api.myworkflowapi.com';
|
|
14
|
-
async function createWorkflow(apiKey, payload) {
|
|
15
|
-
return (0, client_1.request)('POST', `${BASE_URL}/workflow/workflows`, apiKey, payload);
|
|
14
|
+
async function createWorkflow(apiKey, orgId, payload) {
|
|
15
|
+
return (0, client_1.request)('POST', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows`, apiKey, payload);
|
|
16
16
|
}
|
|
17
|
-
async function listWorkflows(apiKey) {
|
|
18
|
-
return (0, client_1.request)('GET', `${BASE_URL}/workflow/workflows`, apiKey);
|
|
17
|
+
async function listWorkflows(apiKey, orgId) {
|
|
18
|
+
return (0, client_1.request)('GET', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows`, apiKey);
|
|
19
19
|
}
|
|
20
|
-
async function getWorkflow(apiKey, workflowId) {
|
|
21
|
-
return (0, client_1.request)('GET', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}`, apiKey);
|
|
20
|
+
async function getWorkflow(apiKey, orgId, workflowId) {
|
|
21
|
+
return (0, client_1.request)('GET', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows/${encodeURIComponent(workflowId)}`, apiKey);
|
|
22
22
|
}
|
|
23
|
-
async function updateWorkflow(apiKey, workflowId, payload) {
|
|
24
|
-
return (0, client_1.request)('PATCH', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}`, apiKey, payload);
|
|
23
|
+
async function updateWorkflow(apiKey, orgId, workflowId, payload) {
|
|
24
|
+
return (0, client_1.request)('PATCH', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows/${encodeURIComponent(workflowId)}`, apiKey, payload);
|
|
25
25
|
}
|
|
26
|
-
async function enableWorkflow(apiKey, workflowId) {
|
|
27
|
-
return (0, client_1.request)('POST', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}/enable`, apiKey);
|
|
26
|
+
async function enableWorkflow(apiKey, orgId, workflowId) {
|
|
27
|
+
return (0, client_1.request)('POST', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows/${encodeURIComponent(workflowId)}/enable`, apiKey);
|
|
28
28
|
}
|
|
29
|
-
async function disableWorkflow(apiKey, workflowId) {
|
|
30
|
-
return (0, client_1.request)('POST', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}/disable`, apiKey);
|
|
29
|
+
async function disableWorkflow(apiKey, orgId, workflowId) {
|
|
30
|
+
return (0, client_1.request)('POST', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows/${encodeURIComponent(workflowId)}/disable`, apiKey);
|
|
31
31
|
}
|
|
32
|
-
async function deleteWorkflow(apiKey, workflowId) {
|
|
33
|
-
return (0, client_1.request)('DELETE', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}`, apiKey);
|
|
32
|
+
async function deleteWorkflow(apiKey, orgId, workflowId) {
|
|
33
|
+
return (0, client_1.request)('DELETE', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows/${encodeURIComponent(workflowId)}`, apiKey);
|
|
34
34
|
}
|
|
35
|
-
async function listWorkflowRuns(apiKey, workflowId) {
|
|
36
|
-
return (0, client_1.request)('GET', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}/runs`, apiKey);
|
|
35
|
+
async function listWorkflowRuns(apiKey, orgId, workflowId) {
|
|
36
|
+
return (0, client_1.request)('GET', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows/${encodeURIComponent(workflowId)}/runs`, apiKey);
|
|
37
37
|
}
|
|
38
|
-
async function getWorkflowRun(apiKey, runId) {
|
|
39
|
-
return (0, client_1.request)('GET', `${BASE_URL}/workflow/runs/${encodeURIComponent(runId)}`, apiKey);
|
|
38
|
+
async function getWorkflowRun(apiKey, orgId, runId) {
|
|
39
|
+
return (0, client_1.request)('GET', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/runs/${encodeURIComponent(runId)}`, apiKey);
|
|
40
40
|
}
|
package/package.json
CHANGED
package/src/client.d.ts
ADDED
package/src/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/src/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/src/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/src/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>;
|