diff options
Diffstat (limited to 'MediaBrowser.Api/UserLibrary/ItemsService.cs')
| -rw-r--r-- | MediaBrowser.Api/UserLibrary/ItemsService.cs | 69 |
1 files changed, 2 insertions, 67 deletions
diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index b344f9491..ff062c183 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -1,6 +1,5 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; -using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; using MediaBrowser.Server.Implementations.HttpServer; @@ -17,44 +16,9 @@ namespace MediaBrowser.Api.UserLibrary /// </summary> [Route("/Users/{UserId}/Items", "GET")] [ServiceStack.ServiceHost.Api(Description = "Gets items based on a query.")] - public class GetItems : IReturn<ItemsResult> + public class GetItems : BaseItemsRequest, IReturn<ItemsResult> { /// <summary> - /// Gets or sets the user id. - /// </summary> - /// <value>The user id.</value> - [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] - public Guid UserId { get; set; } - - /// <summary> - /// Specify this to localize the search to a specific item or folder. Omit to use the root. - /// </summary> - /// <value>The parent id.</value> - [ApiMember(Name = "ParentId", Description = "Specify this to localize the search to a specific item or folder. Omit to use the root", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public string ParentId { get; set; } - - /// <summary> - /// Skips over a given number of items within the results. Use for paging. - /// </summary> - /// <value>The start index.</value> - [ApiMember(Name = "StartIndex", Description = "Optional. The record index to start at. All items with a lower index will be dropped from the results.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] - public int? StartIndex { get; set; } - - /// <summary> - /// The maximum number of items to return - /// </summary> - /// <value>The limit.</value> - [ApiMember(Name = "Limit", Description = "Optional. The maximum number of records to return", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] - public int? Limit { get; set; } - - /// <summary> - /// Whether or not to perform the query recursively - /// </summary> - /// <value><c>true</c> if recursive; otherwise, <c>false</c>.</value> - [ApiMember(Name = "Recursive", Description = "When searching within folders, this determines whether or not the search will be recursive. true/false", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")] - public bool Recursive { get; set; } - - /// <summary> /// Limit results to items containing a specific person /// </summary> /// <value>The person.</value> @@ -89,13 +53,6 @@ namespace MediaBrowser.Api.UserLibrary public string SortBy { get; set; } /// <summary> - /// The sort order to return results with - /// </summary> - /// <value>The sort order.</value> - [ApiMember(Name = "SortOrder", Description = "Optional. Ascending / Descending sort order", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public string SortOrder { get; set; } - - /// <summary> /// Filters to apply to the results /// </summary> /// <value>The filters.</value> @@ -103,13 +60,6 @@ namespace MediaBrowser.Api.UserLibrary public string Filters { get; set; } /// <summary> - /// Fields to return within the items, in addition to basic information - /// </summary> - /// <value>The fields.</value> - [ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: AudioInfo, Chapters, DateCreated, DisplayMediaType, DisplayPreferences, Genres, ItemCounts, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, SeriesInfo, SortName, Studios, Taglines, TrailerUrls, UserData", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] - public string Fields { get; set; } - - /// <summary> /// Limit results to items containing specific genres /// </summary> /// <value>The genres.</value> @@ -262,7 +212,7 @@ namespace MediaBrowser.Api.UserLibrary { var orderBy = GetOrderBy(request).ToArray(); - return orderBy.Length == 0 ? items : _libraryManager.Sort(items, user, orderBy, GetSortOrder(request) ?? SortOrder.Ascending); + return orderBy.Length == 0 ? items : _libraryManager.Sort(items, user, orderBy, request.SortOrder ?? SortOrder.Ascending); } /// <summary> @@ -467,21 +417,6 @@ namespace MediaBrowser.Api.UserLibrary } /// <summary> - /// Gets the sort order. - /// </summary> - /// <param name="request">The request.</param> - /// <returns>System.Nullable{SortOrder}.</returns> - private SortOrder? GetSortOrder(GetItems request) - { - if (string.IsNullOrEmpty(request.SortOrder)) - { - return null; - } - - return (SortOrder)Enum.Parse(typeof(SortOrder), request.SortOrder, true); - } - - /// <summary> /// Gets the filters. /// </summary> /// <param name="request">The request.</param> |
