parent
3db78079f3
commit
178525d8d7
@ -0,0 +1,23 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using NzbDrone.Core.Movies;
|
||||||
|
using Radarr.Http;
|
||||||
|
|
||||||
|
namespace Radarr.Api.V3.Movies
|
||||||
|
{
|
||||||
|
[V3ApiController("missing")]
|
||||||
|
public class MissingController : Controller
|
||||||
|
{
|
||||||
|
private readonly IMovieService _movieService;
|
||||||
|
|
||||||
|
public MissingController(IMovieService movieService)
|
||||||
|
{
|
||||||
|
_movieService = movieService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public MissingWantedResource GetMissing()
|
||||||
|
{
|
||||||
|
return _movieService.GetMissingMovies().ToResource();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using NzbDrone.Core.Movies;
|
||||||
|
using Radarr.Http.REST;
|
||||||
|
|
||||||
|
namespace Radarr.Api.V3.Movies
|
||||||
|
{
|
||||||
|
public class MissingWantedResource : RestResource
|
||||||
|
{
|
||||||
|
public int Total { get; set; }
|
||||||
|
public List<MovieResource> Movies { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class MissingResourceMapper
|
||||||
|
{
|
||||||
|
public static MissingWantedResource ToResource(this List<Movie> model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new MissingWantedResource
|
||||||
|
{
|
||||||
|
Total = model.Count,
|
||||||
|
Movies = model.ToResource(0)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using NzbDrone.Core.Movies;
|
||||||
|
using Radarr.Http;
|
||||||
|
|
||||||
|
namespace Radarr.Api.V3.Movies
|
||||||
|
{
|
||||||
|
[V3ApiController("wanted")]
|
||||||
|
public class WantedController : Controller
|
||||||
|
{
|
||||||
|
private readonly IMovieService _movieService;
|
||||||
|
|
||||||
|
public WantedController(IMovieService movieService)
|
||||||
|
{
|
||||||
|
_movieService = movieService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public MissingWantedResource GetWanted()
|
||||||
|
{
|
||||||
|
return _movieService.GetWantedMovies().ToResource();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue