1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-19 21:46:43 -04:00
Files
Sonarr/src/Sonarr.Api.V3/Indexers/IndexerResource.cs
T
Qiming Chen 13aaa20f1b New: Link indexer to specific download client
Closes #1215
Co-authored-by: Qstick <qstick@gmail.com>
2022-01-23 12:58:23 -08:00

53 lines
1.9 KiB
C#

using NzbDrone.Core.Indexers;
namespace Sonarr.Api.V3.Indexers
{
public class IndexerResource : ProviderResource
{
public bool EnableRss { get; set; }
public bool EnableAutomaticSearch { get; set; }
public bool EnableInteractiveSearch { get; set; }
public bool SupportsRss { get; set; }
public bool SupportsSearch { get; set; }
public DownloadProtocol Protocol { get; set; }
public int Priority { get; set; }
public int DownloadClientId { get; set; }
}
public class IndexerResourceMapper : ProviderResourceMapper<IndexerResource, IndexerDefinition>
{
public override IndexerResource ToResource(IndexerDefinition definition)
{
if (definition == null) return null;
var resource = base.ToResource(definition);
resource.EnableRss = definition.EnableRss;
resource.EnableAutomaticSearch = definition.EnableAutomaticSearch;
resource.EnableInteractiveSearch = definition.EnableInteractiveSearch;
resource.SupportsRss = definition.SupportsRss;
resource.SupportsSearch = definition.SupportsSearch;
resource.Protocol = definition.Protocol;
resource.Priority = definition.Priority;
resource.DownloadClientId = definition.DownloadClientId;
return resource;
}
public override IndexerDefinition ToModel(IndexerResource resource)
{
if (resource == null) return null;
var definition = base.ToModel(resource);
definition.EnableRss = resource.EnableRss;
definition.EnableAutomaticSearch = resource.EnableAutomaticSearch;
definition.EnableInteractiveSearch = resource.EnableInteractiveSearch;
definition.Priority = resource.Priority;
definition.DownloadClientId = resource.DownloadClientId;
return definition;
}
}
}