You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/src/Lidarr.Api.V1/Update/UpdateResource.cs

58 lines
1.6 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using Lidarr.Http.REST;
using Newtonsoft.Json;
using NzbDrone.Core.Update;
namespace Lidarr.Api.V1.Update
{
public class UpdateResource : RestResource
{
[JsonConverter(typeof(Newtonsoft.Json.Converters.VersionConverter))]
public Version Version { get; set; }
public string Branch { get; set; }
public DateTime ReleaseDate { get; set; }
public string FileName { get; set; }
public string Url { get; set; }
public bool Installed { get; set; }
public bool Installable { get; set; }
public bool Latest { get; set; }
public UpdateChanges Changes { get; set; }
public string Hash { get; set; }
}
public static class UpdateResourceMapper
{
public static UpdateResource ToResource(this UpdatePackage model)
{
if (model == null)
{
return null;
}
return new UpdateResource
{
Version = model.Version,
Branch = model.Branch,
ReleaseDate = model.ReleaseDate,
FileName = model.FileName,
Url = model.Url,
//Installed
//Installable
//Latest
Changes = model.Changes,
Hash = model.Hash,
};
}
public static List<UpdateResource> ToResource(this IEnumerable<UpdatePackage> models)
{
return models.Select(ToResource).ToList();
}
}
}