Neah/lib/types.ts
2025-05-02 09:10:52 +02:00

77 lines
1.5 KiB
TypeScript

export interface EmailCredentials {
// IMAP Settings
email: string;
password?: string;
host: string;
port: number;
secure?: boolean;
encryptedPassword?: string;
// OAuth Settings (for Microsoft accounts)
useOAuth?: boolean;
accessToken?: string;
refreshToken?: string;
tokenExpiry?: number;
// SMTP Settings
smtp_host?: string;
smtp_port?: number;
smtp_secure?: boolean; // true for SSL, false for TLS
// Display Settings
display_name?: string;
color?: string;
}
export interface EmailAddress {
name: string;
address: string;
}
export interface EmailAttachment {
contentId?: string;
filename: string;
contentType: string;
size: number;
path?: string;
content?: string;
}
export interface EmailMessage {
id: string;
from: EmailAddress[];
to: EmailAddress[];
cc?: EmailAddress[];
bcc?: EmailAddress[];
subject: string;
content: {
text: string;
html: string;
isHtml: boolean; // Whether the email is HTML or plain text
direction: string; // Text direction (ltr or rtl)
};
preview?: string;
date: Date;
flags: {
seen: boolean;
answered: boolean;
flagged: boolean;
draft: boolean;
deleted: boolean;
};
size: number;
hasAttachments: boolean;
folder: string;
contentFetched: boolean;
accountId?: string;
messageId?: string;
attachments?: EmailAttachment[];
}
export interface Account {
id: number | string;
name: string;
email: string;
color: string;
folders?: string[];
}