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.
23 lines
635 B
23 lines
635 B
using Recyclarr.TrashLib.Config.Services;
|
|
using Recyclarr.TrashLib.Services.System;
|
|
|
|
namespace Recyclarr.TrashLib.Services.Common;
|
|
|
|
public abstract class ServiceCapabilityChecker<T> where T : class
|
|
{
|
|
private readonly IServiceInformation _info;
|
|
|
|
protected ServiceCapabilityChecker(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);
|
|
}
|