feat(application): add IOAuth2TokenService and IPop3EmailService interfaces

This commit is contained in:
2026-08-17 10:14:31 +02:00
parent 194ae11a40
commit ef8df96e65
2 changed files with 43 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
#if NET
using DigitalData.MessagingService.Domain.Entities;
namespace DigitalData.MessagingService.Application.Common.Interfaces;
/// <summary>
/// Acquires and caches OAuth2 access tokens for email protocols (IMAP, POP3, SMTP).
/// Uses the client credentials flow (application-level auth — no user interaction required).
/// </summary>
public interface IOAuth2TokenService
{
/// <summary>
/// Returns a valid access token for the given email account.
/// Tokens are cached and refreshed automatically before expiry.
/// </summary>
Task<string> GetAccessTokenAsync(EmailAccount account, CancellationToken cancellationToken = default);
}
#endif

View File

@@ -0,0 +1,25 @@
#if NET
using DigitalData.MessagingService.Application.Common.Dto;
using DigitalData.MessagingService.Domain.Entities;
namespace DigitalData.MessagingService.Application.Common.Interfaces;
/// <summary>
/// Service interface for reading emails via POP3.
/// </summary>
public interface IPop3EmailService
{
/// <summary>
/// Fetches new messages from the POP3 server and persists them locally.
/// Because POP3 has no folder concept, all messages are stored under the folder name "INBOX".
/// </summary>
Task<EmailSyncResult> SyncEmailsAsync(
EmailAccount account,
CancellationToken cancellationToken = default);
/// <summary>
/// Gets the last POP3 sync date for the specified account.
/// </summary>
DateTime? GetLastPop3SyncDate(int accountId);
}
#endif