Refactor attachment handling in email fetching

Consolidate `WithAttachments` behavior into `MailSearchFilter` to simplify the API and reduce redundancy.

- Removed `withAttachments` parameter from `FetchEmailsAsync` in `IImapEmailService`.
- Added `WithAttachments` property to `MailSearchFilter` to control attachment inclusion.
- Removed `WithAttachments` property from `FetchEmailsQuery` as it is now encapsulated in `MailSearchFilter`.
- Updated `FetchEmailsQueryHandler` to use `MailSearchFilter` for attachment handling.
- Refactored `LimilabsImapEmailService` to use `MailSearchFilter.WithAttachments` for mapping email data.

These changes improve maintainability and clarity by centralizing attachment-related options in `MailSearchFilter`.
This commit is contained in:
2026-08-10 12:05:27 +02:00
parent 763ba67d34
commit 74ec00ddd3
4 changed files with 7 additions and 11 deletions

View File

@@ -13,12 +13,10 @@ public interface IImapEmailService
/// </summary>
/// <param name="account">Account whose IMAP settings will be used.</param>
/// <param name="filter">Filter to apply when fetching emails.</param>
/// <param name="withAttachments">When <see langword="true"/>, attachment data is included in the results; otherwise attachments are omitted. Defaults to <see langword="false"/>.</param>
/// <param name="cancellationToken">Cancellation token.</param>
Task<IEnumerable<ReceivedEmailContext>> FetchEmailsAsync(
EmailAccountDto account,
MailSearchFilter filter,
bool withAttachments = false,
CancellationToken cancellationToken = default);
/// <summary>