namespace Application.Abstractions.YouTube; /// /// YouTube PubSubHubbub(WebSub) 구독 관리 /// 채널의 새 영상/생방송 알림을 푸시로 수신 /// public interface IYouTubePubSubService { /// 특정 채널의 피드 구독 신청 Task SubscribeAsync(string channelId, CancellationToken ct); /// 특정 채널의 피드 구독 해지 Task UnsubscribeAsync(string channelId, CancellationToken ct); /// Atom Feed 알림 파싱 YouTubePubSubNotification? ParseNotification(string atomXml); /// HMAC 서명 검증 bool VerifySignature(string payload, string signature); /// 현재 구독 중인 YouTube 채널 ID 목록 조회 Task> GetSubscribedChannelIdsAsync(CancellationToken ct); /// /// PubSub 알림 중복 처리 방지용 마커. /// 처음 호출 시 true, 이미 처리된 videoId면 false 반환. /// Task TryMarkProcessedAsync(string videoId, CancellationToken ct); /// /// 채널의 마지막으로 처리된 videoId 조회 (Feed 폴링 중복 감지용). /// Task GetLastProcessedVideoIdAsync(string youtubeChannelID, CancellationToken ct); /// /// 채널의 마지막 처리 videoId 저장 (PubSub/Feed 어느 경로든 처리 후 호출). /// Task SetLastProcessedVideoIdAsync(string youtubeChannelID, string videoId, CancellationToken ct); /// /// 채널별 마지막 Feed 폴링 시각 저장 (신규 비디오 감지 여부와 무관, 매 폴링 시 호출). /// Task SetLastPolledAtAsync(string youtubeChannelID, DateTime utcNow, CancellationToken ct); /// /// 모든 채널의 마지막 Feed 폴링 시각 일괄 조회 (관리자 대시보드용). /// Task> GetAllLastPolledAtAsync(CancellationToken ct); /// /// 모든 채널의 마지막 처리 videoId 일괄 조회 (관리자 대시보드용). /// Task> GetAllLastProcessedVideoIdsAsync(CancellationToken ct); /// /// 채널의 PubSub lease 만료 예정 시각 저장 (구독 verify 시 lease_seconds 기반). /// Task SetLeaseExpiryAsync(string youtubeChannelID, DateTime expiresAtUtc, CancellationToken ct); /// /// 모든 채널의 PubSub lease 만료 예정 시각 일괄 조회 (관리자 대시보드용). /// Task> GetAllLeaseExpiriesAsync(CancellationToken ct); }