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.
45 lines
1.5 KiB
45 lines
1.5 KiB
7 years ago
|
using System.Collections.Generic;
|
||
7 years ago
|
using System.Linq;
|
||
|
using NzbDrone.Core.Tags;
|
||
7 years ago
|
using Lidarr.Api.V1.Notifications;
|
||
|
using Lidarr.Api.V1.Profiles.Delay;
|
||
|
using Lidarr.Api.V1.Restrictions;
|
||
7 years ago
|
using Lidarr.Http.REST;
|
||
|
|
||
7 years ago
|
namespace Lidarr.Api.V1.Tags
|
||
7 years ago
|
{
|
||
|
public class TagDetailsResource : RestResource
|
||
|
{
|
||
|
public string Label { get; set; }
|
||
|
public List<DelayProfileResource> DelayProfiles { get; set; }
|
||
|
public List<NotificationResource> Notifications { get; set; }
|
||
|
public List<RestrictionResource> Restrictions { get; set; }
|
||
7 years ago
|
public List<int> ArtistIds { get; set; }
|
||
7 years ago
|
}
|
||
|
|
||
|
public static class TagDetailsResourceMapper
|
||
|
{
|
||
|
private static readonly NotificationResourceMapper NotificationResourceMapper = new NotificationResourceMapper();
|
||
|
|
||
|
public static TagDetailsResource ToResource(this TagDetails model)
|
||
|
{
|
||
|
if (model == null) return null;
|
||
|
|
||
|
return new TagDetailsResource
|
||
|
{
|
||
|
Id = model.Id,
|
||
|
Label = model.Label,
|
||
|
DelayProfiles = model.DelayProfiles.ToResource(),
|
||
|
Notifications = model.Notifications.Select(NotificationResourceMapper.ToResource).ToList(),
|
||
|
Restrictions = model.Restrictions.ToResource(),
|
||
7 years ago
|
ArtistIds = model.Artist.Select(s => s.Id).ToList()
|
||
7 years ago
|
};
|
||
|
}
|
||
|
|
||
|
public static List<TagDetailsResource> ToResource(this IEnumerable<TagDetails> models)
|
||
|
{
|
||
|
return models.Select(ToResource).ToList();
|
||
|
}
|
||
|
}
|
||
|
}
|