using Cleanuparr.Domain.Entities; using Cleanuparr.Domain.Entities.HealthCheck; using Cleanuparr.Persistence.Models.Configuration; using Cleanuparr.Persistence.Models.Configuration.DownloadCleaner; namespace Cleanuparr.Infrastructure.Features.DownloadClient; public interface IDownloadService : IDisposable { DownloadClientConfig ClientConfig { get; } public Task LoginAsync(); /// /// Performs a health check on the download client /// /// The health check result public Task HealthCheckAsync(); /// /// Checks whether the download should be removed from the *arr queue. /// /// The download hash. /// Downloads to ignore from processing. public Task ShouldRemoveFromArrQueueAsync(string hash, IReadOnlyList ignoredDownloads); /// /// Fetches all seeding downloads. /// /// A list of downloads that are seeding. Task> GetSeedingDownloads(); /// /// Fetches all torrents regardless of their state, without per-torrent tracker or properties calls. /// Used by the orphaned files cleanup to identify which paths are claimed by active torrents. /// /// A list of all torrents. Task> GetAllTorrentsLite(); /// /// Filters downloads that should be cleaned. /// /// The downloads to filter. /// The seeding rules by which to filter the downloads. /// A list of downloads for the provided categories. List? FilterDownloadsToBeCleanedAsync(List? downloads, List seedingRules); /// /// Filters downloads that should have their category changed. /// /// The downloads to filter. /// The unlinked config for this download client. /// A list of downloads for the provided categories. List? FilterDownloadsToChangeCategoryAsync(List? downloads, UnlinkedConfig unlinkedConfig); /// /// Cleans the downloads. /// /// The downloads to clean. /// The seeding rules. Task CleanDownloadsAsync(List? downloads, List seedingRules); /// /// Changes the category for downloads that have no hardlinks. /// /// The downloads to change. /// The unlinked config for this download client. Task ChangeCategoryForNoHardLinksAsync(List? downloads, UnlinkedConfig unlinkedConfig); /// /// Moves a single torrent to the target category, or adds it as a tag/label when is set. /// /// The torrent to move. /// The target category/tag. /// When true, add a tag/label instead of changing the category (qBittorrent and Transmission). Task ChangeTorrentCategoryAsync(ITorrentItemWrapper torrent, string targetCategory, bool useTag); /// /// Deletes a download item. /// /// The torrent item. /// Whether to delete the source files along with the torrent. Defaults to true. public Task DeleteDownload(ITorrentItemWrapper item, bool deleteSourceFiles); /// /// Creates a category. /// /// The category name. public Task CreateCategoryAsync(string name); /// /// Blocks unwanted files from being fully downloaded. /// /// The torrent hash. /// Downloads to ignore from processing. /// True if all files have been blocked; otherwise false. public Task BlockUnwantedFilesAsync(string hash, IReadOnlyList ignoredDownloads); }