mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-17 21:25:39 -04:00
API Updates
Fixes #2011 Fixes #1376 Fixes #1379 Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
This commit is contained in:
39
src/Readarr.Http/Ping/PingController.cs
Normal file
39
src/Readarr.Http/Ping/PingController.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
||||
namespace Readarr.Http.Ping
|
||||
{
|
||||
public class PingController : Controller
|
||||
{
|
||||
private readonly IConfigRepository _configRepository;
|
||||
|
||||
public PingController(IConfigRepository configRepository)
|
||||
{
|
||||
_configRepository = configRepository;
|
||||
}
|
||||
|
||||
[HttpGet("/ping")]
|
||||
[Produces("application/json")]
|
||||
public ActionResult<PingResource> GetStatus()
|
||||
{
|
||||
try
|
||||
{
|
||||
_configRepository.All();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, new PingResource
|
||||
{
|
||||
Status = "Error"
|
||||
});
|
||||
}
|
||||
|
||||
return StatusCode(StatusCodes.Status200OK, new PingResource
|
||||
{
|
||||
Status = "OK"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
7
src/Readarr.Http/Ping/PingResource.cs
Normal file
7
src/Readarr.Http/Ping/PingResource.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Readarr.Http.Ping
|
||||
{
|
||||
public class PingResource
|
||||
{
|
||||
public string Status { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user