mirror of
https://github.com/Radarr/Radarr
synced 2025-02-24 07:10:57 +00:00
New: (API) Get Collection by TmdbId
This commit is contained in:
parent
dca00db317
commit
66c1af0555
1 changed files with 18 additions and 2 deletions
|
@ -53,9 +53,25 @@ protected override CollectionResource GetResourceById(int id)
|
|||
}
|
||||
|
||||
[HttpGet]
|
||||
public List<CollectionResource> GetCollections()
|
||||
public List<CollectionResource> GetCollections(int? tmdbId)
|
||||
{
|
||||
return MapToResource(_collectionService.GetAllCollections()).ToList();
|
||||
var collectionResources = new List<CollectionResource>();
|
||||
|
||||
if (tmdbId.HasValue)
|
||||
{
|
||||
var collection = _collectionService.FindByTmdbId(tmdbId.Value);
|
||||
|
||||
if (collection != null)
|
||||
{
|
||||
collectionResources.AddIfNotNull(MapToResource(collection));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
collectionResources = MapToResource(_collectionService.GetAllCollections()).ToList();
|
||||
}
|
||||
|
||||
return collectionResources;
|
||||
}
|
||||
|
||||
[RestPutById]
|
||||
|
|
Loading…
Reference in a new issue