@myapihq/sdk 1.0.9 → 1.0.10
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 +28 -29
- package/dist/email.js +56 -56
- package/package.json +1 -1
- package/src/email.ts +56 -56
package/dist/email.d.ts
CHANGED
|
@@ -46,18 +46,18 @@ export interface CampaignStats {
|
|
|
46
46
|
page_visits: number;
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
export declare function createMailbox(apiKey: string, domain: string, username: string): Promise<{
|
|
49
|
+
export declare function createMailbox(apiKey: string, orgId: string, domain: string, username: string): Promise<{
|
|
50
50
|
address: string;
|
|
51
51
|
created_at: string;
|
|
52
52
|
}>;
|
|
53
|
-
export declare function listMailboxes(apiKey: string): Promise<{
|
|
53
|
+
export declare function listMailboxes(apiKey: string, orgId: string): Promise<{
|
|
54
54
|
address: string;
|
|
55
55
|
created_at: string;
|
|
56
56
|
}[]>;
|
|
57
|
-
export declare function activateSending(apiKey: string, address: string): Promise<{
|
|
57
|
+
export declare function activateSending(apiKey: string, orgId: string, address: string): Promise<{
|
|
58
58
|
status: string;
|
|
59
59
|
}>;
|
|
60
|
-
export declare function sendEmail(apiKey: string, payload: {
|
|
60
|
+
export declare function sendEmail(apiKey: string, orgId: string, payload: {
|
|
61
61
|
from: string;
|
|
62
62
|
to: string[];
|
|
63
63
|
subject: string;
|
|
@@ -66,26 +66,25 @@ export declare function sendEmail(apiKey: string, payload: {
|
|
|
66
66
|
}): Promise<{
|
|
67
67
|
message_id: string;
|
|
68
68
|
}>;
|
|
69
|
-
export declare function getEmailStatus(apiKey: string, messageId: string): Promise<{
|
|
69
|
+
export declare function getEmailStatus(apiKey: string, orgId: string, messageId: string): Promise<{
|
|
70
70
|
status: string;
|
|
71
71
|
delivered_at?: string;
|
|
72
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<{
|
|
73
|
+
export declare function getInbox(apiKey: string, orgId: string, address: string): Promise<EmailMessage[]>;
|
|
74
|
+
export declare function getMessage(apiKey: string, orgId: string, messageId: string, address: string): Promise<EmailMessage>;
|
|
75
|
+
export declare function startWarmup(apiKey: string, orgId: string, address: string): Promise<{
|
|
76
76
|
warmup_status: string;
|
|
77
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<{
|
|
78
|
+
export declare function pauseWarmup(apiKey: string, orgId: string, address: string): Promise<void>;
|
|
79
|
+
export declare function resumeWarmup(apiKey: string, orgId: string, address: string): Promise<void>;
|
|
80
|
+
export declare function stopWarmup(apiKey: string, orgId: string, address: string): Promise<void>;
|
|
81
|
+
export declare function getWarmupStats(apiKey: string, orgId: string, address: string): Promise<{
|
|
82
82
|
sent: number;
|
|
83
83
|
landed_inbox: number;
|
|
84
84
|
landed_spam: number;
|
|
85
85
|
health_score: number;
|
|
86
86
|
}>;
|
|
87
|
-
export declare function generateTemplate(apiKey: string, payload: {
|
|
88
|
-
org_id: string;
|
|
87
|
+
export declare function generateTemplate(apiKey: string, orgId: string, payload: {
|
|
89
88
|
prompt: string;
|
|
90
89
|
name: string;
|
|
91
90
|
}): Promise<{
|
|
@@ -94,7 +93,7 @@ export declare function generateTemplate(apiKey: string, payload: {
|
|
|
94
93
|
status: string;
|
|
95
94
|
preview_url: string;
|
|
96
95
|
}>;
|
|
97
|
-
export declare function getTemplateJobStatus(apiKey: string, jobId: string): Promise<{
|
|
96
|
+
export declare function getTemplateJobStatus(apiKey: string, orgId: string, jobId: string): Promise<{
|
|
98
97
|
status: 'processing' | 'completed' | 'failed';
|
|
99
98
|
template_id: string;
|
|
100
99
|
result?: {
|
|
@@ -102,43 +101,43 @@ export declare function getTemplateJobStatus(apiKey: string, jobId: string): Pro
|
|
|
102
101
|
preview_url: string;
|
|
103
102
|
};
|
|
104
103
|
}>;
|
|
105
|
-
export declare function editTemplate(apiKey: string, templateId: string, prompt: string): Promise<{
|
|
104
|
+
export declare function editTemplate(apiKey: string, orgId: string, templateId: string, prompt: string): Promise<{
|
|
106
105
|
template_id: string;
|
|
107
106
|
preview_url: string;
|
|
108
107
|
}>;
|
|
109
|
-
export declare function sendTestEmail(apiKey: string, templateId: string, to: string): Promise<{
|
|
108
|
+
export declare function sendTestEmail(apiKey: string, orgId: string, templateId: string, to: string): Promise<{
|
|
110
109
|
ok: boolean;
|
|
111
110
|
message_id: string;
|
|
112
111
|
}>;
|
|
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: {
|
|
112
|
+
export declare function listTemplates(apiKey: string, orgId: string): Promise<EmailTemplate[]>;
|
|
113
|
+
export declare function deleteTemplate(apiKey: string, orgId: string, templateId: string): Promise<void>;
|
|
114
|
+
export declare function createCampaign(apiKey: string, orgId: string, payload: {
|
|
116
115
|
name: string;
|
|
117
116
|
template_id: string;
|
|
118
117
|
from_address: string;
|
|
119
118
|
rate_per_minute?: number;
|
|
120
119
|
per_hour_limit?: number;
|
|
121
120
|
}): Promise<Campaign>;
|
|
122
|
-
export declare function uploadContactList(apiKey: string, campaignId: string, emails: string[]): Promise<{
|
|
121
|
+
export declare function uploadContactList(apiKey: string, orgId: string, campaignId: string, emails: string[]): Promise<{
|
|
123
122
|
list_id: string;
|
|
124
123
|
total: number;
|
|
125
124
|
status: string;
|
|
126
125
|
}>;
|
|
127
|
-
export declare function getContactUploadStatus(apiKey: string, campaignId: string): Promise<{
|
|
126
|
+
export declare function getContactUploadStatus(apiKey: string, orgId: string, campaignId: string): Promise<{
|
|
128
127
|
upload_status: 'ready' | 'validating' | 'failed';
|
|
129
128
|
total: number;
|
|
130
129
|
valid_count: number;
|
|
131
130
|
invalid_count: number;
|
|
132
131
|
}>;
|
|
133
|
-
export declare function startCampaign(apiKey: string, campaignId: string): Promise<{
|
|
132
|
+
export declare function startCampaign(apiKey: string, orgId: string, campaignId: string): Promise<{
|
|
134
133
|
status: string;
|
|
135
134
|
}>;
|
|
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: {
|
|
135
|
+
export declare function pauseCampaign(apiKey: string, orgId: string, campaignId: string): Promise<void>;
|
|
136
|
+
export declare function resumeCampaign(apiKey: string, orgId: string, campaignId: string): Promise<void>;
|
|
137
|
+
export declare function getCampaignStats(apiKey: string, orgId: string, campaignId: string): Promise<CampaignStats>;
|
|
138
|
+
export declare function listCampaigns(apiKey: string, orgId: string): Promise<Campaign[]>;
|
|
139
|
+
export declare function getCampaign(apiKey: string, orgId: string, campaignId: string): Promise<Campaign>;
|
|
140
|
+
export declare function updateCampaign(apiKey: string, orgId: string, campaignId: string, payload: {
|
|
142
141
|
name?: string;
|
|
143
142
|
per_day_limit?: number;
|
|
144
143
|
}): Promise<Campaign>;
|
package/dist/email.js
CHANGED
|
@@ -30,87 +30,87 @@ exports.getCampaign = getCampaign;
|
|
|
30
30
|
exports.updateCampaign = updateCampaign;
|
|
31
31
|
const client_1 = require("./client");
|
|
32
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/
|
|
33
|
+
async function createMailbox(apiKey, orgId, domain, username) {
|
|
34
|
+
return (0, client_1.request)('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/mailboxes/create`, apiKey, { domain, username });
|
|
35
35
|
}
|
|
36
|
-
async function listMailboxes(apiKey) {
|
|
37
|
-
return (0, client_1.request)('GET', `${BASE_URL}/email/
|
|
36
|
+
async function listMailboxes(apiKey, orgId) {
|
|
37
|
+
return (0, client_1.request)('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/mailboxes`, apiKey);
|
|
38
38
|
}
|
|
39
|
-
async function activateSending(apiKey, address) {
|
|
40
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/sending/activate`, apiKey, { address });
|
|
39
|
+
async function activateSending(apiKey, orgId, address) {
|
|
40
|
+
return (0, client_1.request)('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/sending/activate`, apiKey, { address });
|
|
41
41
|
}
|
|
42
|
-
async function sendEmail(apiKey, payload) {
|
|
43
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/send`, apiKey, payload);
|
|
42
|
+
async function sendEmail(apiKey, orgId, payload) {
|
|
43
|
+
return (0, client_1.request)('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/send`, apiKey, payload);
|
|
44
44
|
}
|
|
45
|
-
async function getEmailStatus(apiKey, messageId) {
|
|
46
|
-
return (0, client_1.request)('GET', `${BASE_URL}/email/status/${encodeURIComponent(messageId)}`, apiKey);
|
|
45
|
+
async function getEmailStatus(apiKey, orgId, messageId) {
|
|
46
|
+
return (0, client_1.request)('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/status/${encodeURIComponent(messageId)}`, apiKey);
|
|
47
47
|
}
|
|
48
|
-
async function getInbox(apiKey, address) {
|
|
49
|
-
return (0, client_1.request)('GET', `${BASE_URL}/email/inbox/${encodeURIComponent(address)}`, apiKey);
|
|
48
|
+
async function getInbox(apiKey, orgId, address) {
|
|
49
|
+
return (0, client_1.request)('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/inbox/${encodeURIComponent(address)}`, apiKey);
|
|
50
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);
|
|
51
|
+
async function getMessage(apiKey, orgId, messageId, address) {
|
|
52
|
+
return (0, client_1.request)('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/message/${encodeURIComponent(messageId)}?address=${encodeURIComponent(address)}`, apiKey);
|
|
53
53
|
}
|
|
54
|
-
async function startWarmup(apiKey, address) {
|
|
55
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/warmup/start`, apiKey, { address });
|
|
54
|
+
async function startWarmup(apiKey, orgId, address) {
|
|
55
|
+
return (0, client_1.request)('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/warmup/start`, apiKey, { address });
|
|
56
56
|
}
|
|
57
|
-
async function pauseWarmup(apiKey, address) {
|
|
58
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/warmup/pause`, apiKey, { address });
|
|
57
|
+
async function pauseWarmup(apiKey, orgId, address) {
|
|
58
|
+
return (0, client_1.request)('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/warmup/pause`, apiKey, { address });
|
|
59
59
|
}
|
|
60
|
-
async function resumeWarmup(apiKey, address) {
|
|
61
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/warmup/resume`, apiKey, { address });
|
|
60
|
+
async function resumeWarmup(apiKey, orgId, address) {
|
|
61
|
+
return (0, client_1.request)('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/warmup/resume`, apiKey, { address });
|
|
62
62
|
}
|
|
63
|
-
async function stopWarmup(apiKey, address) {
|
|
64
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/warmup/stop`, apiKey, { address });
|
|
63
|
+
async function stopWarmup(apiKey, orgId, address) {
|
|
64
|
+
return (0, client_1.request)('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/warmup/stop`, apiKey, { address });
|
|
65
65
|
}
|
|
66
|
-
async function getWarmupStats(apiKey, address) {
|
|
67
|
-
return (0, client_1.request)('GET', `${BASE_URL}/email/warmup/stats/${encodeURIComponent(address)}`, apiKey);
|
|
66
|
+
async function getWarmupStats(apiKey, orgId, address) {
|
|
67
|
+
return (0, client_1.request)('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/warmup/stats/${encodeURIComponent(address)}`, apiKey);
|
|
68
68
|
}
|
|
69
|
-
async function generateTemplate(apiKey, payload) {
|
|
70
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/templates/generate`, apiKey, payload);
|
|
69
|
+
async function generateTemplate(apiKey, orgId, payload) {
|
|
70
|
+
return (0, client_1.request)('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/templates/generate`, apiKey, payload);
|
|
71
71
|
}
|
|
72
|
-
async function getTemplateJobStatus(apiKey, jobId) {
|
|
73
|
-
return (0, client_1.request)('GET', `${BASE_URL}/email/template-jobs/${encodeURIComponent(jobId)}`, apiKey);
|
|
72
|
+
async function getTemplateJobStatus(apiKey, orgId, jobId) {
|
|
73
|
+
return (0, client_1.request)('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/template-jobs/${encodeURIComponent(jobId)}`, apiKey);
|
|
74
74
|
}
|
|
75
|
-
async function editTemplate(apiKey, templateId, prompt) {
|
|
76
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/templates/${encodeURIComponent(templateId)}/edit`, apiKey, { prompt });
|
|
75
|
+
async function editTemplate(apiKey, orgId, templateId, prompt) {
|
|
76
|
+
return (0, client_1.request)('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/templates/${encodeURIComponent(templateId)}/edit`, apiKey, { prompt });
|
|
77
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 });
|
|
78
|
+
async function sendTestEmail(apiKey, orgId, templateId, to) {
|
|
79
|
+
return (0, client_1.request)('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/templates/${encodeURIComponent(templateId)}/send-test`, apiKey, { to });
|
|
80
80
|
}
|
|
81
|
-
async function listTemplates(apiKey) {
|
|
82
|
-
return (0, client_1.request)('GET', `${BASE_URL}/email/templates`, apiKey);
|
|
81
|
+
async function listTemplates(apiKey, orgId) {
|
|
82
|
+
return (0, client_1.request)('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/templates`, apiKey);
|
|
83
83
|
}
|
|
84
|
-
async function deleteTemplate(apiKey, templateId) {
|
|
85
|
-
return (0, client_1.request)('DELETE', `${BASE_URL}/email/templates/${encodeURIComponent(templateId)}`, apiKey);
|
|
84
|
+
async function deleteTemplate(apiKey, orgId, templateId) {
|
|
85
|
+
return (0, client_1.request)('DELETE', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/templates/${encodeURIComponent(templateId)}`, apiKey);
|
|
86
86
|
}
|
|
87
|
-
async function createCampaign(apiKey, payload) {
|
|
88
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/campaigns`, apiKey, payload);
|
|
87
|
+
async function createCampaign(apiKey, orgId, payload) {
|
|
88
|
+
return (0, client_1.request)('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/campaigns`, apiKey, payload);
|
|
89
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 });
|
|
90
|
+
async function uploadContactList(apiKey, orgId, campaignId, emails) {
|
|
91
|
+
return (0, client_1.request)('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}/contacts/upload-list`, apiKey, { emails });
|
|
92
92
|
}
|
|
93
|
-
async function getContactUploadStatus(apiKey, campaignId) {
|
|
94
|
-
return (0, client_1.request)('GET', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}/contacts/status`, apiKey);
|
|
93
|
+
async function getContactUploadStatus(apiKey, orgId, campaignId) {
|
|
94
|
+
return (0, client_1.request)('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}/contacts/status`, apiKey);
|
|
95
95
|
}
|
|
96
|
-
async function startCampaign(apiKey, campaignId) {
|
|
97
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}/start`, apiKey);
|
|
96
|
+
async function startCampaign(apiKey, orgId, campaignId) {
|
|
97
|
+
return (0, client_1.request)('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}/start`, apiKey);
|
|
98
98
|
}
|
|
99
|
-
async function pauseCampaign(apiKey, campaignId) {
|
|
100
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}/pause`, apiKey);
|
|
99
|
+
async function pauseCampaign(apiKey, orgId, campaignId) {
|
|
100
|
+
return (0, client_1.request)('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}/pause`, apiKey);
|
|
101
101
|
}
|
|
102
|
-
async function resumeCampaign(apiKey, campaignId) {
|
|
103
|
-
return (0, client_1.request)('POST', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}/resume`, apiKey);
|
|
102
|
+
async function resumeCampaign(apiKey, orgId, campaignId) {
|
|
103
|
+
return (0, client_1.request)('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}/resume`, apiKey);
|
|
104
104
|
}
|
|
105
|
-
async function getCampaignStats(apiKey, campaignId) {
|
|
106
|
-
return (0, client_1.request)('GET', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}/stats`, apiKey);
|
|
105
|
+
async function getCampaignStats(apiKey, orgId, campaignId) {
|
|
106
|
+
return (0, client_1.request)('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}/stats`, apiKey);
|
|
107
107
|
}
|
|
108
|
-
async function listCampaigns(apiKey) {
|
|
109
|
-
return (0, client_1.request)('GET', `${BASE_URL}/email/campaigns`, apiKey);
|
|
108
|
+
async function listCampaigns(apiKey, orgId) {
|
|
109
|
+
return (0, client_1.request)('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/campaigns`, apiKey);
|
|
110
110
|
}
|
|
111
|
-
async function getCampaign(apiKey, campaignId) {
|
|
112
|
-
return (0, client_1.request)('GET', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}`, apiKey);
|
|
111
|
+
async function getCampaign(apiKey, orgId, campaignId) {
|
|
112
|
+
return (0, client_1.request)('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}`, apiKey);
|
|
113
113
|
}
|
|
114
|
-
async function updateCampaign(apiKey, campaignId, payload) {
|
|
115
|
-
return (0, client_1.request)('PATCH', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}`, apiKey, payload);
|
|
114
|
+
async function updateCampaign(apiKey, orgId, campaignId, payload) {
|
|
115
|
+
return (0, client_1.request)('PATCH', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}`, apiKey, payload);
|
|
116
116
|
}
|
package/package.json
CHANGED
package/src/email.ts
CHANGED
|
@@ -12,91 +12,91 @@ export interface CampaignStats {
|
|
|
12
12
|
engagement: { sent: number; opens: number; clicks: number; page_visits: number };
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export async function createMailbox(apiKey: string, domain: string, username: string): Promise<{ address: string; created_at: string }> {
|
|
16
|
-
return request('POST', `${BASE_URL}/email/
|
|
15
|
+
export async function createMailbox(apiKey: string, orgId: string, domain: string, username: string): Promise<{ address: string; created_at: string }> {
|
|
16
|
+
return request('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/mailboxes/create`, apiKey, { domain, username });
|
|
17
17
|
}
|
|
18
|
-
export async function listMailboxes(apiKey: string): Promise<{ address: string; created_at: string }[]> {
|
|
19
|
-
return request('GET', `${BASE_URL}/email/
|
|
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);
|
|
20
20
|
}
|
|
21
|
-
export async function activateSending(apiKey: string, address: string): Promise<{ status: string }> {
|
|
22
|
-
return request('POST', `${BASE_URL}/email/sending/activate`, apiKey, { address });
|
|
21
|
+
export async function activateSending(apiKey: string, orgId: string, address: string): Promise<{ status: string }> {
|
|
22
|
+
return request('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/sending/activate`, apiKey, { address });
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export async function sendEmail(apiKey: string, payload: { from: string; to: string[]; subject: string; html?: string; text?: string; }): Promise<{ message_id: string }> {
|
|
26
|
-
return request('POST', `${BASE_URL}/email/send`, apiKey, payload);
|
|
25
|
+
export async function sendEmail(apiKey: string, orgId: string, payload: { from: string; to: string[]; subject: string; html?: string; text?: string; }): Promise<{ message_id: string }> {
|
|
26
|
+
return request('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/send`, apiKey, payload);
|
|
27
27
|
}
|
|
28
|
-
export async function getEmailStatus(apiKey: string, messageId: string): Promise<{ status: string; delivered_at?: string }> {
|
|
29
|
-
return request('GET', `${BASE_URL}/email/status/${encodeURIComponent(messageId)}`, apiKey);
|
|
28
|
+
export async function getEmailStatus(apiKey: string, orgId: string, messageId: string): Promise<{ status: string; delivered_at?: string }> {
|
|
29
|
+
return request('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/status/${encodeURIComponent(messageId)}`, apiKey);
|
|
30
30
|
}
|
|
31
|
-
export async function getInbox(apiKey: string, address: string): Promise<EmailMessage[]> {
|
|
32
|
-
return request('GET', `${BASE_URL}/email/inbox/${encodeURIComponent(address)}`, apiKey);
|
|
31
|
+
export async function getInbox(apiKey: string, orgId: string, address: string): Promise<EmailMessage[]> {
|
|
32
|
+
return request('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/inbox/${encodeURIComponent(address)}`, apiKey);
|
|
33
33
|
}
|
|
34
|
-
export async function getMessage(apiKey: string, messageId: string, address: string): Promise<EmailMessage> {
|
|
35
|
-
return request('GET', `${BASE_URL}/email/message/${encodeURIComponent(messageId)}?address=${encodeURIComponent(address)}`, apiKey);
|
|
34
|
+
export async function getMessage(apiKey: string, orgId: string, messageId: string, address: string): Promise<EmailMessage> {
|
|
35
|
+
return request('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/message/${encodeURIComponent(messageId)}?address=${encodeURIComponent(address)}`, apiKey);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
export async function startWarmup(apiKey: string, address: string): Promise<{ warmup_status: string }> {
|
|
39
|
-
return request('POST', `${BASE_URL}/email/warmup/start`, apiKey, { address });
|
|
38
|
+
export async function startWarmup(apiKey: string, orgId: string, address: string): Promise<{ warmup_status: string }> {
|
|
39
|
+
return request('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/warmup/start`, apiKey, { address });
|
|
40
40
|
}
|
|
41
|
-
export async function pauseWarmup(apiKey: string, address: string): Promise<void> {
|
|
42
|
-
return request('POST', `${BASE_URL}/email/warmup/pause`, apiKey, { address });
|
|
41
|
+
export async function pauseWarmup(apiKey: string, orgId: string, address: string): Promise<void> {
|
|
42
|
+
return request('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/warmup/pause`, apiKey, { address });
|
|
43
43
|
}
|
|
44
|
-
export async function resumeWarmup(apiKey: string, address: string): Promise<void> {
|
|
45
|
-
return request('POST', `${BASE_URL}/email/warmup/resume`, apiKey, { address });
|
|
44
|
+
export async function resumeWarmup(apiKey: string, orgId: string, address: string): Promise<void> {
|
|
45
|
+
return request('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/warmup/resume`, apiKey, { address });
|
|
46
46
|
}
|
|
47
|
-
export async function stopWarmup(apiKey: string, address: string): Promise<void> {
|
|
48
|
-
return request('POST', `${BASE_URL}/email/warmup/stop`, apiKey, { address });
|
|
47
|
+
export async function stopWarmup(apiKey: string, orgId: string, address: string): Promise<void> {
|
|
48
|
+
return request('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/warmup/stop`, apiKey, { address });
|
|
49
49
|
}
|
|
50
|
-
export async function getWarmupStats(apiKey: string, address: string): Promise<{ sent: number; landed_inbox: number; landed_spam: number; health_score: number }> {
|
|
51
|
-
return request('GET', `${BASE_URL}/email/warmup/stats/${encodeURIComponent(address)}`, apiKey);
|
|
50
|
+
export async function getWarmupStats(apiKey: string, orgId: string, address: string): Promise<{ sent: number; landed_inbox: number; landed_spam: number; health_score: number }> {
|
|
51
|
+
return request('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/warmup/stats/${encodeURIComponent(address)}`, apiKey);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
export async function generateTemplate(apiKey: string,
|
|
55
|
-
return request('POST', `${BASE_URL}/email/templates/generate`, apiKey, payload);
|
|
54
|
+
export async function generateTemplate(apiKey: string, orgId: string, payload: { prompt: string; name: string; }): Promise<{ job_id: string; template_id: string; status: string; preview_url: string }> {
|
|
55
|
+
return request('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/templates/generate`, apiKey, payload);
|
|
56
56
|
}
|
|
57
|
-
export async function getTemplateJobStatus(apiKey: string, jobId: string): Promise<{ status: 'processing' | 'completed' | 'failed'; template_id: string; result?: { subject: string; preview_url: string } }> {
|
|
58
|
-
return request('GET', `${BASE_URL}/email/template-jobs/${encodeURIComponent(jobId)}`, apiKey);
|
|
57
|
+
export async function getTemplateJobStatus(apiKey: string, orgId: string, jobId: string): Promise<{ status: 'processing' | 'completed' | 'failed'; template_id: string; result?: { subject: string; preview_url: string } }> {
|
|
58
|
+
return request('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/template-jobs/${encodeURIComponent(jobId)}`, apiKey);
|
|
59
59
|
}
|
|
60
|
-
export async function editTemplate(apiKey: string, templateId: string, prompt: string): Promise<{ template_id: string; preview_url: string }> {
|
|
61
|
-
return request('POST', `${BASE_URL}/email/templates/${encodeURIComponent(templateId)}/edit`, apiKey, { prompt });
|
|
60
|
+
export async function editTemplate(apiKey: string, orgId: string, templateId: string, prompt: string): Promise<{ template_id: string; preview_url: string }> {
|
|
61
|
+
return request('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/templates/${encodeURIComponent(templateId)}/edit`, apiKey, { prompt });
|
|
62
62
|
}
|
|
63
|
-
export async function sendTestEmail(apiKey: string, templateId: string, to: string): Promise<{ ok: boolean; message_id: string }> {
|
|
64
|
-
return request('POST', `${BASE_URL}/email/templates/${encodeURIComponent(templateId)}/send-test`, apiKey, { to });
|
|
63
|
+
export async function sendTestEmail(apiKey: string, orgId: string, templateId: string, to: string): Promise<{ ok: boolean; message_id: string }> {
|
|
64
|
+
return request('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/templates/${encodeURIComponent(templateId)}/send-test`, apiKey, { to });
|
|
65
65
|
}
|
|
66
|
-
export async function listTemplates(apiKey: string): Promise<EmailTemplate[]> {
|
|
67
|
-
return request('GET', `${BASE_URL}/email/templates`, apiKey);
|
|
66
|
+
export async function listTemplates(apiKey: string, orgId: string): Promise<EmailTemplate[]> {
|
|
67
|
+
return request('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/templates`, apiKey);
|
|
68
68
|
}
|
|
69
|
-
export async function deleteTemplate(apiKey: string, templateId: string): Promise<void> {
|
|
70
|
-
return request('DELETE', `${BASE_URL}/email/templates/${encodeURIComponent(templateId)}`, apiKey);
|
|
69
|
+
export async function deleteTemplate(apiKey: string, orgId: string, templateId: string): Promise<void> {
|
|
70
|
+
return request('DELETE', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/templates/${encodeURIComponent(templateId)}`, apiKey);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
export async function createCampaign(apiKey: string, payload: { name: string; template_id: string; from_address: string; rate_per_minute?: number; per_hour_limit?: number; }): Promise<Campaign> {
|
|
74
|
-
return request('POST', `${BASE_URL}/email/campaigns`, apiKey, payload);
|
|
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> {
|
|
74
|
+
return request('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/campaigns`, apiKey, payload);
|
|
75
75
|
}
|
|
76
|
-
export async function uploadContactList(apiKey: string, campaignId: string, emails: string[]): Promise<{ list_id: string; total: number; status: string }> {
|
|
77
|
-
return request('POST', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}/contacts/upload-list`, apiKey, { emails });
|
|
76
|
+
export async function uploadContactList(apiKey: string, orgId: string, campaignId: string, emails: string[]): Promise<{ list_id: string; total: number; status: string }> {
|
|
77
|
+
return request('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}/contacts/upload-list`, apiKey, { emails });
|
|
78
78
|
}
|
|
79
|
-
export async function getContactUploadStatus(apiKey: string, campaignId: string): Promise<{ upload_status: 'ready' | 'validating' | 'failed'; total: number; valid_count: number; invalid_count: number }> {
|
|
80
|
-
return request('GET', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}/contacts/status`, apiKey);
|
|
79
|
+
export async function getContactUploadStatus(apiKey: string, orgId: string, campaignId: string): Promise<{ upload_status: 'ready' | 'validating' | 'failed'; total: number; valid_count: number; invalid_count: number }> {
|
|
80
|
+
return request('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}/contacts/status`, apiKey);
|
|
81
81
|
}
|
|
82
|
-
export async function startCampaign(apiKey: string, campaignId: string): Promise<{ status: string }> {
|
|
83
|
-
return request('POST', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}/start`, apiKey);
|
|
82
|
+
export async function startCampaign(apiKey: string, orgId: string, campaignId: string): Promise<{ status: string }> {
|
|
83
|
+
return request('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}/start`, apiKey);
|
|
84
84
|
}
|
|
85
|
-
export async function pauseCampaign(apiKey: string, campaignId: string): Promise<void> {
|
|
86
|
-
return request('POST', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}/pause`, apiKey);
|
|
85
|
+
export async function pauseCampaign(apiKey: string, orgId: string, campaignId: string): Promise<void> {
|
|
86
|
+
return request('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}/pause`, apiKey);
|
|
87
87
|
}
|
|
88
|
-
export async function resumeCampaign(apiKey: string, campaignId: string): Promise<void> {
|
|
89
|
-
return request('POST', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}/resume`, apiKey);
|
|
88
|
+
export async function resumeCampaign(apiKey: string, orgId: string, campaignId: string): Promise<void> {
|
|
89
|
+
return request('POST', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}/resume`, apiKey);
|
|
90
90
|
}
|
|
91
|
-
export async function getCampaignStats(apiKey: string, campaignId: string): Promise<CampaignStats> {
|
|
92
|
-
return request('GET', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}/stats`, apiKey);
|
|
91
|
+
export async function getCampaignStats(apiKey: string, orgId: string, campaignId: string): Promise<CampaignStats> {
|
|
92
|
+
return request('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}/stats`, apiKey);
|
|
93
93
|
}
|
|
94
|
-
export async function listCampaigns(apiKey: string): Promise<Campaign[]> {
|
|
95
|
-
return request('GET', `${BASE_URL}/email/campaigns`, apiKey);
|
|
94
|
+
export async function listCampaigns(apiKey: string, orgId: string): Promise<Campaign[]> {
|
|
95
|
+
return request('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/campaigns`, apiKey);
|
|
96
96
|
}
|
|
97
|
-
export async function getCampaign(apiKey: string, campaignId: string): Promise<Campaign> {
|
|
98
|
-
return request('GET', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}`, apiKey);
|
|
97
|
+
export async function getCampaign(apiKey: string, orgId: string, campaignId: string): Promise<Campaign> {
|
|
98
|
+
return request('GET', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}`, apiKey);
|
|
99
99
|
}
|
|
100
|
-
export async function updateCampaign(apiKey: string, campaignId: string, payload: { name?: string; per_day_limit?: number }): Promise<Campaign> {
|
|
101
|
-
return request('PATCH', `${BASE_URL}/email/campaigns/${encodeURIComponent(campaignId)}`, apiKey, payload);
|
|
100
|
+
export async function updateCampaign(apiKey: string, orgId: string, campaignId: string, payload: { name?: string; per_day_limit?: number }): Promise<Campaign> {
|
|
101
|
+
return request('PATCH', `${BASE_URL}/email/orgs/${encodeURIComponent(orgId)}/campaigns/${encodeURIComponent(campaignId)}`, apiKey, payload);
|
|
102
102
|
}
|