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.
53 lines
1.7 KiB
53 lines
1.7 KiB
7 years ago
|
using NzbDrone.Core.Indexers;
|
||
7 years ago
|
|
||
5 years ago
|
namespace Readarr.Api.V1.Indexers
|
||
7 years ago
|
{
|
||
|
public class IndexerResource : ProviderResource
|
||
|
{
|
||
|
public bool EnableRss { get; set; }
|
||
7 years ago
|
public bool EnableAutomaticSearch { get; set; }
|
||
|
public bool EnableInteractiveSearch { get; set; }
|
||
7 years ago
|
public bool SupportsRss { get; set; }
|
||
|
public bool SupportsSearch { get; set; }
|
||
|
public DownloadProtocol Protocol { get; set; }
|
||
|
}
|
||
|
|
||
|
public class IndexerResourceMapper : ProviderResourceMapper<IndexerResource, IndexerDefinition>
|
||
|
{
|
||
|
public override IndexerResource ToResource(IndexerDefinition definition)
|
||
|
{
|
||
5 years ago
|
if (definition == null)
|
||
|
{
|
||
|
return null;
|
||
|
}
|
||
7 years ago
|
|
||
|
var resource = base.ToResource(definition);
|
||
|
|
||
|
resource.EnableRss = definition.EnableRss;
|
||
7 years ago
|
resource.EnableAutomaticSearch = definition.EnableAutomaticSearch;
|
||
|
resource.EnableInteractiveSearch = definition.EnableInteractiveSearch;
|
||
7 years ago
|
resource.SupportsRss = definition.SupportsRss;
|
||
|
resource.SupportsSearch = definition.SupportsSearch;
|
||
|
resource.Protocol = definition.Protocol;
|
||
|
|
||
|
return resource;
|
||
|
}
|
||
|
|
||
|
public override IndexerDefinition ToModel(IndexerResource resource)
|
||
|
{
|
||
5 years ago
|
if (resource == null)
|
||
|
{
|
||
|
return null;
|
||
|
}
|
||
7 years ago
|
|
||
|
var definition = base.ToModel(resource);
|
||
|
|
||
|
definition.EnableRss = resource.EnableRss;
|
||
7 years ago
|
definition.EnableAutomaticSearch = resource.EnableAutomaticSearch;
|
||
|
definition.EnableInteractiveSearch = resource.EnableInteractiveSearch;
|
||
7 years ago
|
|
||
|
return definition;
|
||
|
}
|
||
|
}
|
||
7 years ago
|
}
|