diff options
Diffstat (limited to 'MediaBrowser.Api/UserLibrary/GenresService.cs')
| -rw-r--r-- | MediaBrowser.Api/UserLibrary/GenresService.cs | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/MediaBrowser.Api/UserLibrary/GenresService.cs b/MediaBrowser.Api/UserLibrary/GenresService.cs index 13c441c63..54561f400 100644 --- a/MediaBrowser.Api/UserLibrary/GenresService.cs +++ b/MediaBrowser.Api/UserLibrary/GenresService.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Controller.Entities; +using System.Threading; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using ServiceStack.ServiceHost; using System; @@ -18,6 +19,44 @@ namespace MediaBrowser.Api.UserLibrary { } + [Route("/Users/{UserId}/FavoriteGenres/{Name}", "POST")] + [Api(Description = "Marks a genre as a favorite")] + public class MarkFavoriteGenre : IReturnVoid + { + /// <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 = "POST")] + public Guid UserId { get; set; } + + /// <summary> + /// Gets or sets the name. + /// </summary> + /// <value>The name.</value> + [ApiMember(Name = "Name", Description = "Name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")] + public string Name { get; set; } + } + + [Route("/Users/{UserId}/FavoriteGenres/{Name}", "DELETE")] + [Api(Description = "Unmarks a genre as a favorite")] + public class UnmarkFavoriteGenre : IReturnVoid + { + /// <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 = "DELETE")] + public Guid UserId { get; set; } + + /// <summary> + /// Gets or sets the name. + /// </summary> + /// <value>The name.</value> + [ApiMember(Name = "Name", Description = "Name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")] + public string Name { get; set; } + } + /// <summary> /// Class GenresService /// </summary> @@ -41,6 +80,28 @@ namespace MediaBrowser.Api.UserLibrary } /// <summary> + /// Posts the specified request. + /// </summary> + /// <param name="request">The request.</param> + public void Post(MarkFavoriteGenre request) + { + var task = MarkFavorite(() => LibraryManager.GetGenre(request.Name), request.UserId, true); + + Task.WaitAll(task); + } + + /// <summary> + /// Deletes the specified request. + /// </summary> + /// <param name="request">The request.</param> + public void Delete(UnmarkFavoriteGenre request) + { + var task = MarkFavorite(() => LibraryManager.GetGenre(request.Name), request.UserId, false); + + Task.WaitAll(task); + } + + /// <summary> /// Gets all items. /// </summary> /// <param name="request">The request.</param> |
