Fix up getting livetv programs api docs

This commit is contained in:
Cody Robibero 2024-07-23 11:34:41 -06:00
parent 59446a8dd2
commit 6fd79fb015
2 changed files with 14 additions and 35 deletions

View File

@ -656,7 +656,7 @@ public class LiveTvController : BaseJellyfinApiController
var query = new InternalItemsQuery(user) var query = new InternalItemsQuery(user)
{ {
ChannelIds = body.ChannelIds, ChannelIds = body.ChannelIds ?? [],
HasAired = body.HasAired, HasAired = body.HasAired,
IsAiring = body.IsAiring, IsAiring = body.IsAiring,
EnableTotalRecordCount = body.EnableTotalRecordCount, EnableTotalRecordCount = body.EnableTotalRecordCount,
@ -666,15 +666,15 @@ public class LiveTvController : BaseJellyfinApiController
MaxEndDate = body.MaxEndDate, MaxEndDate = body.MaxEndDate,
StartIndex = body.StartIndex, StartIndex = body.StartIndex,
Limit = body.Limit, Limit = body.Limit,
OrderBy = RequestHelpers.GetOrderBy(body.SortBy, body.SortOrder), OrderBy = RequestHelpers.GetOrderBy(body.SortBy ?? [], body.SortOrder ?? []),
IsNews = body.IsNews, IsNews = body.IsNews,
IsMovie = body.IsMovie, IsMovie = body.IsMovie,
IsSeries = body.IsSeries, IsSeries = body.IsSeries,
IsKids = body.IsKids, IsKids = body.IsKids,
IsSports = body.IsSports, IsSports = body.IsSports,
SeriesTimerId = body.SeriesTimerId, SeriesTimerId = body.SeriesTimerId,
Genres = body.Genres, Genres = body.Genres ?? [],
GenreIds = body.GenreIds GenreIds = body.GenreIds ?? []
}; };
if (!body.LibrarySeriesId.IsEmpty()) if (!body.LibrarySeriesId.IsEmpty())
@ -690,7 +690,7 @@ public class LiveTvController : BaseJellyfinApiController
var dtoOptions = new DtoOptions { Fields = body.Fields } var dtoOptions = new DtoOptions { Fields = body.Fields }
.AddClientFields(User) .AddClientFields(User)
.AddAdditionalDtoOptions(body.EnableImages, body.EnableUserData, body.ImageTypeLimit, body.EnableImageTypes); .AddAdditionalDtoOptions(body.EnableImages, body.EnableUserData, body.ImageTypeLimit, body.EnableImageTypes ?? []);
return await _liveTvManager.GetPrograms(query, dtoOptions, CancellationToken.None).ConfigureAwait(false); return await _liveTvManager.GetPrograms(query, dtoOptions, CancellationToken.None).ConfigureAwait(false);
} }

View File

