HttpSubscribeAttribute.cs 931 B

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