2017-09-04 02:20:56 +00:00
|
|
|
|
using NzbDrone.Core.Download;
|
|
|
|
|
using NzbDrone.Core.Indexers;
|
|
|
|
|
|
2017-10-31 01:28:29 +00:00
|
|
|
|
namespace Lidarr.Api.V1.DownloadClient
|
2017-09-04 02:20:56 +00:00
|
|
|
|
{
|
|
|
|
|
public class DownloadClientResource : ProviderResource
|
|
|
|
|
{
|
|
|
|
|
public bool Enable { get; set; }
|
|
|
|
|
public DownloadProtocol Protocol { get; set; }
|
2019-05-29 23:42:34 +00:00
|
|
|
|
public int Priority { get; set; }
|
2017-09-04 02:20:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class DownloadClientResourceMapper : ProviderResourceMapper<DownloadClientResource, DownloadClientDefinition>
|
|
|
|
|
{
|
|
|
|
|
public override DownloadClientResource ToResource(DownloadClientDefinition definition)
|
|
|
|
|
{
|
2020-01-03 12:49:24 +00:00
|
|
|
|
if (definition == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2017-09-04 02:20:56 +00:00
|
|
|
|
|
|
|
|
|
var resource = base.ToResource(definition);
|
|
|
|
|
|
|
|
|
|
resource.Enable = definition.Enable;
|
|
|
|
|
resource.Protocol = definition.Protocol;
|
2019-05-29 23:42:34 +00:00
|
|
|
|
resource.Priority = definition.Priority;
|
2017-09-04 02:20:56 +00:00
|
|
|
|
|
|
|
|
|
return resource;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override DownloadClientDefinition ToModel(DownloadClientResource resource)
|
|
|
|
|
{
|
2020-01-03 12:49:24 +00:00
|
|
|
|
if (resource == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2017-09-04 02:20:56 +00:00
|
|
|
|
|
|
|
|
|
var definition = base.ToModel(resource);
|
|
|
|
|
|
|
|
|
|
definition.Enable = resource.Enable;
|
|
|
|
|
definition.Protocol = resource.Protocol;
|
2019-05-29 23:42:34 +00:00
|
|
|
|
definition.Priority = resource.Priority;
|
2017-09-04 02:20:56 +00:00
|
|
|
|
|
|
|
|
|
return definition;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-01-03 12:49:24 +00:00
|
|
|
|
}
|