mirror of https://github.com/lidarr/Lidarr
39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using NzbDrone.Common.Http;
|
|||
|
using NzbDrone.Core.HealthCheck;
|
|||
|
using Lidarr.Http.REST;
|
|||
|
|
|||
|
namespace Lidarr.Api.V3.Health
|
|||
|
{
|
|||
|
public class HealthResource : RestResource
|
|||
|
{
|
|||
|
public string Source { get; set; }
|
|||
|
public HealthCheckResult Type { get; set; }
|
|||
|
public string Message { get; set; }
|
|||
|
public HttpUri WikiUrl { get; set; }
|
|||
|
}
|
|||
|
|
|||
|
public static class HealthResourceMapper
|
|||
|
{
|
|||
|
public static HealthResource ToResource(this HealthCheck model)
|
|||
|
{
|
|||
|
if (model == null) return null;
|
|||
|
|
|||
|
return new HealthResource
|
|||
|
{
|
|||
|
Id = model.Id,
|
|||
|
Source = model.Source.Name,
|
|||
|
Type = model.Type,
|
|||
|
Message = model.Message,
|
|||
|
WikiUrl = model.WikiUrl
|
|||
|
};
|
|||
|
}
|
|||
|
|
|||
|
public static List<HealthResource> ToResource(this IEnumerable<HealthCheck> models)
|
|||
|
{
|
|||
|
return models.Select(ToResource).ToList();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|