using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Kavita.Common; using Kavita.Models.DTOs.Collection; using Kavita.Models.DTOs.KavitaPlus.Metadata; using Kavita.Models.DTOs.Metadata.Matching; using Kavita.Models.DTOs.SeriesDetail; using Kavita.Models.Entities.Enums; namespace Kavita.API.Services.Plus; public interface IExternalMetadataService { public static readonly HashSet NonEligibleLibraryTypes = [LibraryType.Comic, LibraryType.Book, LibraryType.Image]; /// /// Retrieves Metadata about a Recommended External Series /// /// /// /// /// /// /// Task GetExternalSeriesDetail(int? aniListId, long? malId, int? seriesId, CancellationToken ct = default); /// /// Returns Series Detail data from Kavita+ - Review, Recs, Ratings /// /// /// /// /// Task GetSeriesDetailPlus(int seriesId, LibraryType libraryType, CancellationToken ct = default); /// /// This is a task that runs on a schedule and slowly fetches data from Kavita+ to keep /// data in the DB non-stale and fetched. /// /// To avoid blasting Kavita+ API, this only processes 25 records. The goal is to slowly build out/refresh the data /// Task FetchExternalDataTask(CancellationToken ct = default); /// /// This is an entry point and provides a level of protection against calling upstream API. Will only allow 100 new /// series to fetch data within a day and enqueues background jobs at certain times to fetch that data. /// /// /// /// /// If the fetch was made Task FetchSeriesMetadata(int seriesId, LibraryType libraryType, CancellationToken ct = default); Task> GetStacksForUser(int userId, CancellationToken ct = default); /// /// Returns the match results for a Series from UI Flow /// /// /// Will extract alternative names like Localized name, year will send as ReleaseYear but fallback to Comic Vine syntax if applicable /// /// /// /// Task> MatchSeries(MatchSeriesDto dto, CancellationToken ct = default); /// /// This will override any sort of matching that was done prior and force it to be what the user Selected /// /// /// /// /// /// Task FixSeriesMatch(int seriesId, int? aniListId, long? malId, int? cbrId, CancellationToken ct = default); /// /// Sets a series to Don't Match and removes all previously cached /// /// /// /// Task UpdateSeriesDontMatch(int seriesId, bool dontMatch, CancellationToken ct = default); /// /// Given external metadata from Kavita+, write as much as possible to the Kavita series as possible /// /// /// /// /// Task WriteExternalMetadataToSeries(ExternalSeriesDetailDto externalMetadata, int seriesId, CancellationToken ct = default); }