From b3cb8fda22337e22d6d4ee45d5ec6e9cf69be7fa Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 12 Apr 2013 20:42:51 -0400 Subject: add ability to mark studios, genres and people as favorites --- MediaBrowser.Api/UserLibrary/StudiosService.cs | 60 ++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to 'MediaBrowser.Api/UserLibrary/StudiosService.cs') diff --git a/MediaBrowser.Api/UserLibrary/StudiosService.cs b/MediaBrowser.Api/UserLibrary/StudiosService.cs index 219475704..24f09c5ef 100644 --- a/MediaBrowser.Api/UserLibrary/StudiosService.cs +++ b/MediaBrowser.Api/UserLibrary/StudiosService.cs @@ -18,6 +18,44 @@ namespace MediaBrowser.Api.UserLibrary { } + [Route("/Users/{UserId}/FavoriteStudios/{Name}", "POST")] + [Api(Description = "Marks a studio as a favorite")] + public class MarkFavoriteStudio : IReturnVoid + { + /// + /// Gets or sets the user id. + /// + /// The user id. + [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] + public Guid UserId { get; set; } + + /// + /// Gets or sets the name. + /// + /// The name. + [ApiMember(Name = "Name", Description = "Name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")] + public string Name { get; set; } + } + + [Route("/Users/{UserId}/FavoriteStudios/{Name}", "DELETE")] + [Api(Description = "Unmarks a studio as a favorite")] + public class UnmarkFavoriteStudio : IReturnVoid + { + /// + /// Gets or sets the user id. + /// + /// The user id. + [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")] + public Guid UserId { get; set; } + + /// + /// Gets or sets the name. + /// + /// The name. + [ApiMember(Name = "Name", Description = "Name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")] + public string Name { get; set; } + } + /// /// Class StudiosService /// @@ -40,6 +78,28 @@ namespace MediaBrowser.Api.UserLibrary return ToOptimizedResult(result); } + /// + /// Posts the specified request. + /// + /// The request. + public void Post(MarkFavoriteStudio request) + { + var task = MarkFavorite(() => LibraryManager.GetStudio(request.Name), request.UserId, true); + + Task.WaitAll(task); + } + + /// + /// Deletes the specified request. + /// + /// The request. + public void Delete(UnmarkFavoriteStudio request) + { + var task = MarkFavorite(() => LibraryManager.GetStudio(request.Name), request.UserId, false); + + Task.WaitAll(task); + } + /// /// Gets all items. /// -- cgit v1.2.3