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
636 B
23 lines
636 B
1 year ago
|
using Recyclarr.TrashLib.ApiServices.System;
|
||
1 year ago
|
using Recyclarr.TrashLib.Config.Services;
|
||
1 year ago
|
|
||
1 year ago
|
namespace Recyclarr.TrashLib.Compatibility;
|
||
1 year ago
|
|
||
11 months ago
|
public abstract class ServiceCapabilityFetcher<T> where T : class
|
||
1 year ago
|
{
|
||
1 year ago
|
private readonly IServiceInformation _info;
|
||
1 year ago
|
|
||
11 months ago
|
protected ServiceCapabilityFetcher(IServiceInformation info)
|
||
1 year ago
|
{
|
||
1 year ago
|
_info = info;
|
||
1 year ago
|
}
|
||
1 year ago
|
|
||
1 year ago
|
public async Task<T?> GetCapabilities(IServiceConfiguration config)
|
||
1 year ago
|
{
|
||
1 year ago
|
var version = await _info.GetVersion(config);
|
||
|
return version is not null ? BuildCapabilitiesObject(version) : null;
|
||
1 year ago
|
}
|
||
|
|
||
|
protected abstract T BuildCapabilitiesObject(Version version);
|
||
|
}
|