diff --git a/src/core/DigitalData.MessagingService.Application/Common/Interfaces/IOAuth2TokenService.cs b/src/core/DigitalData.MessagingService.Application/Common/Interfaces/IOAuth2TokenService.cs new file mode 100644 index 0000000..3a4ac71 --- /dev/null +++ b/src/core/DigitalData.MessagingService.Application/Common/Interfaces/IOAuth2TokenService.cs @@ -0,0 +1,18 @@ +#if NET +using DigitalData.MessagingService.Domain.Entities; + +namespace DigitalData.MessagingService.Application.Common.Interfaces; + +/// +/// Acquires and caches OAuth2 access tokens for email protocols (IMAP, POP3, SMTP). +/// Uses the client credentials flow (application-level auth — no user interaction required). +/// +public interface IOAuth2TokenService +{ + /// + /// Returns a valid access token for the given email account. + /// Tokens are cached and refreshed automatically before expiry. + /// + Task GetAccessTokenAsync(EmailAccount account, CancellationToken cancellationToken = default); +} +#endif diff --git a/src/core/DigitalData.MessagingService.Application/Common/Interfaces/IPop3EmailService.cs b/src/core/DigitalData.MessagingService.Application/Common/Interfaces/IPop3EmailService.cs new file mode 100644 index 0000000..aaf529d --- /dev/null +++ b/src/core/DigitalData.MessagingService.Application/Common/Interfaces/IPop3EmailService.cs @@ -0,0 +1,25 @@ +#if NET +using DigitalData.MessagingService.Application.Common.Dto; +using DigitalData.MessagingService.Domain.Entities; + +namespace DigitalData.MessagingService.Application.Common.Interfaces; + +/// +/// Service interface for reading emails via POP3. +/// +public interface IPop3EmailService +{ + /// + /// 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". + /// + Task SyncEmailsAsync( + EmailAccount account, + CancellationToken cancellationToken = default); + + /// + /// Gets the last POP3 sync date for the specified account. + /// + DateTime? GetLastPop3SyncDate(int accountId); +} +#endif