mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-14 11:23:42 +02:00
New: Added downloadId filter to v3 history api for third-party applications
closes #3105
This commit is contained in:
parent
a80b1bbcb3
commit
f08fc7493d
@ -66,6 +66,7 @@ private PagingResource<HistoryResource> GetHistory(PagingResource<HistoryResourc
|
||||
|
||||
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 @@ private PagingResource<HistoryResource> GetHistory(PagingResource<HistoryResourc
|
||||
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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user