From 177d9cc1721aa347eeb7cc015a97361d04106437 Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Mon, 11 Mar 2013 01:06:55 -0400 Subject: consolidated some api code --- .../UserLibrary/BaseItemsByNameService.cs | 56 +++------------------- 1 file changed, 6 insertions(+), 50 deletions(-) (limited to 'MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs') diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs index 0a47e5df6..5fb2097cd 100644 --- a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs +++ b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs @@ -1,7 +1,6 @@ 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; using ServiceStack.ServiceHost; @@ -24,12 +23,16 @@ namespace MediaBrowser.Api.UserLibrary /// The _user manager /// protected readonly IUserManager UserManager; + /// + /// The library manager + /// protected readonly ILibraryManager LibraryManager; /// /// Initializes a new instance of the class. /// /// The user manager. + /// The library manager. protected BaseItemsByNameService(IUserManager userManager, ILibraryManager libraryManager) { UserManager = userManager; @@ -45,7 +48,7 @@ namespace MediaBrowser.Api.UserLibrary { var user = UserManager.GetUserById(request.UserId); - var item = string.IsNullOrEmpty(request.Id) ? user.RootFolder : DtoBuilder.GetItemByClientId(request.Id, UserManager, LibraryManager, user.Id); + var item = string.IsNullOrEmpty(request.ParentId) ? user.RootFolder : DtoBuilder.GetItemByClientId(request.ParentId, UserManager, LibraryManager, user.Id); IEnumerable items; @@ -158,54 +161,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// Class GetItemsByName /// - public class GetItemsByName : IReturn + public class GetItemsByName : BaseItemsRequest, IReturn { - /// - /// Gets or sets the user id. - /// - /// The user id. - [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] - public Guid UserId { get; set; } - - /// - /// Gets or sets the start index. - /// - /// The start index. - [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; } - - /// - /// Gets or sets the size of the page. - /// - /// The size of the page. - [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; } - - /// - /// Gets or sets a value indicating whether this is recursive. - /// - /// true if recursive; otherwise, false. - [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; } - - /// - /// Gets or sets the sort order. - /// - /// The sort order. - [ApiMember(Name = "SortOrder", Description = "Sort Order - Ascending,Descending", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public SortOrder? SortOrder { get; set; } - - /// - /// If specified the search will be localized within a specific item or folder - /// - /// The item id. - [ApiMember(Name = "Id", Description = "If specified the search will be localized within a specific item or folder", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public string Id { get; set; } - - /// - /// Fields to return within the items, in addition to basic information - /// - /// The fields. - public string Fields { get; set; } } } -- cgit v1.2.3