1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-29 03:15:19 +00:00
Radarr/NzbDrone.Api/Update/UpdateModule.cs

46 lines
1.3 KiB
C#
Raw Normal View History

2013-05-20 00:30:02 +00:00
using System;
using System.Collections.Generic;
2013-08-24 02:42:45 +00:00
using Newtonsoft.Json;
2013-05-20 00:30:02 +00:00
using NzbDrone.Api.REST;
using NzbDrone.Core.Update;
using NzbDrone.Api.Mapping;
namespace NzbDrone.Api.Update
{
public class UpdateModule : NzbDroneRestModule<UpdateResource>
{
private readonly ICheckUpdateService _checkUpdateService;
2013-05-20 00:30:02 +00:00
public UpdateModule(ICheckUpdateService checkUpdateService)
2013-05-20 00:30:02 +00:00
{
_checkUpdateService = checkUpdateService;
2013-05-20 00:30:02 +00:00
GetResourceAll = GetAvailableUpdate;
}
private List<UpdateResource> GetAvailableUpdate()
{
var update = _checkUpdateService.AvailableUpdate();
2013-05-20 00:30:02 +00:00
var response = new List<UpdateResource>();
if (update != null)
{
response.Add(update.InjectTo<UpdateResource>());
}
return response;
}
}
public class UpdateResource : RestResource
{
2013-08-24 02:42:45 +00:00
public String Id { get; set; }
[JsonConverter(typeof(Newtonsoft.Json.Converters.VersionConverter))]
2013-05-20 00:30:02 +00:00
public Version Version { get; set; }
2013-08-24 02:42:45 +00:00
public String Branch { get; set; }
public DateTime ReleaseDate { get; set; }
2013-05-20 00:30:02 +00:00
public String FileName { get; set; }
public String Url { get; set; }
}
}