diff options
Diffstat (limited to 'MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs')
| -rw-r--r-- | MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs | 73 |
1 files changed, 71 insertions, 2 deletions
diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs index f23610014..fffc11d68 100644 --- a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs +++ b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs @@ -7,8 +7,13 @@ using System.Linq; namespace MediaBrowser.Api.UserLibrary { - public abstract class BaseItemsRequest : IHasItemFields + public abstract class BaseItemsRequest : IHasDtoOptions { + protected BaseItemsRequest() + { + EnableImages = true; + } + /// <summary> /// Skips over a given number of items within the results. Use for paging. /// </summary> @@ -97,6 +102,70 @@ namespace MediaBrowser.Api.UserLibrary public bool? IsPlayed { get; set; } /// <summary> + /// Limit results to items containing specific genres + /// </summary> + /// <value>The genres.</value> + [ApiMember(Name = "Genres", Description = "Optional. If specified, results will be filtered based on genre. This allows multiple, pipe delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] + public string Genres { get; set; } + + [ApiMember(Name = "OfficialRatings", Description = "Optional. If specified, results will be filtered based on OfficialRating. This allows multiple, pipe delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] + public string OfficialRatings { get; set; } + + [ApiMember(Name = "Tags", Description = "Optional. If specified, results will be filtered based on tag. This allows multiple, pipe delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] + public string Tags { get; set; } + + /// <summary> + /// Limit results to items containing specific years + /// </summary> + /// <value>The years.</value> + [ApiMember(Name = "Years", Description = "Optional. If specified, results will be filtered based on production year. This allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] + public string Years { get; set; } + + [ApiMember(Name = "EnableImages", Description = "Optional, include image information in output", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")] + public bool? EnableImages { get; set; } + + [ApiMember(Name = "ImageTypeLimit", Description = "Optional, the max number of images to return, per image type", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] + public int? ImageTypeLimit { get; set; } + + [ApiMember(Name = "EnableImageTypes", Description = "Optional. The image types to include in the output.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] + public string EnableImageTypes { get; set; } + + public string[] GetGenres() + { + return (Genres ?? string.Empty).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); + } + + public string[] GetTags() + { + return (Tags ?? string.Empty).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); + } + + public string[] GetOfficialRatings() + { + return (OfficialRatings ?? string.Empty).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); + } + + public string[] GetMediaTypes() + { + return (MediaTypes ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + } + + public string[] GetIncludeItemTypes() + { + return (IncludeItemTypes ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + } + + public string[] GetExcludeItemTypes() + { + return (ExcludeItemTypes ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + } + + public int[] GetYears() + { + return (Years ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray(); + } + + /// <summary> /// Gets the filters. /// </summary> /// <returns>IEnumerable{ItemFilter}.</returns> @@ -132,7 +201,7 @@ namespace MediaBrowser.Api.UserLibrary /// Gets the order by. /// </summary> /// <returns>IEnumerable{ItemSortBy}.</returns> - public IEnumerable<string> GetOrderBy() + public string[] GetOrderBy() { var val = SortBy; |
