Lidarr/src/Lidarr.Api.V1/History/HistoryResource.cs

65 lines
1.7 KiB
C#
Raw Normal View History

2017-09-04 02:20:56 +00:00
using System;
using System.Collections.Generic;
2017-10-31 01:28:29 +00:00
using Lidarr.Api.V1.Albums;
using Lidarr.Api.V1.Artist;
using Lidarr.Api.V1.Tracks;
2017-09-04 02:20:56 +00:00
using Lidarr.Http.REST;
using NzbDrone.Core.History;
using NzbDrone.Core.Qualities;
2017-09-04 02:20:56 +00:00
2017-10-31 01:28:29 +00:00
namespace Lidarr.Api.V1.History
2017-09-04 02:20:56 +00:00
{
public class HistoryResource : RestResource
{
public int AlbumId { get; set; }
public int ArtistId { get; set; }
public int TrackId { get; set; }
2017-09-04 02:20:56 +00:00
public string SourceTitle { get; set; }
public QualityModel Quality { get; set; }
public bool QualityCutoffNotMet { get; set; }
public DateTime Date { get; set; }
public string DownloadId { get; set; }
public EntityHistoryEventType EventType { get; set; }
2017-09-04 02:20:56 +00:00
public Dictionary<string, string> Data { get; set; }
public AlbumResource Album { get; set; }
public ArtistResource Artist { get; set; }
public TrackResource Track { get; set; }
2017-09-04 02:20:56 +00:00
}
public static class HistoryResourceMapper
{
public static HistoryResource ToResource(this EntityHistory model)
2017-09-04 02:20:56 +00:00
{
if (model == null)
{
return null;
}
2017-09-04 02:20:56 +00:00
return new HistoryResource
{
Id = model.Id,
AlbumId = model.AlbumId,
ArtistId = model.ArtistId,
TrackId = model.TrackId,
2017-09-04 02:20:56 +00:00
SourceTitle = model.SourceTitle,
Quality = model.Quality,
// QualityCutoffNotMet
2017-09-04 02:20:56 +00:00
Date = model.Date,
DownloadId = model.DownloadId,
EventType = model.EventType,
Data = model.Data
// Episode
// Series
2017-09-04 02:20:56 +00:00
};
}
}
}