Refactors metadata provider contracts to typed interfaces

This commit is contained in:
BinaryAlley committed 2026-08-24 14:17:29 -07:00
1 parent c82fadc7a2
commit 04927a95af
14 files changed
+274 -117

No files matched your search

@@ -9,9 +9,9 @@ using System.Threading.Tasks;
namespace Lumina.Plugins.Contracts.Core.Metadata;
/// <summary>
/// Contract for a plugin that provides metadata for media items from a remote source.
/// Contract for a plugin that provides metadata for media items.
/// </summary>
public interface IRemoteMetadataProvider
public interface IMetadataProvider
{
/// <summary>
/// Gets the display name of the metadata provider.
@@ -19,9 +19,9 @@ public interface IRemoteMetadataProvider
string Name { get; }
/// <summary>
/// Gets the media library type this metadata provider supports.
/// Gets the media library types this metadata provider supports.
/// </summary>
LibraryType SupportedLibraryType { get; }
IReadOnlyList<LibraryType> SupportedLibraryTypes { get; }
/// <summary>
/// Gets a value indicating whether this metadata provider requires access to the web to retrieve metadata.
@@ -29,18 +29,18 @@ public interface IRemoteMetadataProvider
bool RequiresWebAccess { get; }
/// <summary>
/// Searches for the metadata of the media item described by <paramref name="lookup"/>.
/// Searches for the metadata of the media item described by <paramref name="metadataLookup"/>.
/// </summary>
/// <param name="lookup">The lookup describing the media item to search for.</param>
/// <param name="metadataLookup">The lookup describing the media item to search for.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>The collection of metadata candidates found for the media item.</returns>
Task<IReadOnlyList<MetadataDto>> GetSearchResultsAsync(MetadataLookupDto lookup, CancellationToken cancellationToken);
Task<IReadOnlyList<MetadataDto>> GetSearchResultsAsync(MetadataLookupDto metadataLookup, CancellationToken cancellationToken);
/// <summary>
/// Gets the metadata of the media item described by <paramref name="lookup"/>.
/// Gets the metadata of the media item described by <paramref name="metadataLookup"/>.
/// </summary>
/// <param name="lookup">The lookup describing the media item to get the metadata for.</param>
/// <param name="metadataLookup">The lookup describing the media item to get the metadata for.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>The metadata of the media item, or <see langword="null"/> when no metadata was found.</returns>
Task<MetadataDto?> GetMetadataAsync(MetadataLookupDto lookup, CancellationToken cancellationToken);
Task<MetadataDto?> GetMetadataAsync(MetadataLookupDto metadataLookup, CancellationToken cancellationToken);
}
@@ -8,11 +8,11 @@ using System.Threading.Tasks;
namespace Lumina.Plugins.Contracts.Core.Metadata;
/// <summary>
/// Contract for a plugin that provides metadata for media items from a remote source, typed to the media item lookup and metadata types.
/// Contract for a plugin that provides metadata for media items, typed to the media item lookup and metadata types.
/// </summary>
/// <typeparam name="TLookup">The type of the lookup describing the media item.</typeparam>
/// <typeparam name="TMetadata">The type of the metadata of the media item.</typeparam>
public interface IRemoteMetadataProvider<TLookup, TMetadata> : IRemoteMetadataProvider
public interface IMetadataProvider<TLookup, TMetadata> : IMetadataProvider
where TLookup : MetadataLookupDto
where TMetadata : MetadataDto
{
@@ -38,7 +38,7 @@ public interface IRemoteMetadataProvider<TLookup, TMetadata> : IRemoteMetadataPr
/// <param name="lookup">The lookup describing the media item to search for.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>The collection of metadata candidates found for the media item.</returns>
async Task<IReadOnlyList<MetadataDto>> IRemoteMetadataProvider.GetSearchResultsAsync(MetadataLookupDto lookup, CancellationToken cancellationToken)
async Task<IReadOnlyList<MetadataDto>> IMetadataProvider.GetSearchResultsAsync(MetadataLookupDto lookup, CancellationToken cancellationToken)
{
return await GetSearchResultsAsync((TLookup)lookup, cancellationToken).ConfigureAwait(false);
}
@@ -49,7 +49,7 @@ public interface IRemoteMetadataProvider<TLookup, TMetadata> : IRemoteMetadataPr
/// <param name="lookup">The lookup describing the media item to get the metadata for.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>The metadata of the media item, or <see langword="null"/> when no metadata was found.</returns>
async Task<MetadataDto?> IRemoteMetadataProvider.GetMetadataAsync(MetadataLookupDto lookup, CancellationToken cancellationToken)
async Task<MetadataDto?> IMetadataProvider.GetMetadataAsync(MetadataLookupDto lookup, CancellationToken cancellationToken)
{
return await GetMetadataAsync((TLookup)lookup, cancellationToken).ConfigureAwait(false);
}