|
|
@ -25,24 +25,24 @@ namespace Sonarr.Api.V3.Episodes
|
|
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
[HttpGet]
|
|
|
|
[Produces("application/json")]
|
|
|
|
[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 (seriesId.HasValue)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (seasonNumber.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())
|
|
|
|
else if (episodeIds.Any())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return MapToResource(_episodeService.GetEpisodes(episodeIds), false, false, includeImages);
|
|
|
|
return MapToResource(_episodeService.GetEpisodes(episodeIds), includeSeries, includeEpisodeFile, includeImages);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (episodeFileId.HasValue)
|
|
|
|
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");
|
|
|
|
throw new BadRequestException("seriesId or episodeIds must be provided");
|
|
|
|