aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Attributes
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-09-01 17:26:49 -0600
committercrobibero <cody@robibe.ro>2020-09-01 17:26:49 -0600
commit2f33bee2a94f7175050f83d568f8bd65a01a86f8 (patch)
tree69ca62c6fa2291de284a28da59c35b6f2baa45ac /Jellyfin.Api/Attributes
parent2d198292a3ff1a5d213c9dd4643eee6ddef2661e (diff)
Set openapi schema type to file where possible
Diffstat (limited to 'Jellyfin.Api/Attributes')
-rw-r--r--Jellyfin.Api/Attributes/ProducesAudioFileAttribute.cs18
-rw-r--r--Jellyfin.Api/Attributes/ProducesFileAttribute.cs28
-rw-r--r--Jellyfin.Api/Attributes/ProducesImageFileAttribute.cs18
-rw-r--r--Jellyfin.Api/Attributes/ProducesPlaylistFileAttribute.cs18
-rw-r--r--Jellyfin.Api/Attributes/ProducesVideoFileAttribute.cs18
5 files changed, 100 insertions, 0 deletions
diff --git a/Jellyfin.Api/Attributes/ProducesAudioFileAttribute.cs b/Jellyfin.Api/Attributes/ProducesAudioFileAttribute.cs
new file mode 100644
index 000000000..3adb700eb
--- /dev/null
+++ b/Jellyfin.Api/Attributes/ProducesAudioFileAttribute.cs
@@ -0,0 +1,18 @@
+namespace Jellyfin.Api.Attributes
+{
+ /// <summary>
+ /// Produces file attribute of "image/*".
+ /// </summary>
+ public class ProducesAudioFileAttribute : ProducesFileAttribute
+ {
+ private const string ContentType = "audio/*";
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ProducesAudioFileAttribute"/> class.
+ /// </summary>
+ public ProducesAudioFileAttribute()
+ : base(ContentType)
+ {
+ }
+ }
+}
diff --git a/Jellyfin.Api/Attributes/ProducesFileAttribute.cs b/Jellyfin.Api/Attributes/ProducesFileAttribute.cs
new file mode 100644
index 000000000..62a576ede
--- /dev/null
+++ b/Jellyfin.Api/Attributes/ProducesFileAttribute.cs
@@ -0,0 +1,28 @@
+using System;
+
+namespace Jellyfin.Api.Attributes
+{
+ /// <summary>
+ /// Internal produces image attribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Method)]
+ public class ProducesFileAttribute : Attribute
+ {
+ private readonly string[] _contentTypes;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ProducesFileAttribute"/> class.
+ /// </summary>
+ /// <param name="contentTypes">Content types this endpoint produces.</param>
+ public ProducesFileAttribute(params string[] contentTypes)
+ {
+ _contentTypes = contentTypes;
+ }
+
+ /// <summary>
+ /// Gets the configured content types.
+ /// </summary>
+ /// <returns>the configured content types.</returns>
+ public string[] GetContentTypes() => _contentTypes;
+ }
+}
diff --git a/Jellyfin.Api/Attributes/ProducesImageFileAttribute.cs b/Jellyfin.Api/Attributes/ProducesImageFileAttribute.cs
new file mode 100644
index 000000000..e15813676
--- /dev/null
+++ b/Jellyfin.Api/Attributes/ProducesImageFileAttribute.cs
@@ -0,0 +1,18 @@
+namespace Jellyfin.Api.Attributes
+{
+ /// <summary>
+ /// Produces file attribute of "image/*".
+ /// </summary>
+ public class ProducesImageFileAttribute : ProducesFileAttribute
+ {
+ private const string ContentType = "image/*";
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ProducesImageFileAttribute"/> class.
+ /// </summary>
+ public ProducesImageFileAttribute()
+ : base(ContentType)
+ {
+ }
+ }
+}
diff --git a/Jellyfin.Api/Attributes/ProducesPlaylistFileAttribute.cs b/Jellyfin.Api/Attributes/ProducesPlaylistFileAttribute.cs
new file mode 100644
index 000000000..5d928ab91
--- /dev/null
+++ b/Jellyfin.Api/Attributes/ProducesPlaylistFileAttribute.cs
@@ -0,0 +1,18 @@
+namespace Jellyfin.Api.Attributes
+{
+ /// <summary>
+ /// Produces file attribute of "image/*".
+ /// </summary>
+ public class ProducesPlaylistFileAttribute : ProducesFileAttribute
+ {
+ private const string ContentType = "application/x-mpegURL";
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ProducesPlaylistFileAttribute"/> class.
+ /// </summary>
+ public ProducesPlaylistFileAttribute()
+ : base(ContentType)
+ {
+ }
+ }
+}
diff --git a/Jellyfin.Api/Attributes/ProducesVideoFileAttribute.cs b/Jellyfin.Api/Attributes/ProducesVideoFileAttribute.cs
new file mode 100644
index 000000000..d8b2856dc
--- /dev/null
+++ b/Jellyfin.Api/Attributes/ProducesVideoFileAttribute.cs
@@ -0,0 +1,18 @@
+namespace Jellyfin.Api.Attributes
+{
+ /// <summary>
+ /// Produces file attribute of "video/*".
+ /// </summary>
+ public class ProducesVideoFileAttribute : ProducesFileAttribute
+ {
+ private const string ContentType = "video/*";
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ProducesVideoFileAttribute"/> class.
+ /// </summary>
+ public ProducesVideoFileAttribute()
+ : base(ContentType)
+ {
+ }
+ }
+}