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.
48 lines
1.3 KiB
48 lines
1.3 KiB
using NzbDrone.Core.Download;
|
|
using NzbDrone.Core.Indexers;
|
|
|
|
namespace Lidarr.Api.V1.DownloadClient
|
|
{
|
|
public class DownloadClientResource : ProviderResource<DownloadClientResource>
|
|
{
|
|
public bool Enable { get; set; }
|
|
public DownloadProtocol Protocol { get; set; }
|
|
public int Priority { get; set; }
|
|
}
|
|
|
|
public class DownloadClientResourceMapper : ProviderResourceMapper<DownloadClientResource, DownloadClientDefinition>
|
|
{
|
|
public override DownloadClientResource ToResource(DownloadClientDefinition definition)
|
|
{
|
|
if (definition == null)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
var resource = base.ToResource(definition);
|
|
|
|
resource.Enable = definition.Enable;
|
|
resource.Protocol = definition.Protocol;
|
|
resource.Priority = definition.Priority;
|
|
|
|
return resource;
|
|
}
|
|
|
|
public override DownloadClientDefinition ToModel(DownloadClientResource resource)
|
|
{
|
|
if (resource == null)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
var definition = base.ToModel(resource);
|
|
|
|
definition.Enable = resource.Enable;
|
|
definition.Protocol = resource.Protocol;
|
|
definition.Priority = resource.Priority;
|
|
|
|
return definition;
|
|
}
|
|
}
|
|
}
|