using System; using System.Collections.Generic; using Lidarr.Http; using Lidarr.Http.REST; using Microsoft.AspNetCore.Mvc; using NzbDrone.Core.Datastore.Events; using NzbDrone.Core.HealthCheck; using NzbDrone.Core.Messaging.Events; using NzbDrone.SignalR; namespace Lidarr.Api.V1.Health { [V1ApiController] public class HealthController : RestControllerWithSignalR, IHandle { private readonly IHealthCheckService _healthCheckService; public HealthController(IBroadcastSignalRMessage signalRBroadcaster, IHealthCheckService healthCheckService) : base(signalRBroadcaster) { _healthCheckService = healthCheckService; } public override HealthResource GetResourceById(int id) { throw new NotImplementedException(); } [HttpGet] [Produces("application/json")] public List GetHealth() { return _healthCheckService.Results().ToResource(); } [NonAction] public void Handle(HealthCheckCompleteEvent message) { BroadcastResourceChange(ModelAction.Sync); } } }