This repository has been archived by the owner on Sep 7, 2024. It is now read-only.
generated from NuroDev/npm-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemail.types.ts
62 lines (55 loc) · 1.39 KB
/
email.types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import type { BaseResponse } from "~/types/request";
import type { EmailParams } from "~/types/email";
/**
* @see https://developers.mailersend.com/general.html#activity-status-list
*/
export type EmailStatus =
| "clicked"
| "delivered"
| "hard_bounced"
| "junk"
| "opened"
| "processed"
| "queued"
| "sent"
| "soft_bounced"
| "spam_complaints"
| "unsubscribed";
export interface BulkEmailStatusData {
created_at: string;
id: string;
messages_id: string | null;
state: EmailStatus;
suppressed_recipients_count: number;
suppressed_recipients: unknown | null;
total_recipients_count: number;
updated_at: string;
validation_errors_count: number;
validation_errors: unknown | null;
}
export type BulkEmailStatusResponse = BaseResponse<BulkEmailStatusData>;
export type SendEmailParams = Omit<EmailParams, "recipients"> &
Record<string, any>;
export type SendEmailResponse =
| {
success: true;
}
| {
errors: Record<string, Array<string>>;
message: string;
success: false;
warning?: Array<{
type: string;
warning: string;
recipients: Array<{
email: string;
name: string;
reasons: Array<string>;
}>;
}>;
};
export type SendBulkEmailsParams = EmailParams & Record<string, any>;
export interface SendBulkEmailsResponse {
bulk_email_id: string;
message: string;
}