Fixed: 'includeSeasonImages' parameter to get single series from API
Closes #5971
This commit is contained in:
parent
f521942301
commit
87b3a305e9
|
@ -4,6 +4,7 @@ using FluentValidation;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Core.DataAugmentation.Scene;
|
using NzbDrone.Core.DataAugmentation.Scene;
|
||||||
|
using NzbDrone.Core.Datastore;
|
||||||
using NzbDrone.Core.Datastore.Events;
|
using NzbDrone.Core.Datastore.Events;
|
||||||
using NzbDrone.Core.MediaCover;
|
using NzbDrone.Core.MediaCover;
|
||||||
using NzbDrone.Core.MediaFiles;
|
using NzbDrone.Core.MediaFiles;
|
||||||
|
@ -19,6 +20,7 @@ using NzbDrone.Core.Validation;
|
||||||
using NzbDrone.Core.Validation.Paths;
|
using NzbDrone.Core.Validation.Paths;
|
||||||
using NzbDrone.SignalR;
|
using NzbDrone.SignalR;
|
||||||
using Sonarr.Http;
|
using Sonarr.Http;
|
||||||
|
using Sonarr.Http.Extensions;
|
||||||
using Sonarr.Http.REST;
|
using Sonarr.Http.REST;
|
||||||
using Sonarr.Http.REST.Attributes;
|
using Sonarr.Http.REST.Attributes;
|
||||||
|
|
||||||
|
@ -118,12 +120,40 @@ namespace Sonarr.Api.V3.Series
|
||||||
return seriesResources;
|
return seriesResources;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[NonAction]
|
||||||
|
public override ActionResult<SeriesResource> GetResourceByIdWithErrorHandler(int id)
|
||||||
|
{
|
||||||
|
return base.GetResourceByIdWithErrorHandler(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RestGetById]
|
||||||
|
[Produces("application/json")]
|
||||||
|
public ActionResult<SeriesResource> GetResourceByIdWithErrorHandler(int id, [FromQuery] bool includeSeasonImages = false)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return GetSeriesResourceById(id, includeSeasonImages);
|
||||||
|
}
|
||||||
|
catch (ModelNotFoundException)
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override SeriesResource GetResourceById(int id)
|
protected override SeriesResource GetResourceById(int id)
|
||||||
|
{
|
||||||
|
var includeSeasonImages = Request?.GetBooleanQueryParameter("includeSeasonImages", false) ?? false;
|
||||||
|
|
||||||
|
// Parse IncludeImages and use it
|
||||||
|
return GetSeriesResourceById(id, includeSeasonImages);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SeriesResource GetSeriesResourceById(int id, bool includeSeasonImages = false)
|
||||||
{
|
{
|
||||||
var series = _seriesService.GetSeries(id);
|
var series = _seriesService.GetSeries(id);
|
||||||
|
|
||||||
// Parse IncludeImages and use it
|
// Parse IncludeImages and use it
|
||||||
return GetSeriesResource(series, false);
|
return GetSeriesResource(series, includeSeasonImages);
|
||||||
}
|
}
|
||||||
|
|
||||||
[RestPostById]
|
[RestPostById]
|
||||||
|
|
|
@ -6090,6 +6090,42 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/v3/series/{id}": {
|
"/api/v3/series/{id}": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"Series"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "includeSeasonImages",
|
||||||
|
"in": "query",
|
||||||
|
"schema": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Success",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/SeriesResource"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"put": {
|
"put": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"Series"
|
"Series"
|
||||||
|
@ -6180,34 +6216,6 @@
|
||||||
"description": "Success"
|
"description": "Success"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"get": {
|
|
||||||
"tags": [
|
|
||||||
"Series"
|
|
||||||
],
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"in": "path",
|
|
||||||
"required": true,
|
|
||||||
"schema": {
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "Success",
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/components/schemas/SeriesResource"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/v3/series/editor": {
|
"/api/v3/series/editor": {
|
||||||
|
|
Loading…
Reference in New Issue