aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Attributes
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-04-21 19:15:27 -0600
committercrobibero <cody@robibe.ro>2020-04-21 19:15:27 -0600
commit461b298be7247afd7f7962604efab3b58b9dae4b (patch)
tree5d8255b2d64441eb715669fc60a59687836ec53e /Jellyfin.Api/Attributes
parenta2f19eadf739297cbbc99c9082b0175e8b881054 (diff)
Migrate DlnaServerController to Jellyfin.Api
Diffstat (limited to 'Jellyfin.Api/Attributes')
-rw-r--r--Jellyfin.Api/Attributes/HttpSubscribeAttribute.cs35
-rw-r--r--Jellyfin.Api/Attributes/HttpUnsubscribeAttribute.cs35
2 files changed, 70 insertions, 0 deletions
diff --git a/Jellyfin.Api/Attributes/HttpSubscribeAttribute.cs b/Jellyfin.Api/Attributes/HttpSubscribeAttribute.cs
new file mode 100644
index 000000000..2fdd1e489
--- /dev/null
+++ b/Jellyfin.Api/Attributes/HttpSubscribeAttribute.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.AspNetCore.Mvc.Routing;
+
+namespace Jellyfin.Api.Attributes
+{
+ /// <summary>
+ /// Identifies an action that supports the HTTP GET method.
+ /// </summary>
+ public class HttpSubscribeAttribute : HttpMethodAttribute
+ {
+ private static readonly IEnumerable<string> _supportedMethods = new[] { "SUBSCRIBE" };
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="HttpSubscribeAttribute"/> class.
+ /// </summary>
+ public HttpSubscribeAttribute()
+ : base(_supportedMethods)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="HttpSubscribeAttribute"/> class.
+ /// </summary>
+ /// <param name="template">The route template. May not be null.</param>
+ public HttpSubscribeAttribute(string template)
+ : base(_supportedMethods, template)
+ {
+ if (template == null)
+ {
+ throw new ArgumentNullException(nameof(template));
+ }
+ }
+ }
+}
diff --git a/Jellyfin.Api/Attributes/HttpUnsubscribeAttribute.cs b/Jellyfin.Api/Attributes/HttpUnsubscribeAttribute.cs
new file mode 100644
index 000000000..d6d7e4563
--- /dev/null
+++ b/Jellyfin.Api/Attributes/HttpUnsubscribeAttribute.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.AspNetCore.Mvc.Routing;
+
+namespace Jellyfin.Api.Attributes
+{
+ /// <summary>
+ /// Identifies an action that supports the HTTP GET method.
+ /// </summary>
+ public class HttpUnsubscribeAttribute : HttpMethodAttribute
+ {
+ private static readonly IEnumerable<string> _supportedMethods = new[] { "UNSUBSCRIBE" };
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="HttpUnsubscribeAttribute"/> class.
+ /// </summary>
+ public HttpUnsubscribeAttribute()
+ : base(_supportedMethods)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="HttpUnsubscribeAttribute"/> class.
+ /// </summary>
+ /// <param name="template">The route template. May not be null.</param>
+ public HttpUnsubscribeAttribute(string template)
+ : base(_supportedMethods, template)
+ {
+ if (template == null)
+ {
+ throw new ArgumentNullException(nameof(template));
+ }
+ }
+ }
+}