LANCommander/LANCommander.Server.Services/Providers/Metadata/IMetadataProvider.cs
Pat Hartl 45aaa0ea8d Simplify game addition w/ metadata lookup
Adding a game now immediately provides a dialog to lookup a game through metadata providers. Selecting a result will create the game with the populated metadata. An additional option of automatically downloading art (icon, cover, background, logo) is also provided, though may be inaccurate and completely up to the results of the provider.
2026-06-01 02:15:53 -05:00

19 lines
No EOL
907 B
C#

using LANCommander.SDK.Models.Manifest;
namespace LANCommander.Server.Services.Providers.Metadata;
public interface IMetadataProvider
{
public string ProviderName { get; }
bool IsAvailable => true;
public Task<MetadataSearchResultsCollection<Game>?> SearchGamesAsync(string input, int limit = 10, int offset = 0);
public Task<Game?> GetGameAsync(string gameId);
Task<IEnumerable<(string Slug, string Name)>?> GetSubProvidersAsync() => Task.FromResult<IEnumerable<(string Slug, string Name)>?>(null);
Task<MetadataSearchResultsCollection<Game>?> SearchGamesAsync(string input, string? subProvider, int limit = 10, int offset = 0)
=> SearchGamesAsync(input, limit, offset);
}
public record MetadataSearchResult<T>(string Id, T Data);
public record MetadataSearchResultsCollection<T>(ICollection<MetadataSearchResult<T>> Results, bool More, int Limit = 10, int Offset = 0);