feat(application): add IOAuth2TokenService and IPop3EmailService interfaces
This commit is contained in:
@@ -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
|
||||||
@@ -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
|
||||||
Reference in New Issue
Block a user