From f08fc7493d0bd073095280c5b400fc4d85af62bc Mon Sep 17 00:00:00 2001 From: lps-rocks Date: Wed, 29 May 2019 17:32:17 -0500 Subject: [PATCH] New: Added downloadId filter to v3 history api for third-party applications closes #3105 --- src/Sonarr.Api.V3/History/HistoryModule.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Sonarr.Api.V3/History/HistoryModule.cs b/src/Sonarr.Api.V3/History/HistoryModule.cs index 4e24a39df..2a0e2cc97 100644 --- a/src/Sonarr.Api.V3/History/HistoryModule.cs +++ b/src/Sonarr.Api.V3/History/HistoryModule.cs @@ -66,6 +66,7 @@ namespace Sonarr.Api.V3.History var eventTypeFilter = pagingResource.Filters.FirstOrDefault(f => f.Key == "eventType"); var episodeIdFilter = pagingResource.Filters.FirstOrDefault(f => f.Key == "episodeId"); + var downloadIdFilter = pagingResource.Filters.FirstOrDefault(f => f.Key == "downloadId"); if (eventTypeFilter != null) { @@ -78,6 +79,12 @@ namespace Sonarr.Api.V3.History var episodeId = Convert.ToInt32(episodeIdFilter.Value); pagingSpec.FilterExpressions.Add(h => h.EpisodeId == episodeId); } + + if (downloadIdFilter != null) + { + var downloadId = downloadIdFilter.Value; + pagingSpec.FilterExpressions.Add(h => h.DownloadId == downloadId); + } return ApplyToPage(_historyService.Paged, pagingSpec, h => MapToResource(h, includeSeries, includeEpisode)); }