mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-01-25 11:13:39 +02:00
Add 'includeSeries' and 'includeEpisodeFile' to Episode API endpoint
This commit is contained in:
parent
30c36fdc3b
commit
c9aa59340c
@ -25,24 +25,24 @@ namespace Sonarr.Api.V3.Episodes
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<EpisodeResource> GetEpisodes(int? seriesId, int? seasonNumber, [FromQuery]List<int> episodeIds, int? episodeFileId, bool includeImages = false)
|
||||
public List<EpisodeResource> GetEpisodes(int? seriesId, int? seasonNumber, [FromQuery]List<int> episodeIds, int? episodeFileId, bool includeSeries = false, bool includeEpisodeFile = false, bool includeImages = false)
|
||||
{
|
||||
if (seriesId.HasValue)
|
||||
{
|
||||
if (seasonNumber.HasValue)
|
||||
{
|
||||
return MapToResource(_episodeService.GetEpisodesBySeason(seriesId.Value, seasonNumber.Value), false, false, includeImages);
|
||||
return MapToResource(_episodeService.GetEpisodesBySeason(seriesId.Value, seasonNumber.Value), includeSeries, includeEpisodeFile, includeImages);
|
||||
}
|
||||
|
||||
return MapToResource(_episodeService.GetEpisodeBySeries(seriesId.Value), false, false, includeImages);
|
||||
return MapToResource(_episodeService.GetEpisodeBySeries(seriesId.Value), includeSeries, includeEpisodeFile, includeImages);
|
||||
}
|
||||
else if (episodeIds.Any())
|
||||
{
|
||||
return MapToResource(_episodeService.GetEpisodes(episodeIds), false, false, includeImages);
|
||||
return MapToResource(_episodeService.GetEpisodes(episodeIds), includeSeries, includeEpisodeFile, includeImages);
|
||||
}
|
||||
else if (episodeFileId.HasValue)
|
||||
{
|
||||
return MapToResource(_episodeService.GetEpisodesByFileId(episodeFileId.Value), false, false, includeImages);
|
||||
return MapToResource(_episodeService.GetEpisodesByFileId(episodeFileId.Value), includeSeries, includeEpisodeFile, includeImages);
|
||||
}
|
||||
|
||||
throw new BadRequestException("seriesId or episodeIds must be provided");
|
||||
|
Loading…
x
Reference in New Issue
Block a user