You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
recyclarr/src/Recyclarr.TrashLib/Compatibility/ServiceCapabilityFetcher.cs

23 lines
636 B

using Recyclarr.TrashLib.ApiServices.System;
using Recyclarr.TrashLib.Config.Services;
namespace Recyclarr.TrashLib.Compatibility;
public abstract class ServiceCapabilityFetcher<T> where T : class
{
private readonly IServiceInformation _info;
protected ServiceCapabilityFetcher(IServiceInformation info)
{
_info = info;
}
public async Task<T?> GetCapabilities(IServiceConfiguration config)
{
var version = await _info.GetVersion(config);
return version is not null ? BuildCapabilitiesObject(version) : null;
}
protected abstract T BuildCapabilitiesObject(Version version);
}