HttpUnsubscribeAttribute.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using System.Collections.Generic;
  3. using Microsoft.AspNetCore.Mvc.Routing;
  4. namespace Jellyfin.Api.Attributes
  5. {
  6. /// <summary>
  7. /// Identifies an action that supports the HTTP GET method.
  8. /// </summary>
  9. public class HttpUnsubscribeAttribute : HttpMethodAttribute
  10. {
  11. private static readonly IEnumerable<string> _supportedMethods = new[] { "UNSUBSCRIBE" };
  12. /// <summary>
  13. /// Initializes a new instance of the <see cref="HttpUnsubscribeAttribute"/> class.
  14. /// </summary>
  15. public HttpUnsubscribeAttribute()
  16. : base(_supportedMethods)
  17. {
  18. }
  19. /// <summary>
  20. /// Initializes a new instance of the <see cref="HttpUnsubscribeAttribute"/> class.
  21. /// </summary>
  22. /// <param name="template">The route template. May not be null.</param>
  23. public HttpUnsubscribeAttribute(string template)
  24. : base(_supportedMethods, template)
  25. {
  26. if (template == null)
  27. {
  28. throw new ArgumentNullException(nameof(template));
  29. }
  30. }
  31. }
  32. }