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.
31 lines
982 B
31 lines
982 B
using NzbDrone.Core.Blocklisting;
|
|
using NzbDrone.Core.Datastore;
|
|
using Sonarr.Http;
|
|
|
|
namespace NzbDrone.Api.Blocklist
|
|
{
|
|
public class BlocklistModule : SonarrRestModule<BlocklistResource>
|
|
{
|
|
private readonly BlocklistService _blocklistService;
|
|
|
|
public BlocklistModule(BlocklistService blocklistService)
|
|
{
|
|
_blocklistService = blocklistService;
|
|
GetResourcePaged = Blocklist;
|
|
DeleteResource = DeleteBlockList;
|
|
}
|
|
|
|
private PagingResource<BlocklistResource> Blocklist(PagingResource<BlocklistResource> pagingResource)
|
|
{
|
|
var pagingSpec = pagingResource.MapToPagingSpec<BlocklistResource, Core.Blocklisting.Blocklist>("id", SortDirection.Ascending);
|
|
|
|
return ApplyToPage(_blocklistService.Paged, pagingSpec, BlocklistResourceMapper.MapToResource);
|
|
}
|
|
|
|
private void DeleteBlockList(int id)
|
|
{
|
|
_blocklistService.Delete(id);
|
|
}
|
|
}
|
|
}
|