campaign sending prototype
This commit is contained in:
@@ -46,6 +46,52 @@ export type MailImapFolderListResponse = {
|
||||
};
|
||||
|
||||
|
||||
export type MailMailboxAttachment = {
|
||||
filename?: string | null;
|
||||
content_type: string;
|
||||
size_bytes: number;
|
||||
};
|
||||
|
||||
export type MailMailboxMessageSummary = {
|
||||
uid: string;
|
||||
folder: string;
|
||||
subject?: string | null;
|
||||
from_header?: string | null;
|
||||
to_header?: string | null;
|
||||
cc_header?: string | null;
|
||||
date?: string | null;
|
||||
message_id?: string | null;
|
||||
flags?: string[];
|
||||
size_bytes?: number | null;
|
||||
body_preview?: string | null;
|
||||
attachment_count?: number;
|
||||
};
|
||||
|
||||
export type MailMailboxMessageDetail = MailMailboxMessageSummary & {
|
||||
body_text?: string | null;
|
||||
body_html?: string | null;
|
||||
headers?: Record<string, string>;
|
||||
attachments?: MailMailboxAttachment[];
|
||||
};
|
||||
|
||||
export type MailMailboxMessageListResponse = {
|
||||
profile_id: string;
|
||||
folder: string;
|
||||
host?: string | null;
|
||||
port?: number | null;
|
||||
security?: MailSecurity | string | null;
|
||||
messages: MailMailboxMessageSummary[];
|
||||
};
|
||||
|
||||
export type MailMailboxMessageResponse = {
|
||||
profile_id: string;
|
||||
folder: string;
|
||||
host?: string | null;
|
||||
port?: number | null;
|
||||
security?: MailSecurity | string | null;
|
||||
message: MailMailboxMessageDetail;
|
||||
};
|
||||
|
||||
export type MailServerProfile = {
|
||||
id: string;
|
||||
tenant_id?: string | null;
|
||||
@@ -179,6 +225,30 @@ export async function listMailProfileImapFolders(settings: ApiSettings, profileI
|
||||
return apiFetch<MailImapFolderListResponse>(settings, `/api/v1/mail/profiles/${encodeURIComponent(profileId)}/list-imap-folders`, { method: "POST" });
|
||||
}
|
||||
|
||||
export async function listMailboxFolders(settings: ApiSettings, profileId: string): Promise<MailImapFolderListResponse> {
|
||||
return apiFetch<MailImapFolderListResponse>(settings, `/api/v1/mail/profiles/${encodeURIComponent(profileId)}/mailbox/folders`);
|
||||
}
|
||||
|
||||
export async function listMailboxMessages(
|
||||
settings: ApiSettings,
|
||||
profileId: string,
|
||||
folder = "INBOX",
|
||||
limit = 50
|
||||
): Promise<MailMailboxMessageListResponse> {
|
||||
const params = new URLSearchParams({ folder, limit: String(limit) });
|
||||
return apiFetch<MailMailboxMessageListResponse>(settings, `/api/v1/mail/profiles/${encodeURIComponent(profileId)}/mailbox/messages?${params.toString()}`);
|
||||
}
|
||||
|
||||
export async function getMailboxMessage(
|
||||
settings: ApiSettings,
|
||||
profileId: string,
|
||||
folder: string,
|
||||
uid: string
|
||||
): Promise<MailMailboxMessageResponse> {
|
||||
const params = new URLSearchParams({ folder });
|
||||
return apiFetch<MailMailboxMessageResponse>(settings, `/api/v1/mail/profiles/${encodeURIComponent(profileId)}/mailbox/messages/${encodeURIComponent(uid)}?${params.toString()}`);
|
||||
}
|
||||
|
||||
export async function testSmtpSettings(
|
||||
settings: ApiSettings,
|
||||
payload: MailSmtpTestPayload
|
||||
|
||||
Reference in New Issue
Block a user