using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Kavita.Common.Helpers; using Kavita.Models.DTOs.Scrobbling; using Kavita.Models.Entities.Scrobble; namespace Kavita.API.Repositories; public interface IScrobbleRepository { void Attach(ScrobbleEvent evt); void Attach(ScrobbleError error); void Remove(ScrobbleEvent evt); void Remove(IEnumerable events); void Remove(IEnumerable errors); void Update(ScrobbleEvent evt); Task> GetByEvent(ScrobbleEventType type, bool isProcessed = false, CancellationToken ct = default); Task> GetProcessedEvents(int daysAgo, CancellationToken ct = default); Task Exists(int userId, int seriesId, ScrobbleEventType eventType, CancellationToken ct = default); Task> GetScrobbleErrors(CancellationToken ct = default); Task> GetAllScrobbleErrorsForSeries(int seriesId, CancellationToken ct = default); Task ClearScrobbleErrors(CancellationToken ct = default); Task HasErrorForSeries(int seriesId, CancellationToken ct = default); /// /// Get all events for a specific user and type /// /// /// /// /// If true, only returned not processed events /// /// Task GetEvent(int userId, int seriesId, ScrobbleEventType eventType, bool isNotProcessed = false, CancellationToken ct = default); Task> GetUserEventsForSeries(int userId, int seriesId, CancellationToken ct = default); /// /// Return the events with given ids, when belonging to the passed user /// /// /// /// /// Task> GetUserEvents(int userId, IList scrobbleEventIds, CancellationToken ct = default); Task> GetUserEvents(int userId, ScrobbleEventFilter filter, UserParams pagination, CancellationToken ct = default); Task> GetAllEventsForSeries(int seriesId, CancellationToken ct = default); Task> GetAllEventsWithSeriesIds(IEnumerable seriesIds, CancellationToken ct = default); Task> GetEvents(CancellationToken ct = default); }