feat: mail attachment support — sync, display, download, upload

This commit is contained in:
Agent Zero
2026-07-15 18:43:38 +02:00
parent de74429f4e
commit 2108bdb9c2
8 changed files with 379 additions and 114 deletions
+18
View File
@@ -39,9 +39,11 @@ export interface MailAttachment {
mail_id: string;
filename: string;
mime_type: string;
size_bytes: number;
size: number;
content_id?: string | null;
is_inline: boolean;
dms_file_id?: string | null;
}
export interface Mail {
@@ -461,6 +463,22 @@ export function downloadAttachment(mailId: string, attachmentId: string): Promis
}).then((res) => res.data);
}
export interface UploadedAttachment {
id: string;
filename: string;
mime_type: string;
size_bytes: number;
path: string;
}
export function uploadAttachment(file: File): Promise<UploadedAttachment> {
const formData = new FormData();
formData.append('file', file);
return apiClient.post<UploadedAttachment>('/mail/upload-attachment', formData, {
headers: { 'Content-Type': 'multipart/form-data' },
}).then((res) => res.data);
}
// ─── Templates ──────────────────────────────────────────────────────────────
export function createTemplate(payload: CreateTemplatePayload): Promise<MailTemplate> {