mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-03-05 13:20:20 -05:00
Add v5 Metadata endpoints
This commit is contained in:
12
src/Sonarr.Api.V5/Metadata/MetadataBulkResource.cs
Normal file
12
src/Sonarr.Api.V5/Metadata/MetadataBulkResource.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using NzbDrone.Core.Extras.Metadata;
|
||||
using Sonarr.Api.V5.Provider;
|
||||
|
||||
namespace Sonarr.Api.V5.Metadata;
|
||||
|
||||
public class MetadataBulkResource : ProviderBulkResource<MetadataBulkResource>
|
||||
{
|
||||
}
|
||||
|
||||
public class MetadataBulkResourceMapper : ProviderBulkResourceMapper<MetadataBulkResource, MetadataDefinition>
|
||||
{
|
||||
}
|
||||
31
src/Sonarr.Api.V5/Metadata/MetadataController.cs
Normal file
31
src/Sonarr.Api.V5/Metadata/MetadataController.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NzbDrone.Core.Extras.Metadata;
|
||||
using NzbDrone.SignalR;
|
||||
using Sonarr.Api.V5.Provider;
|
||||
using Sonarr.Http;
|
||||
|
||||
namespace Sonarr.Api.V5.Metadata;
|
||||
|
||||
[V5ApiController]
|
||||
public class MetadataController : ProviderControllerBase<MetadataResource, MetadataBulkResource, IMetadata, MetadataDefinition>
|
||||
{
|
||||
public static readonly MetadataResourceMapper ResourceMapper = new();
|
||||
public static readonly MetadataBulkResourceMapper BulkResourceMapper = new();
|
||||
|
||||
public MetadataController(IBroadcastSignalRMessage signalRBroadcaster, IMetadataFactory metadataFactory)
|
||||
: base(signalRBroadcaster, metadataFactory, "metadata", ResourceMapper, BulkResourceMapper)
|
||||
{
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public override ActionResult<MetadataResource> UpdateProvider([FromBody] MetadataBulkResource providerResource)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public override ActionResult DeleteProviders([FromBody] MetadataBulkResource resource)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
30
src/Sonarr.Api.V5/Metadata/MetadataResource.cs
Normal file
30
src/Sonarr.Api.V5/Metadata/MetadataResource.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using NzbDrone.Core.Extras.Metadata;
|
||||
using Sonarr.Api.V5.Provider;
|
||||
|
||||
namespace Sonarr.Api.V5.Metadata;
|
||||
|
||||
public class MetadataResource : ProviderResource<MetadataResource>
|
||||
{
|
||||
public bool Enable { get; set; }
|
||||
}
|
||||
|
||||
public class MetadataResourceMapper : ProviderResourceMapper<MetadataResource, MetadataDefinition>
|
||||
{
|
||||
public override MetadataResource ToResource(MetadataDefinition definition)
|
||||
{
|
||||
var resource = base.ToResource(definition);
|
||||
|
||||
resource.Enable = definition.Enable;
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
public override MetadataDefinition ToModel(MetadataResource resource, MetadataDefinition? existingDefinition)
|
||||
{
|
||||
var definition = base.ToModel(resource, existingDefinition);
|
||||
|
||||
definition.Enable = resource.Enable;
|
||||
|
||||
return definition;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user