Fix operation name in SearchController and correct nullability for SearchHint

This commit is contained in:
Niels van Velzen 2022-08-17 20:14:07 +02:00
parent 8ba83e41ae
commit de98457332
2 changed files with 55 additions and 19 deletions

View File

@ -79,7 +79,7 @@ namespace Jellyfin.Api.Controllers
[HttpGet] [HttpGet]
[Description("Gets search hints based on a search term")] [Description("Gets search hints based on a search term")]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
public ActionResult<SearchHintResult> Get( public ActionResult<SearchHintResult> GetSearchHints(
[FromQuery] int? startIndex, [FromQuery] int? startIndex,
[FromQuery] int? limit, [FromQuery] int? limit,
[FromQuery] Guid? userId, [FromQuery] Guid? userId,
@ -140,7 +140,7 @@ namespace Jellyfin.Api.Controllers
IndexNumber = item.IndexNumber, IndexNumber = item.IndexNumber,
ParentIndexNumber = item.ParentIndexNumber, ParentIndexNumber = item.ParentIndexNumber,
Id = item.Id, Id = item.Id,
Type = item.GetClientTypeName(), Type = item.GetBaseItemKind(),
MediaType = item.MediaType, MediaType = item.MediaType,
MatchedTerm = hintInfo.MatchedTerm, MatchedTerm = hintInfo.MatchedTerm,
RunTimeTicks = item.RunTimeTicks, RunTimeTicks = item.RunTimeTicks,
@ -149,8 +149,10 @@ namespace Jellyfin.Api.Controllers
EndDate = item.EndDate EndDate = item.EndDate
}; };
// legacy #pragma warning disable CS0618
// Kept for compatibility with older clients
result.ItemId = result.Id; result.ItemId = result.Id;
#pragma warning restore CS0618
if (item.IsFolder) if (item.IsFolder)
{ {

View File

@ -1,8 +1,6 @@
#nullable disable
#pragma warning disable CS1591
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Jellyfin.Data.Enums;
namespace MediaBrowser.Model.Search namespace MediaBrowser.Model.Search
{ {
@ -11,12 +9,28 @@ namespace MediaBrowser.Model.Search
/// </summary> /// </summary>
public class SearchHint public class SearchHint
{ {
/// <summary>
/// Initializes a new instance of the <see cref="SearchHint" /> class.
/// </summary>
public SearchHint()
{
Name = string.Empty;
MatchedTerm = string.Empty;
MediaType = string.Empty;
Artists = Array.Empty<string>();
}
/// <summary> /// <summary>
/// Gets or sets the item id. /// Gets or sets the item id.
/// </summary> /// </summary>
/// <value>The item id.</value> /// <value>The item id.</value>
[Obsolete("Use Id instead")]
public Guid ItemId { get; set; } public Guid ItemId { get; set; }
/// <summary>
/// Gets or sets the item id.
/// </summary>
/// <value>The item id.</value>
public Guid Id { get; set; } public Guid Id { get; set; }
/// <summary> /// <summary>
@ -53,38 +67,42 @@ namespace MediaBrowser.Model.Search
/// Gets or sets the image tag. /// Gets or sets the image tag.
/// </summary> /// </summary>
/// <value>The image tag.</value> /// <value>The image tag.</value>
public string PrimaryImageTag { get; set; } public string? PrimaryImageTag { get; set; }
/// <summary> /// <summary>
/// Gets or sets the thumb image tag. /// Gets or sets the thumb image tag.
/// </summary> /// </summary>
/// <value>The thumb image tag.</value> /// <value>The thumb image tag.</value>
public string ThumbImageTag { get; set; } public string? ThumbImageTag { get; set; }
/// <summary> /// <summary>
/// Gets or sets the thumb image item identifier. /// Gets or sets the thumb image item identifier.
/// </summary> /// </summary>
/// <value>The thumb image item identifier.</value> /// <value>The thumb image item identifier.</value>
public string ThumbImageItemId { get; set; } public string? ThumbImageItemId { get; set; }
/// <summary> /// <summary>
/// Gets or sets the backdrop image tag. /// Gets or sets the backdrop image tag.
/// </summary> /// </summary>
/// <value>The backdrop image tag.</value> /// <value>The backdrop image tag.</value>
public string BackdropImageTag { get; set; } public string? BackdropImageTag { get; set; }
/// <summary> /// <summary>
/// Gets or sets the backdrop image item identifier. /// Gets or sets the backdrop image item identifier.
/// </summary> /// </summary>
/// <value>The backdrop image item identifier.</value> /// <value>The backdrop image item identifier.</value>
public string BackdropImageItemId { get; set; } public string? BackdropImageItemId { get; set; }
/// <summary> /// <summary>
/// Gets or sets the type. /// Gets or sets the type.
/// </summary> /// </summary>
/// <value>The type.</value> /// <value>The type.</value>
public string Type { get; set; } public BaseItemKind Type { get; set; }
/// <summary>
/// Gets a value indicating whether this instance is folder.
/// </summary>
/// <value><c>true</c> if this instance is folder; otherwise, <c>false</c>.</value>
public bool? IsFolder { get; set; } public bool? IsFolder { get; set; }
/// <summary> /// <summary>
@ -99,31 +117,47 @@ namespace MediaBrowser.Model.Search
/// <value>The type of the media.</value> /// <value>The type of the media.</value>
public string MediaType { get; set; } public string MediaType { get; set; }
/// <summary>
/// Gets or sets the start date.
/// </summary>
/// <value>The start date.</value>
public DateTime? StartDate { get; set; } public DateTime? StartDate { get; set; }
/// <summary>
/// Gets or sets the end date.
/// </summary>
/// <value>The end date.</value>
public DateTime? EndDate { get; set; } public DateTime? EndDate { get; set; }
/// <summary> /// <summary>
/// Gets or sets the series. /// Gets or sets the series.
/// </summary> /// </summary>
/// <value>The series.</value> /// <value>The series.</value>
public string Series { get; set; } public string? Series { get; set; }
public string Status { get; set; } /// <summary>
/// Gets or sets the status.
/// </summary>
/// <value>The status.</value>
public string? Status { get; set; }
/// <summary> /// <summary>
/// Gets or sets the album. /// Gets or sets the album.
/// </summary> /// </summary>
/// <value>The album.</value> /// <value>The album.</value>
public string Album { get; set; } public string? Album { get; set; }
public Guid AlbumId { get; set; } /// <summary>
/// Gets or sets the album id.
/// </summary>
/// <value>The album id.</value>
public Guid? AlbumId { get; set; }
/// <summary> /// <summary>
/// Gets or sets the album artist. /// Gets or sets the album artist.
/// </summary> /// </summary>
/// <value>The album artist.</value> /// <value>The album artist.</value>
public string AlbumArtist { get; set; } public string? AlbumArtist { get; set; }
/// <summary> /// <summary>
/// Gets or sets the artists. /// Gets or sets the artists.
@ -147,13 +181,13 @@ namespace MediaBrowser.Model.Search
/// Gets or sets the channel identifier. /// Gets or sets the channel identifier.
/// </summary> /// </summary>
/// <value>The channel identifier.</value> /// <value>The channel identifier.</value>
public Guid ChannelId { get; set; } public Guid? ChannelId { get; set; }
/// <summary> /// <summary>
/// Gets or sets the name of the channel. /// Gets or sets the name of the channel.
/// </summary> /// </summary>
/// <value>The name of the channel.</value> /// <value>The name of the channel.</value>
public string ChannelName { get; set; } public string? ChannelName { get; set; }
/// <summary> /// <summary>
/// Gets or sets the primary image aspect ratio. /// Gets or sets the primary image aspect ratio.