1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/NzbDrone.Api/Indexers/IndexerModule.cs

36 lines
1004 B
C#
Raw Normal View History

using System.Collections.Generic;
2013-05-01 09:43:14 +03:00
using NzbDrone.Api.ClientSchema;
using NzbDrone.Core.Indexers;
2013-05-01 09:43:14 +03:00
using Omu.ValueInjecter;
namespace NzbDrone.Api.Indexers
{
public class IndexerModule : NzbDroneRestModule<IndexerResource>
{
private readonly IIndexerService _indexerService;
public IndexerModule(IIndexerService indexerService)
{
_indexerService = indexerService;
GetResourceAll = GetAll;
}
private List<IndexerResource> GetAll()
{
2013-05-01 09:43:14 +03:00
var indexers = _indexerService.All();
var result = new List<IndexerResource>(indexers.Count);
2013-05-03 08:24:52 +03:00
foreach (var indexer in indexers)
2013-05-01 09:43:14 +03:00
{
2013-05-03 08:24:52 +03:00
var indexerResource = new IndexerResource();
indexerResource.InjectFrom(indexer);
indexerResource.Fields = SchemaBuilder.GenerateSchema(indexer.Settings);
result.Add(indexerResource);
2013-05-01 09:43:14 +03:00
}
return result;
}
}
}