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.
34 lines
849 B
34 lines
849 B
1 year ago
|
using Flurl.Http;
|
||
8 months ago
|
using Recyclarr.Config.Models;
|
||
8 months ago
|
using Recyclarr.ServarrApi.Services;
|
||
8 months ago
|
using Serilog;
|
||
1 year ago
|
|
||
8 months ago
|
namespace Recyclarr.Compatibility;
|
||
1 year ago
|
|
||
|
public class ServiceInformation : IServiceInformation
|
||
|
{
|
||
1 year ago
|
private readonly ISystemApiService _api;
|
||
1 year ago
|
private readonly ILogger _log;
|
||
|
|
||
|
public ServiceInformation(ISystemApiService api, ILogger log)
|
||
|
{
|
||
1 year ago
|
_api = api;
|
||
1 year ago
|
_log = log;
|
||
|
}
|
||
|
|
||
10 months ago
|
public async Task<Version> GetVersion(IServiceConfiguration config)
|
||
1 year ago
|
{
|
||
1 year ago
|
try
|
||
|
{
|
||
|
var status = await _api.GetStatus(config);
|
||
|
_log.Debug("{Service} Version: {Version}", status.AppName, status.Version);
|
||
|
return new Version(status.Version);
|
||
|
}
|
||
10 months ago
|
catch (FlurlHttpException)
|
||
1 year ago
|
{
|
||
10 months ago
|
_log.Error("Unable to obtain service version information");
|
||
|
throw;
|
||
1 year ago
|
}
|
||
1 year ago
|
}
|
||
|
}
|