|
@@ -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>
|
|
@@ -40,6 +79,28 @@ namespace MediaBrowser.Api.UserLibrary
|
|
|
return ToOptimizedResult(result);
|
|
|
}
|
|
|
|
|
|
+ /// <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>
|