mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-23 22:25:56 -04:00
v3 API
This commit is contained in:
committed by
Taloth Saldono
parent
211f3769e1
commit
7297c1b8e4
@@ -0,0 +1,43 @@
|
||||
using NzbDrone.Core.Indexers;
|
||||
|
||||
namespace Sonarr.Api.V3.Indexers
|
||||
{
|
||||
public class IndexerResource : ProviderResource
|
||||
{
|
||||
public bool EnableRss { get; set; }
|
||||
public bool EnableSearch { get; set; }
|
||||
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)
|
||||
{
|
||||
if (definition == null) return null;
|
||||
|
||||
var resource = base.ToResource(definition);
|
||||
|
||||
resource.EnableRss = definition.EnableRss;
|
||||
resource.EnableSearch = definition.EnableSearch;
|
||||
resource.SupportsRss = definition.SupportsRss;
|
||||
resource.SupportsSearch = definition.SupportsSearch;
|
||||
resource.Protocol = definition.Protocol;
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
public override IndexerDefinition ToModel(IndexerResource resource)
|
||||
{
|
||||
if (resource == null) return null;
|
||||
|
||||
var definition = base.ToModel(resource);
|
||||
|
||||
definition.EnableRss = resource.EnableRss;
|
||||
definition.EnableSearch = resource.EnableSearch;
|
||||
|
||||
return definition;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user