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.
37 lines
1.3 KiB
37 lines
1.3 KiB
7 years ago
|
using NzbDrone.Core.Blacklisting;
|
||
7 years ago
|
using NzbDrone.Core.Datastore;
|
||
|
using Lidarr.Http;
|
||
|
|
||
7 years ago
|
namespace Lidarr.Api.V1.Blacklist
|
||
7 years ago
|
{
|
||
|
public class BlacklistModule : LidarrRestModule<BlacklistResource>
|
||
|
{
|
||
|
private readonly IBlacklistService _blacklistService;
|
||
|
|
||
|
public BlacklistModule(IBlacklistService blacklistService)
|
||
|
{
|
||
|
_blacklistService = blacklistService;
|
||
|
GetResourcePaged = GetBlacklist;
|
||
|
DeleteResource = DeleteBlacklist;
|
||
|
}
|
||
|
|
||
|
private PagingResource<BlacklistResource> GetBlacklist(PagingResource<BlacklistResource> pagingResource)
|
||
|
{
|
||
|
var pagingSpec = new PagingSpec<NzbDrone.Core.Blacklisting.Blacklist>
|
||
|
{
|
||
|
Page = pagingResource.Page,
|
||
|
PageSize = pagingResource.PageSize,
|
||
|
SortKey = pagingResource.SortKey,
|
||
|
SortDirection = pagingResource.SortDirection
|
||
|
};
|
||
|
|
||
|
return ApplyToPage(_blacklistService.Paged, pagingSpec, BlacklistResourceMapper.MapToResource);
|
||
|
}
|
||
|
|
||
|
private void DeleteBlacklist(int id)
|
||
|
{
|
||
|
_blacklistService.Delete(id);
|
||
|
}
|
||
|
}
|
||
7 years ago
|
}
|