Refactor IMAP email fetching to use SearchFilter

Replaced individual parameters (`folder`, `unseenOnly`, `maxCount`) in `IImapEmailService` with a consolidated `SearchFilter` object to simplify method signatures and improve maintainability.

Renamed `MailQuery` to `SearchFilter` in `FetchEmailsQuery` for better clarity. Updated `FetchEmailsQueryHandler` and `LimilabsImapEmailService` to use the new `SearchFilter` object, ensuring consistent handling of folder selection, unread message filtering, and message count limits.

Improved logging in `LimilabsImapEmailService` to reflect the updated `SearchFilter` structure.
This commit is contained in:
2026-08-07 13:25:13 +02:00
parent 52a416f6d9
commit 53ba40b316
3 changed files with 12 additions and 20 deletions

View File

@@ -11,15 +11,11 @@ public interface IImapEmailService
/// Fetches emails from the specified mailbox folder.
/// </summary>
/// <param name="account">Account whose IMAP settings will be used.</param>
/// <param name="folder">Mailbox folder name (e.g. "INBOX"). Defaults to INBOX.</param>
/// <param name="unseenOnly">When <see langword="true"/> returns only unread messages.</param>
/// <param name="maxCount">Maximum number of messages to retrieve (most-recent first). 0 = unlimited.</param>
/// <param name="filter">Filter to apply when fetching emails.</param>
/// <param name="cancellationToken">Cancellation token.</param>
Task<IEnumerable<ReceivedEmailContext>> FetchEmailsAsync(
EmailAccountDto account,
string folder = "INBOX",
bool unseenOnly = false,
int maxCount = 50,
FetchEmailsQuery.SearchFilter filter,
CancellationToken cancellationToken = default);
/// <summary>