1
0
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:
ManiMatter 2024-09-21 19:16:05 +02:00 committed by GitHub
parent 30c36fdc3b
commit c9aa59340c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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");