@ -17,7 +17,7 @@ public class GetProgramsDto
/// Gets or sets the channels to return guide information for. /// Gets or sets the channels to return guide information for.
/// </summary> /// </summary>
[JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))]
public IReadOnlyList<Guid> ChannelIds { get; set; } = Array.Empty<Guid>(); public IReadOnlyList<Guid>? ChannelIds { get; set; }
/// <summary> /// <summary>
/// Gets or sets optional. Filter by user id. /// Gets or sets optional. Filter by user id.
@ -26,110 +26,95 @@ public class GetProgramsDto
/// <summary> /// <summary>
/// Gets or sets the minimum premiere start date. /// Gets or sets the minimum premiere start date.
/// Optional.
/// </summary> /// </summary>
public DateTime? MinStartDate { get; set; } public DateTime? MinStartDate { get; set; }
/// <summary> /// <summary>
/// Gets or sets filter by programs that have completed airing, or not. /// Gets or sets filter by programs that have completed airing, or not.
/// Optional.
/// </summary> /// </summary>
public bool? HasAired { get; set; } public bool? HasAired { get; set; }
/// <summary> /// <summary>
/// Gets or sets filter by programs that are currently airing, or not. /// Gets or sets filter by programs that are currently airing, or not.
/// Optional.
/// </summary> /// </summary>
public bool? IsAiring { get; set; } public bool? IsAiring { get; set; }
/// <summary> /// <summary>
/// Gets or sets the maximum premiere start date. /// Gets or sets the maximum premiere start date.
/// Optional.
/// </summary> /// </summary>
public DateTime? MaxStartDate { get; set; } public DateTime? MaxStartDate { get; set; }
/// <summary> /// <summary>
/// Gets or sets the minimum premiere end date. /// Gets or sets the minimum premiere end date.
/// Optional.
/// </summary> /// </summary>
public DateTime? MinEndDate { get; set; } public DateTime? MinEndDate { get; set; }
/// <summary> /// <summary>
/// Gets or sets the maximum premiere end date. /// Gets or sets the maximum premiere end date.
/// Optional.
/// </summary> /// </summary>
public DateTime? MaxEndDate { get; set; } public DateTime? MaxEndDate { get; set; }
/// <summary> /// <summary>
/// Gets or sets filter for movies. /// Gets or sets filter for movies.
/// Optional.
/// </summary> /// </summary>
public bool? IsMovie { get; set; } public bool? IsMovie { get; set; }
/// <summary> /// <summary>
/// Gets or sets filter for series. /// Gets or sets filter for series.
/// Optional.
/// </summary> /// </summary>
public bool? IsSeries { get; set; } public bool? IsSeries { get; set; }
/// <summary> /// <summary>
/// Gets or sets filter for news. /// Gets or sets filter for news.
/// Optional.
/// </summary> /// </summary>
public bool? IsNews { get; set; } public bool? IsNews { get; set; }
/// <summary> /// <summary>
/// Gets or sets filter for kids. /// Gets or sets filter for kids.
/// Optional.
/// </summary> /// </summary>
public bool? IsKids { get; set; } public bool? IsKids { get; set; }
/// <summary> /// <summary>
/// Gets or sets filter for sports. /// Gets or sets filter for sports.
/// Optional.
/// </summary> /// </summary>
public bool? IsSports { get; set; } public bool? IsSports { get; set; }
/// <summary> /// <summary>
/// Gets or sets the record index to start at. All items with a lower index will be dropped from the results. /// Gets or sets the record index to start at. All items with a lower index will be dropped from the results.
/// Optional.
/// </summary> /// </summary>
public int? StartIndex { get; set; } public int? StartIndex { get; set; }
/// <summary> /// <summary>
/// Gets or sets the maximum number of records to return. /// Gets or sets the maximum number of records to return.
/// Optional.
/// </summary> /// </summary>
public int? Limit { get; set; } public int? Limit { get; set; }
/// <summary> /// <summary>
/// Gets or sets specify one or more sort orders, comma delimited. Options: Name, StartDate. /// Gets or sets specify one or more sort orders, comma delimited. Options: Name, StartDate.
/// Optional.
/// </summary> /// </summary>
[JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))]
public IReadOnlyList<ItemSortBy> SortBy { get; set; } = Array.Empty<ItemSortBy>(); public IReadOnlyList<ItemSortBy>? SortBy { get; set; }
/// <summary> /// <summary>
/// Gets or sets sort Order - Ascending,Descending. /// Gets or sets sort order.
/// </summary> /// </summary>
[JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))]
public IReadOnlyList<SortOrder> SortOrder { get; set; } = Array.Empty<SortOrder>(); public IReadOnlyList<SortOrder>? SortOrder { get; set; }
/// <summary> /// <summary>
/// Gets or sets the genres to return guide information for. /// Gets or sets the genres to return guide information for.
/// </summary> /// </summary>
[JsonConverter(typeof(JsonPipeDelimitedArrayConverterFactory))] [JsonConverter(typeof(JsonPipeDelimitedArrayConverterFactory))]
public IReadOnlyList<string> Genres { get; set; } = Array.Empty<string>(); public IReadOnlyList<string>? Genres { get; set; }
/// <summary> /// <summary>
/// Gets or sets the genre ids to return guide information for. /// Gets or sets the genre ids to return guide information for.
/// </summary> /// </summary>
[JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))]
public IReadOnlyList<Guid> GenreIds { get; set; } = Array.Empty<Guid>(); public IReadOnlyList<Guid>? GenreIds { get; set; }
/// <summary> /// <summary>
/// Gets or sets include image information in output. /// Gets or sets include image information in output.
/// Optional.
/// </summary> /// </summary>
public bool? EnableImages { get; set; } public bool? EnableImages { get; set; }
@ -140,39 +125,33 @@ public class GetProgramsDto
/// <summary> /// <summary>
/// Gets or sets the max number of images to return, per image type. /// Gets or sets the max number of images to return, per image type.
/// Optional.
/// </summary> /// </summary>
public int? ImageTypeLimit { get; set; } public int? ImageTypeLimit { get; set; }
/// <summary> /// <summary>
/// Gets or sets the image types to include in the output. /// Gets or sets the image types to include in the output.
/// Optional.
/// </summary> /// </summary>
[JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))]
public IReadOnlyList<ImageType> EnableImageTypes { get; set; } = Array.Empty<ImageType>(); public IReadOnlyList<ImageType>? EnableImageTypes { get; set; }
/// <summary> /// <summary>
/// Gets or sets include user data. /// Gets or sets include user data.
/// Optional.
/// </summary> /// </summary>
public bool? EnableUserData { get; set; } public bool? EnableUserData { get; set; }
/// <summary> /// <summary>
/// Gets or sets filter by series timer id. /// Gets or sets filter by series timer id.
/// Optional.
/// </summary> /// </summary>
public string? SeriesTimerId { get; set; } public string? SeriesTimerId { get; set; }
/// <summary> /// <summary>
/// Gets or sets filter by library series id. /// Gets or sets filter by library series id.
/// Optional.
/// </summary> /// </summary>
public Guid LibrarySeriesId { get; set; } public Guid LibrarySeriesId { get; set; }
/// <summary> /// <summary>
/// Gets or sets specify additional fields of information to return in the output. This allows multiple, comma delimited. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines. /// Gets or sets specify additional fields of information to return in the output.
/// Optional.
/// </summary> /// </summary>
[JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))]
public IReadOnlyList<ItemFields> Fields { get; set; } = Array.Empty<ItemFields>(); public IReadOnlyList<ItemFields>? Fields { get; set; }
} }