emailr 1.3.4 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +201 -1
- package/dist/index.d.ts +201 -1
- package/dist/index.js +97 -0
- package/dist/index.mjs +97 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -34,6 +34,121 @@ interface PaginatedResponse<T> {
|
|
|
34
34
|
interface SuccessResponse {
|
|
35
35
|
success: boolean;
|
|
36
36
|
}
|
|
37
|
+
interface Inbox {
|
|
38
|
+
id: string;
|
|
39
|
+
organization_id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
username: string;
|
|
42
|
+
domain: string;
|
|
43
|
+
from_address: string;
|
|
44
|
+
inbound_address: string;
|
|
45
|
+
created_at: string;
|
|
46
|
+
updated_at: string;
|
|
47
|
+
}
|
|
48
|
+
interface CreateInboxRequest {
|
|
49
|
+
name: string;
|
|
50
|
+
username: string;
|
|
51
|
+
domain: string;
|
|
52
|
+
}
|
|
53
|
+
interface UpdateInboxRequest {
|
|
54
|
+
name?: string;
|
|
55
|
+
}
|
|
56
|
+
interface ListInboxesParams {
|
|
57
|
+
}
|
|
58
|
+
interface Thread {
|
|
59
|
+
thread_id: string;
|
|
60
|
+
subject: string | null;
|
|
61
|
+
latest_email_id: string;
|
|
62
|
+
from_email: string;
|
|
63
|
+
to_email: string;
|
|
64
|
+
preview: string | null;
|
|
65
|
+
labels: string[];
|
|
66
|
+
message_count: number;
|
|
67
|
+
participants: string[];
|
|
68
|
+
has_attachments: boolean;
|
|
69
|
+
created_at: string;
|
|
70
|
+
updated_at: string;
|
|
71
|
+
}
|
|
72
|
+
interface ThreadMessage {
|
|
73
|
+
id: string;
|
|
74
|
+
from_email: string;
|
|
75
|
+
to_email: string;
|
|
76
|
+
cc_emails: string[] | null;
|
|
77
|
+
bcc_emails: string[] | null;
|
|
78
|
+
subject: string | null;
|
|
79
|
+
html_content: string | null;
|
|
80
|
+
text_content: string | null;
|
|
81
|
+
status: string;
|
|
82
|
+
labels: string[];
|
|
83
|
+
attachments: unknown[] | null;
|
|
84
|
+
created_at: string;
|
|
85
|
+
sent_at: string | null;
|
|
86
|
+
}
|
|
87
|
+
interface ThreadDetail {
|
|
88
|
+
thread_id: string;
|
|
89
|
+
subject: string | null;
|
|
90
|
+
labels: string[];
|
|
91
|
+
messages: ThreadMessage[];
|
|
92
|
+
}
|
|
93
|
+
interface ListThreadsParams {
|
|
94
|
+
label?: string;
|
|
95
|
+
page?: number;
|
|
96
|
+
limit?: number;
|
|
97
|
+
search?: string;
|
|
98
|
+
inbox_id?: string;
|
|
99
|
+
}
|
|
100
|
+
interface UpdateLabelsRequest {
|
|
101
|
+
add?: string[];
|
|
102
|
+
remove?: string[];
|
|
103
|
+
}
|
|
104
|
+
interface UpdateLabelsResponse {
|
|
105
|
+
success: boolean;
|
|
106
|
+
labels: string[];
|
|
107
|
+
}
|
|
108
|
+
interface UpdateThreadLabelsResponse {
|
|
109
|
+
success: boolean;
|
|
110
|
+
updated: number;
|
|
111
|
+
}
|
|
112
|
+
interface ThreadReplyRequest {
|
|
113
|
+
html?: string;
|
|
114
|
+
text?: string;
|
|
115
|
+
to?: string | string[];
|
|
116
|
+
cc?: string | string[];
|
|
117
|
+
bcc?: string | string[];
|
|
118
|
+
from?: string;
|
|
119
|
+
from_name?: string;
|
|
120
|
+
reply_to_email?: string;
|
|
121
|
+
attachments?: Attachment[];
|
|
122
|
+
}
|
|
123
|
+
interface ThreadReplyResponse {
|
|
124
|
+
success: boolean;
|
|
125
|
+
message_id: string;
|
|
126
|
+
recipients: number;
|
|
127
|
+
status: string;
|
|
128
|
+
}
|
|
129
|
+
interface ThreadDraftRequest {
|
|
130
|
+
html?: string;
|
|
131
|
+
text?: string;
|
|
132
|
+
to?: string;
|
|
133
|
+
cc?: string;
|
|
134
|
+
bcc?: string;
|
|
135
|
+
from?: string;
|
|
136
|
+
from_name?: string;
|
|
137
|
+
reply_to_email?: string;
|
|
138
|
+
}
|
|
139
|
+
interface ThreadDraft {
|
|
140
|
+
id: string;
|
|
141
|
+
thread_id: string;
|
|
142
|
+
html_content: string | null;
|
|
143
|
+
text_content: string | null;
|
|
144
|
+
to_email: string | null;
|
|
145
|
+
cc_emails: string[] | null;
|
|
146
|
+
bcc_emails: string[] | null;
|
|
147
|
+
from_email: string | null;
|
|
148
|
+
subject: string | null;
|
|
149
|
+
created_at: string;
|
|
150
|
+
updated_at: string;
|
|
151
|
+
}
|
|
37
152
|
interface Attachment {
|
|
38
153
|
filename: string;
|
|
39
154
|
content: string;
|
|
@@ -99,6 +214,12 @@ interface Email {
|
|
|
99
214
|
interface ListEmailsParams {
|
|
100
215
|
page?: number;
|
|
101
216
|
limit?: number;
|
|
217
|
+
status?: string;
|
|
218
|
+
email?: string;
|
|
219
|
+
domain?: string;
|
|
220
|
+
broadcast_id?: string;
|
|
221
|
+
email_id?: string;
|
|
222
|
+
template_id?: string;
|
|
102
223
|
}
|
|
103
224
|
interface ForwardEmailRequest {
|
|
104
225
|
email_id: string;
|
|
@@ -183,6 +304,7 @@ interface Template {
|
|
|
183
304
|
reply_to: string | null;
|
|
184
305
|
preview_text: string | null;
|
|
185
306
|
created_by: string | null;
|
|
307
|
+
inbox_id: string | null;
|
|
186
308
|
created_at: string;
|
|
187
309
|
updated_at: string;
|
|
188
310
|
}
|
|
@@ -197,6 +319,7 @@ interface CreateTemplateRequest {
|
|
|
197
319
|
from_name?: string;
|
|
198
320
|
reply_to?: string;
|
|
199
321
|
preview_text?: string;
|
|
322
|
+
inbox_id?: string;
|
|
200
323
|
}
|
|
201
324
|
interface UpdateTemplateRequest {
|
|
202
325
|
name?: string;
|
|
@@ -209,6 +332,7 @@ interface UpdateTemplateRequest {
|
|
|
209
332
|
from_name?: string;
|
|
210
333
|
reply_to?: string;
|
|
211
334
|
preview_text?: string;
|
|
335
|
+
inbox_id?: string;
|
|
212
336
|
}
|
|
213
337
|
interface ListTemplatesParams {
|
|
214
338
|
page?: number;
|
|
@@ -339,6 +463,7 @@ interface Broadcast {
|
|
|
339
463
|
tags?: string[];
|
|
340
464
|
created_by: string | null;
|
|
341
465
|
created_at: string;
|
|
466
|
+
inbox_id: string | null;
|
|
342
467
|
}
|
|
343
468
|
interface CreateBroadcastRequest {
|
|
344
469
|
name: string;
|
|
@@ -353,6 +478,7 @@ interface CreateBroadcastRequest {
|
|
|
353
478
|
text_content?: string;
|
|
354
479
|
scheduled_at?: string;
|
|
355
480
|
tags?: string[];
|
|
481
|
+
inbox_id?: string;
|
|
356
482
|
}
|
|
357
483
|
interface UpdateBroadcastRequest {
|
|
358
484
|
name?: string;
|
|
@@ -367,6 +493,7 @@ interface UpdateBroadcastRequest {
|
|
|
367
493
|
text_content?: string;
|
|
368
494
|
scheduled_at?: string;
|
|
369
495
|
tags?: string[];
|
|
496
|
+
inbox_id?: string;
|
|
370
497
|
}
|
|
371
498
|
interface SendBroadcastResponse {
|
|
372
499
|
success: boolean;
|
|
@@ -509,6 +636,31 @@ interface EmailMetrics {
|
|
|
509
636
|
complained: number;
|
|
510
637
|
}
|
|
511
638
|
|
|
639
|
+
declare class InboxesResource {
|
|
640
|
+
private readonly http;
|
|
641
|
+
constructor(http: HttpClient);
|
|
642
|
+
/**
|
|
643
|
+
* Create a new inbox
|
|
644
|
+
*/
|
|
645
|
+
create(data: CreateInboxRequest): Promise<Inbox>;
|
|
646
|
+
/**
|
|
647
|
+
* List all inboxes for the organization
|
|
648
|
+
*/
|
|
649
|
+
list(): Promise<Inbox[]>;
|
|
650
|
+
/**
|
|
651
|
+
* Get inbox by ID
|
|
652
|
+
*/
|
|
653
|
+
get(id: string): Promise<Inbox>;
|
|
654
|
+
/**
|
|
655
|
+
* Update an inbox
|
|
656
|
+
*/
|
|
657
|
+
update(id: string, data: UpdateInboxRequest): Promise<Inbox>;
|
|
658
|
+
/**
|
|
659
|
+
* Delete an inbox
|
|
660
|
+
*/
|
|
661
|
+
delete(id: string): Promise<SuccessResponse>;
|
|
662
|
+
}
|
|
663
|
+
|
|
512
664
|
declare class EmailsResource {
|
|
513
665
|
private readonly http;
|
|
514
666
|
constructor(http: HttpClient);
|
|
@@ -890,6 +1042,46 @@ declare class ForwardingRulesResource {
|
|
|
890
1042
|
delete(id: string): Promise<SuccessResponse>;
|
|
891
1043
|
}
|
|
892
1044
|
|
|
1045
|
+
declare class ThreadsResource {
|
|
1046
|
+
private readonly http;
|
|
1047
|
+
constructor(http: HttpClient);
|
|
1048
|
+
/**
|
|
1049
|
+
* List email threads with optional filtering by label, search, and inbox
|
|
1050
|
+
*/
|
|
1051
|
+
list(params?: ListThreadsParams): Promise<PaginatedResponse<Thread>>;
|
|
1052
|
+
/**
|
|
1053
|
+
* Get thread detail with all messages
|
|
1054
|
+
*/
|
|
1055
|
+
get(threadId: string): Promise<ThreadDetail>;
|
|
1056
|
+
/**
|
|
1057
|
+
* Add or remove labels from all emails in a thread
|
|
1058
|
+
*/
|
|
1059
|
+
updateLabels(threadId: string, data: UpdateLabelsRequest): Promise<UpdateThreadLabelsResponse>;
|
|
1060
|
+
/**
|
|
1061
|
+
* Add or remove labels from a single email
|
|
1062
|
+
*/
|
|
1063
|
+
updateEmailLabels(emailId: string, data: UpdateLabelsRequest): Promise<UpdateLabelsResponse>;
|
|
1064
|
+
/**
|
|
1065
|
+
* Reply to a thread. From, from_name, reply_to, to, and subject are
|
|
1066
|
+
* auto-resolved from the thread's inbox when not provided.
|
|
1067
|
+
*/
|
|
1068
|
+
reply(threadId: string, data: ThreadReplyRequest): Promise<ThreadReplyResponse>;
|
|
1069
|
+
/**
|
|
1070
|
+
* Save or update a draft reply for a thread
|
|
1071
|
+
*/
|
|
1072
|
+
saveDraft(threadId: string, data: ThreadDraftRequest): Promise<ThreadDraft>;
|
|
1073
|
+
/**
|
|
1074
|
+
* Get the saved draft reply for a thread
|
|
1075
|
+
*/
|
|
1076
|
+
getDraft(threadId: string): Promise<ThreadDraft>;
|
|
1077
|
+
/**
|
|
1078
|
+
* Delete the draft reply for a thread
|
|
1079
|
+
*/
|
|
1080
|
+
deleteDraft(threadId: string): Promise<{
|
|
1081
|
+
success: boolean;
|
|
1082
|
+
}>;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
893
1085
|
/**
|
|
894
1086
|
* Configuration options for the Emailr client
|
|
895
1087
|
*/
|
|
@@ -977,6 +1169,14 @@ declare class Emailr {
|
|
|
977
1169
|
* Email forwarding rules
|
|
978
1170
|
*/
|
|
979
1171
|
readonly forwardingRules: ForwardingRulesResource;
|
|
1172
|
+
/**
|
|
1173
|
+
* Inbox management
|
|
1174
|
+
*/
|
|
1175
|
+
readonly inboxes: InboxesResource;
|
|
1176
|
+
/**
|
|
1177
|
+
* Thread and label management
|
|
1178
|
+
*/
|
|
1179
|
+
readonly threads: ThreadsResource;
|
|
980
1180
|
private readonly http;
|
|
981
1181
|
constructor(config: EmailrConfig);
|
|
982
1182
|
}
|
|
@@ -1024,4 +1224,4 @@ declare class ValidationError extends EmailrError {
|
|
|
1024
1224
|
constructor(message: string, details?: Record<string, unknown>, requestId?: string);
|
|
1025
1225
|
}
|
|
1026
1226
|
|
|
1027
|
-
export { type AddDomainRequest, type ApiKey, type Attachment, AuthenticationError, type Broadcast, type BulkCreateContactsRequest, type BulkCreateContactsResponse, type Contact, type ContactListResponse, type CreateApiKeyRequest, type CreateBroadcastRequest, type CreateContactRequest, type CreateForwardingRuleRequest, type CreateSegmentRequest, type CreateTemplateRequest, type CreateWebhookRequest, type DnsRecord, type DnsVerificationStatus, type Domain, type DomainDnsRecords, type DomainVerificationStatus, type Email, Emailr, Emailr as EmailrClient, type EmailrConfig, EmailrError, type FetchTemplateOptions, type ForwardEmailRequest, type ForwardingRule, type ListApiKeysParams, type ListBroadcastsParams, type ListContactsParams, type ListEmailsParams, type ListSegmentsParams, type ListTemplatesParams, type ListWebhooksParams, NetworkError, NotFoundError, type PaginatedResponse, type PushPreviewResponse, RateLimitError, type ReplyTo, type Segment, type SendBroadcastResponse, type SendEmailRequest, type SendEmailResponse, type SuccessResponse, type Template, type UpdateBroadcastRequest, type UpdateContactRequest, type UpdateDomainRequest, type UpdateSegmentRequest, type UpdateTemplateRequest, type UpdateWebhookRequest, ValidationError, type Webhook, type WebhookDelivery, type WebhookToggleResponse };
|
|
1227
|
+
export { type AddDomainRequest, type ApiKey, type Attachment, AuthenticationError, type Broadcast, type BulkCreateContactsRequest, type BulkCreateContactsResponse, type Contact, type ContactListResponse, type CreateApiKeyRequest, type CreateBroadcastRequest, type CreateContactRequest, type CreateForwardingRuleRequest, type CreateInboxRequest, type CreateSegmentRequest, type CreateTemplateRequest, type CreateWebhookRequest, type DnsRecord, type DnsVerificationStatus, type Domain, type DomainDnsRecords, type DomainVerificationStatus, type Email, Emailr, Emailr as EmailrClient, type EmailrConfig, EmailrError, type FetchTemplateOptions, type ForwardEmailRequest, type ForwardingRule, type Inbox, type ListApiKeysParams, type ListBroadcastsParams, type ListContactsParams, type ListEmailsParams, type ListInboxesParams, type ListSegmentsParams, type ListTemplatesParams, type ListThreadsParams, type ListWebhooksParams, NetworkError, NotFoundError, type PaginatedResponse, type PushPreviewResponse, RateLimitError, type ReplyTo, type Segment, type SendBroadcastResponse, type SendEmailRequest, type SendEmailResponse, type SuccessResponse, type Template, type Thread, type ThreadDetail, type ThreadDraft, type ThreadDraftRequest, type ThreadMessage, type ThreadReplyRequest, type ThreadReplyResponse, type UpdateBroadcastRequest, type UpdateContactRequest, type UpdateDomainRequest, type UpdateInboxRequest, type UpdateLabelsRequest, type UpdateLabelsResponse, type UpdateSegmentRequest, type UpdateTemplateRequest, type UpdateThreadLabelsResponse, type UpdateWebhookRequest, ValidationError, type Webhook, type WebhookDelivery, type WebhookToggleResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -34,6 +34,121 @@ interface PaginatedResponse<T> {
|
|
|
34
34
|
interface SuccessResponse {
|
|
35
35
|
success: boolean;
|
|
36
36
|
}
|
|
37
|
+
interface Inbox {
|
|
38
|
+
id: string;
|
|
39
|
+
organization_id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
username: string;
|
|
42
|
+
domain: string;
|
|
43
|
+
from_address: string;
|
|
44
|
+
inbound_address: string;
|
|
45
|
+
created_at: string;
|
|
46
|
+
updated_at: string;
|
|
47
|
+
}
|
|
48
|
+
interface CreateInboxRequest {
|
|
49
|
+
name: string;
|
|
50
|
+
username: string;
|
|
51
|
+
domain: string;
|
|
52
|
+
}
|
|
53
|
+
interface UpdateInboxRequest {
|
|
54
|
+
name?: string;
|
|
55
|
+
}
|
|
56
|
+
interface ListInboxesParams {
|
|
57
|
+
}
|
|
58
|
+
interface Thread {
|
|
59
|
+
thread_id: string;
|
|
60
|
+
subject: string | null;
|
|
61
|
+
latest_email_id: string;
|
|
62
|
+
from_email: string;
|
|
63
|
+
to_email: string;
|
|
64
|
+
preview: string | null;
|
|
65
|
+
labels: string[];
|
|
66
|
+
message_count: number;
|
|
67
|
+
participants: string[];
|
|
68
|
+
has_attachments: boolean;
|
|
69
|
+
created_at: string;
|
|
70
|
+
updated_at: string;
|
|
71
|
+
}
|
|
72
|
+
interface ThreadMessage {
|
|
73
|
+
id: string;
|
|
74
|
+
from_email: string;
|
|
75
|
+
to_email: string;
|
|
76
|
+
cc_emails: string[] | null;
|
|
77
|
+
bcc_emails: string[] | null;
|
|
78
|
+
subject: string | null;
|
|
79
|
+
html_content: string | null;
|
|
80
|
+
text_content: string | null;
|
|
81
|
+
status: string;
|
|
82
|
+
labels: string[];
|
|
83
|
+
attachments: unknown[] | null;
|
|
84
|
+
created_at: string;
|
|
85
|
+
sent_at: string | null;
|
|
86
|
+
}
|
|
87
|
+
interface ThreadDetail {
|
|
88
|
+
thread_id: string;
|
|
89
|
+
subject: string | null;
|
|
90
|
+
labels: string[];
|
|
91
|
+
messages: ThreadMessage[];
|
|
92
|
+
}
|
|
93
|
+
interface ListThreadsParams {
|
|
94
|
+
label?: string;
|
|
95
|
+
page?: number;
|
|
96
|
+
limit?: number;
|
|
97
|
+
search?: string;
|
|
98
|
+
inbox_id?: string;
|
|
99
|
+
}
|
|
100
|
+
interface UpdateLabelsRequest {
|
|
101
|
+
add?: string[];
|
|
102
|
+
remove?: string[];
|
|
103
|
+
}
|
|
104
|
+
interface UpdateLabelsResponse {
|
|
105
|
+
success: boolean;
|
|
106
|
+
labels: string[];
|
|
107
|
+
}
|
|
108
|
+
interface UpdateThreadLabelsResponse {
|
|
109
|
+
success: boolean;
|
|
110
|
+
updated: number;
|
|
111
|
+
}
|
|
112
|
+
interface ThreadReplyRequest {
|
|
113
|
+
html?: string;
|
|
114
|
+
text?: string;
|
|
115
|
+
to?: string | string[];
|
|
116
|
+
cc?: string | string[];
|
|
117
|
+
bcc?: string | string[];
|
|
118
|
+
from?: string;
|
|
119
|
+
from_name?: string;
|
|
120
|
+
reply_to_email?: string;
|
|
121
|
+
attachments?: Attachment[];
|
|
122
|
+
}
|
|
123
|
+
interface ThreadReplyResponse {
|
|
124
|
+
success: boolean;
|
|
125
|
+
message_id: string;
|
|
126
|
+
recipients: number;
|
|
127
|
+
status: string;
|
|
128
|
+
}
|
|
129
|
+
interface ThreadDraftRequest {
|
|
130
|
+
html?: string;
|
|
131
|
+
text?: string;
|
|
132
|
+
to?: string;
|
|
133
|
+
cc?: string;
|
|
134
|
+
bcc?: string;
|
|
135
|
+
from?: string;
|
|
136
|
+
from_name?: string;
|
|
137
|
+
reply_to_email?: string;
|
|
138
|
+
}
|
|
139
|
+
interface ThreadDraft {
|
|
140
|
+
id: string;
|
|
141
|
+
thread_id: string;
|
|
142
|
+
html_content: string | null;
|
|
143
|
+
text_content: string | null;
|
|
144
|
+
to_email: string | null;
|
|
145
|
+
cc_emails: string[] | null;
|
|
146
|
+
bcc_emails: string[] | null;
|
|
147
|
+
from_email: string | null;
|
|
148
|
+
subject: string | null;
|
|
149
|
+
created_at: string;
|
|
150
|
+
updated_at: string;
|
|
151
|
+
}
|
|
37
152
|
interface Attachment {
|
|
38
153
|
filename: string;
|
|
39
154
|
content: string;
|
|
@@ -99,6 +214,12 @@ interface Email {
|
|
|
99
214
|
interface ListEmailsParams {
|
|
100
215
|
page?: number;
|
|
101
216
|
limit?: number;
|
|
217
|
+
status?: string;
|
|
218
|
+
email?: string;
|
|
219
|
+
domain?: string;
|
|
220
|
+
broadcast_id?: string;
|
|
221
|
+
email_id?: string;
|
|
222
|
+
template_id?: string;
|
|
102
223
|
}
|
|
103
224
|
interface ForwardEmailRequest {
|
|
104
225
|
email_id: string;
|
|
@@ -183,6 +304,7 @@ interface Template {
|
|
|
183
304
|
reply_to: string | null;
|
|
184
305
|
preview_text: string | null;
|
|
185
306
|
created_by: string | null;
|
|
307
|
+
inbox_id: string | null;
|
|
186
308
|
created_at: string;
|
|
187
309
|
updated_at: string;
|
|
188
310
|
}
|
|
@@ -197,6 +319,7 @@ interface CreateTemplateRequest {
|
|
|
197
319
|
from_name?: string;
|
|
198
320
|
reply_to?: string;
|
|
199
321
|
preview_text?: string;
|
|
322
|
+
inbox_id?: string;
|
|
200
323
|
}
|
|
201
324
|
interface UpdateTemplateRequest {
|
|
202
325
|
name?: string;
|
|
@@ -209,6 +332,7 @@ interface UpdateTemplateRequest {
|
|
|
209
332
|
from_name?: string;
|
|
210
333
|
reply_to?: string;
|
|
211
334
|
preview_text?: string;
|
|
335
|
+
inbox_id?: string;
|
|
212
336
|
}
|
|
213
337
|
interface ListTemplatesParams {
|
|
214
338
|
page?: number;
|
|
@@ -339,6 +463,7 @@ interface Broadcast {
|
|
|
339
463
|
tags?: string[];
|
|
340
464
|
created_by: string | null;
|
|
341
465
|
created_at: string;
|
|
466
|
+
inbox_id: string | null;
|
|
342
467
|
}
|
|
343
468
|
interface CreateBroadcastRequest {
|
|
344
469
|
name: string;
|
|
@@ -353,6 +478,7 @@ interface CreateBroadcastRequest {
|
|
|
353
478
|
text_content?: string;
|
|
354
479
|
scheduled_at?: string;
|
|
355
480
|
tags?: string[];
|
|
481
|
+
inbox_id?: string;
|
|
356
482
|
}
|
|
357
483
|
interface UpdateBroadcastRequest {
|
|
358
484
|
name?: string;
|
|
@@ -367,6 +493,7 @@ interface UpdateBroadcastRequest {
|
|
|
367
493
|
text_content?: string;
|
|
368
494
|
scheduled_at?: string;
|
|
369
495
|
tags?: string[];
|
|
496
|
+
inbox_id?: string;
|
|
370
497
|
}
|
|
371
498
|
interface SendBroadcastResponse {
|
|
372
499
|
success: boolean;
|
|
@@ -509,6 +636,31 @@ interface EmailMetrics {
|
|
|
509
636
|
complained: number;
|
|
510
637
|
}
|
|
511
638
|
|
|
639
|
+
declare class InboxesResource {
|
|
640
|
+
private readonly http;
|
|
641
|
+
constructor(http: HttpClient);
|
|
642
|
+
/**
|
|
643
|
+
* Create a new inbox
|
|
644
|
+
*/
|
|
645
|
+
create(data: CreateInboxRequest): Promise<Inbox>;
|
|
646
|
+
/**
|
|
647
|
+
* List all inboxes for the organization
|
|
648
|
+
*/
|
|
649
|
+
list(): Promise<Inbox[]>;
|
|
650
|
+
/**
|
|
651
|
+
* Get inbox by ID
|
|
652
|
+
*/
|
|
653
|
+
get(id: string): Promise<Inbox>;
|
|
654
|
+
/**
|
|
655
|
+
* Update an inbox
|
|
656
|
+
*/
|
|
657
|
+
update(id: string, data: UpdateInboxRequest): Promise<Inbox>;
|
|
658
|
+
/**
|
|
659
|
+
* Delete an inbox
|
|
660
|
+
*/
|
|
661
|
+
delete(id: string): Promise<SuccessResponse>;
|
|
662
|
+
}
|
|
663
|
+
|
|
512
664
|
declare class EmailsResource {
|
|
513
665
|
private readonly http;
|
|
514
666
|
constructor(http: HttpClient);
|
|
@@ -890,6 +1042,46 @@ declare class ForwardingRulesResource {
|
|
|
890
1042
|
delete(id: string): Promise<SuccessResponse>;
|
|
891
1043
|
}
|
|
892
1044
|
|
|
1045
|
+
declare class ThreadsResource {
|
|
1046
|
+
private readonly http;
|
|
1047
|
+
constructor(http: HttpClient);
|
|
1048
|
+
/**
|
|
1049
|
+
* List email threads with optional filtering by label, search, and inbox
|
|
1050
|
+
*/
|
|
1051
|
+
list(params?: ListThreadsParams): Promise<PaginatedResponse<Thread>>;
|
|
1052
|
+
/**
|
|
1053
|
+
* Get thread detail with all messages
|
|
1054
|
+
*/
|
|
1055
|
+
get(threadId: string): Promise<ThreadDetail>;
|
|
1056
|
+
/**
|
|
1057
|
+
* Add or remove labels from all emails in a thread
|
|
1058
|
+
*/
|
|
1059
|
+
updateLabels(threadId: string, data: UpdateLabelsRequest): Promise<UpdateThreadLabelsResponse>;
|
|
1060
|
+
/**
|
|
1061
|
+
* Add or remove labels from a single email
|
|
1062
|
+
*/
|
|
1063
|
+
updateEmailLabels(emailId: string, data: UpdateLabelsRequest): Promise<UpdateLabelsResponse>;
|
|
1064
|
+
/**
|
|
1065
|
+
* Reply to a thread. From, from_name, reply_to, to, and subject are
|
|
1066
|
+
* auto-resolved from the thread's inbox when not provided.
|
|
1067
|
+
*/
|
|
1068
|
+
reply(threadId: string, data: ThreadReplyRequest): Promise<ThreadReplyResponse>;
|
|
1069
|
+
/**
|
|
1070
|
+
* Save or update a draft reply for a thread
|
|
1071
|
+
*/
|
|
1072
|
+
saveDraft(threadId: string, data: ThreadDraftRequest): Promise<ThreadDraft>;
|
|
1073
|
+
/**
|
|
1074
|
+
* Get the saved draft reply for a thread
|
|
1075
|
+
*/
|
|
1076
|
+
getDraft(threadId: string): Promise<ThreadDraft>;
|
|
1077
|
+
/**
|
|
1078
|
+
* Delete the draft reply for a thread
|
|
1079
|
+
*/
|
|
1080
|
+
deleteDraft(threadId: string): Promise<{
|
|
1081
|
+
success: boolean;
|
|
1082
|
+
}>;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
893
1085
|
/**
|
|
894
1086
|
* Configuration options for the Emailr client
|
|
895
1087
|
*/
|
|
@@ -977,6 +1169,14 @@ declare class Emailr {
|
|
|
977
1169
|
* Email forwarding rules
|
|
978
1170
|
*/
|
|
979
1171
|
readonly forwardingRules: ForwardingRulesResource;
|
|
1172
|
+
/**
|
|
1173
|
+
* Inbox management
|
|
1174
|
+
*/
|
|
1175
|
+
readonly inboxes: InboxesResource;
|
|
1176
|
+
/**
|
|
1177
|
+
* Thread and label management
|
|
1178
|
+
*/
|
|
1179
|
+
readonly threads: ThreadsResource;
|
|
980
1180
|
private readonly http;
|
|
981
1181
|
constructor(config: EmailrConfig);
|
|
982
1182
|
}
|
|
@@ -1024,4 +1224,4 @@ declare class ValidationError extends EmailrError {
|
|
|
1024
1224
|
constructor(message: string, details?: Record<string, unknown>, requestId?: string);
|
|
1025
1225
|
}
|
|
1026
1226
|
|
|
1027
|
-
export { type AddDomainRequest, type ApiKey, type Attachment, AuthenticationError, type Broadcast, type BulkCreateContactsRequest, type BulkCreateContactsResponse, type Contact, type ContactListResponse, type CreateApiKeyRequest, type CreateBroadcastRequest, type CreateContactRequest, type CreateForwardingRuleRequest, type CreateSegmentRequest, type CreateTemplateRequest, type CreateWebhookRequest, type DnsRecord, type DnsVerificationStatus, type Domain, type DomainDnsRecords, type DomainVerificationStatus, type Email, Emailr, Emailr as EmailrClient, type EmailrConfig, EmailrError, type FetchTemplateOptions, type ForwardEmailRequest, type ForwardingRule, type ListApiKeysParams, type ListBroadcastsParams, type ListContactsParams, type ListEmailsParams, type ListSegmentsParams, type ListTemplatesParams, type ListWebhooksParams, NetworkError, NotFoundError, type PaginatedResponse, type PushPreviewResponse, RateLimitError, type ReplyTo, type Segment, type SendBroadcastResponse, type SendEmailRequest, type SendEmailResponse, type SuccessResponse, type Template, type UpdateBroadcastRequest, type UpdateContactRequest, type UpdateDomainRequest, type UpdateSegmentRequest, type UpdateTemplateRequest, type UpdateWebhookRequest, ValidationError, type Webhook, type WebhookDelivery, type WebhookToggleResponse };
|
|
1227
|
+
export { type AddDomainRequest, type ApiKey, type Attachment, AuthenticationError, type Broadcast, type BulkCreateContactsRequest, type BulkCreateContactsResponse, type Contact, type ContactListResponse, type CreateApiKeyRequest, type CreateBroadcastRequest, type CreateContactRequest, type CreateForwardingRuleRequest, type CreateInboxRequest, type CreateSegmentRequest, type CreateTemplateRequest, type CreateWebhookRequest, type DnsRecord, type DnsVerificationStatus, type Domain, type DomainDnsRecords, type DomainVerificationStatus, type Email, Emailr, Emailr as EmailrClient, type EmailrConfig, EmailrError, type FetchTemplateOptions, type ForwardEmailRequest, type ForwardingRule, type Inbox, type ListApiKeysParams, type ListBroadcastsParams, type ListContactsParams, type ListEmailsParams, type ListInboxesParams, type ListSegmentsParams, type ListTemplatesParams, type ListThreadsParams, type ListWebhooksParams, NetworkError, NotFoundError, type PaginatedResponse, type PushPreviewResponse, RateLimitError, type ReplyTo, type Segment, type SendBroadcastResponse, type SendEmailRequest, type SendEmailResponse, type SuccessResponse, type Template, type Thread, type ThreadDetail, type ThreadDraft, type ThreadDraftRequest, type ThreadMessage, type ThreadReplyRequest, type ThreadReplyResponse, type UpdateBroadcastRequest, type UpdateContactRequest, type UpdateDomainRequest, type UpdateInboxRequest, type UpdateLabelsRequest, type UpdateLabelsResponse, type UpdateSegmentRequest, type UpdateTemplateRequest, type UpdateThreadLabelsResponse, type UpdateWebhookRequest, ValidationError, type Webhook, type WebhookDelivery, type WebhookToggleResponse };
|
package/dist/index.js
CHANGED
|
@@ -179,6 +179,43 @@ var HttpClient = class {
|
|
|
179
179
|
}
|
|
180
180
|
};
|
|
181
181
|
|
|
182
|
+
// src/resources/inboxes.ts
|
|
183
|
+
var InboxesResource = class {
|
|
184
|
+
constructor(http) {
|
|
185
|
+
this.http = http;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Create a new inbox
|
|
189
|
+
*/
|
|
190
|
+
async create(data) {
|
|
191
|
+
return this.http.post("/v1/inboxes", data);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* List all inboxes for the organization
|
|
195
|
+
*/
|
|
196
|
+
async list() {
|
|
197
|
+
return this.http.get("/v1/inboxes");
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Get inbox by ID
|
|
201
|
+
*/
|
|
202
|
+
async get(id) {
|
|
203
|
+
return this.http.get(`/v1/inboxes/${id}`);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Update an inbox
|
|
207
|
+
*/
|
|
208
|
+
async update(id, data) {
|
|
209
|
+
return this.http.put(`/v1/inboxes/${id}`, data);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Delete an inbox
|
|
213
|
+
*/
|
|
214
|
+
async delete(id) {
|
|
215
|
+
return this.http.delete(`/v1/inboxes/${id}`);
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
|
|
182
219
|
// src/resources/emails.ts
|
|
183
220
|
var EmailsResource = class {
|
|
184
221
|
constructor(http) {
|
|
@@ -705,6 +742,64 @@ var ForwardingRulesResource = class {
|
|
|
705
742
|
}
|
|
706
743
|
};
|
|
707
744
|
|
|
745
|
+
// src/resources/threads.ts
|
|
746
|
+
var ThreadsResource = class {
|
|
747
|
+
constructor(http) {
|
|
748
|
+
this.http = http;
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* List email threads with optional filtering by label, search, and inbox
|
|
752
|
+
*/
|
|
753
|
+
async list(params) {
|
|
754
|
+
return this.http.get("/v1/threads", {
|
|
755
|
+
params
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* Get thread detail with all messages
|
|
760
|
+
*/
|
|
761
|
+
async get(threadId) {
|
|
762
|
+
return this.http.get(`/v1/threads/${threadId}`);
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* Add or remove labels from all emails in a thread
|
|
766
|
+
*/
|
|
767
|
+
async updateLabels(threadId, data) {
|
|
768
|
+
return this.http.patch(`/v1/threads/${threadId}/labels`, data);
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Add or remove labels from a single email
|
|
772
|
+
*/
|
|
773
|
+
async updateEmailLabels(emailId, data) {
|
|
774
|
+
return this.http.patch(`/v1/threads/emails/${emailId}/labels`, data);
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* Reply to a thread. From, from_name, reply_to, to, and subject are
|
|
778
|
+
* auto-resolved from the thread's inbox when not provided.
|
|
779
|
+
*/
|
|
780
|
+
async reply(threadId, data) {
|
|
781
|
+
return this.http.post(`/v1/threads/${threadId}/reply`, data);
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* Save or update a draft reply for a thread
|
|
785
|
+
*/
|
|
786
|
+
async saveDraft(threadId, data) {
|
|
787
|
+
return this.http.put(`/v1/threads/${threadId}/draft`, data);
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* Get the saved draft reply for a thread
|
|
791
|
+
*/
|
|
792
|
+
async getDraft(threadId) {
|
|
793
|
+
return this.http.get(`/v1/threads/${threadId}/draft`);
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Delete the draft reply for a thread
|
|
797
|
+
*/
|
|
798
|
+
async deleteDraft(threadId) {
|
|
799
|
+
return this.http.delete(`/v1/threads/${threadId}/draft`);
|
|
800
|
+
}
|
|
801
|
+
};
|
|
802
|
+
|
|
708
803
|
// src/client.ts
|
|
709
804
|
var Emailr = class {
|
|
710
805
|
constructor(config) {
|
|
@@ -728,6 +823,8 @@ var Emailr = class {
|
|
|
728
823
|
this.settings = new SettingsResource(this.http);
|
|
729
824
|
this.metrics = new MetricsResource(this.http);
|
|
730
825
|
this.forwardingRules = new ForwardingRulesResource(this.http);
|
|
826
|
+
this.inboxes = new InboxesResource(this.http);
|
|
827
|
+
this.threads = new ThreadsResource(this.http);
|
|
731
828
|
}
|
|
732
829
|
};
|
|
733
830
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.mjs
CHANGED
|
@@ -146,6 +146,43 @@ var HttpClient = class {
|
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
148
|
|
|
149
|
+
// src/resources/inboxes.ts
|
|
150
|
+
var InboxesResource = class {
|
|
151
|
+
constructor(http) {
|
|
152
|
+
this.http = http;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Create a new inbox
|
|
156
|
+
*/
|
|
157
|
+
async create(data) {
|
|
158
|
+
return this.http.post("/v1/inboxes", data);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* List all inboxes for the organization
|
|
162
|
+
*/
|
|
163
|
+
async list() {
|
|
164
|
+
return this.http.get("/v1/inboxes");
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Get inbox by ID
|
|
168
|
+
*/
|
|
169
|
+
async get(id) {
|
|
170
|
+
return this.http.get(`/v1/inboxes/${id}`);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Update an inbox
|
|
174
|
+
*/
|
|
175
|
+
async update(id, data) {
|
|
176
|
+
return this.http.put(`/v1/inboxes/${id}`, data);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Delete an inbox
|
|
180
|
+
*/
|
|
181
|
+
async delete(id) {
|
|
182
|
+
return this.http.delete(`/v1/inboxes/${id}`);
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
|
|
149
186
|
// src/resources/emails.ts
|
|
150
187
|
var EmailsResource = class {
|
|
151
188
|
constructor(http) {
|
|
@@ -672,6 +709,64 @@ var ForwardingRulesResource = class {
|
|
|
672
709
|
}
|
|
673
710
|
};
|
|
674
711
|
|
|
712
|
+
// src/resources/threads.ts
|
|
713
|
+
var ThreadsResource = class {
|
|
714
|
+
constructor(http) {
|
|
715
|
+
this.http = http;
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* List email threads with optional filtering by label, search, and inbox
|
|
719
|
+
*/
|
|
720
|
+
async list(params) {
|
|
721
|
+
return this.http.get("/v1/threads", {
|
|
722
|
+
params
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Get thread detail with all messages
|
|
727
|
+
*/
|
|
728
|
+
async get(threadId) {
|
|
729
|
+
return this.http.get(`/v1/threads/${threadId}`);
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Add or remove labels from all emails in a thread
|
|
733
|
+
*/
|
|
734
|
+
async updateLabels(threadId, data) {
|
|
735
|
+
return this.http.patch(`/v1/threads/${threadId}/labels`, data);
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Add or remove labels from a single email
|
|
739
|
+
*/
|
|
740
|
+
async updateEmailLabels(emailId, data) {
|
|
741
|
+
return this.http.patch(`/v1/threads/emails/${emailId}/labels`, data);
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Reply to a thread. From, from_name, reply_to, to, and subject are
|
|
745
|
+
* auto-resolved from the thread's inbox when not provided.
|
|
746
|
+
*/
|
|
747
|
+
async reply(threadId, data) {
|
|
748
|
+
return this.http.post(`/v1/threads/${threadId}/reply`, data);
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* Save or update a draft reply for a thread
|
|
752
|
+
*/
|
|
753
|
+
async saveDraft(threadId, data) {
|
|
754
|
+
return this.http.put(`/v1/threads/${threadId}/draft`, data);
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* Get the saved draft reply for a thread
|
|
758
|
+
*/
|
|
759
|
+
async getDraft(threadId) {
|
|
760
|
+
return this.http.get(`/v1/threads/${threadId}/draft`);
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Delete the draft reply for a thread
|
|
764
|
+
*/
|
|
765
|
+
async deleteDraft(threadId) {
|
|
766
|
+
return this.http.delete(`/v1/threads/${threadId}/draft`);
|
|
767
|
+
}
|
|
768
|
+
};
|
|
769
|
+
|
|
675
770
|
// src/client.ts
|
|
676
771
|
var Emailr = class {
|
|
677
772
|
constructor(config) {
|
|
@@ -695,6 +790,8 @@ var Emailr = class {
|
|
|
695
790
|
this.settings = new SettingsResource(this.http);
|
|
696
791
|
this.metrics = new MetricsResource(this.http);
|
|
697
792
|
this.forwardingRules = new ForwardingRulesResource(this.http);
|
|
793
|
+
this.inboxes = new InboxesResource(this.http);
|
|
794
|
+
this.threads = new ThreadsResource(this.http);
|
|
698
795
|
}
|
|
699
796
|
};
|
|
700
797
|
export {
|