diff options
| author | Shadowghost <Ghost_of_Stone@web.de> | 2023-01-31 12:18:10 +0100 |
|---|---|---|
| committer | Shadowghost <Ghost_of_Stone@web.de> | 2023-02-02 18:50:33 +0100 |
| commit | f5f890e68562e55d4bed16c454c4b4305152b296 (patch) | |
| tree | b52e3b45ceb2faa446153866600b4456fed44c8b /Jellyfin.Api/Attributes | |
| parent | 58b3945805db4f88bc069ee84013bdf85d7429b1 (diff) | |
Migrate to file-scoped namespaces
Diffstat (limited to 'Jellyfin.Api/Attributes')
| -rw-r--r-- | Jellyfin.Api/Attributes/AcceptsFileAttribute.cs | 39 | ||||
| -rw-r--r-- | Jellyfin.Api/Attributes/AcceptsImageFileAttribute.cs | 23 | ||||
| -rw-r--r-- | Jellyfin.Api/Attributes/HttpSubscribeAttribute.cs | 39 | ||||
| -rw-r--r-- | Jellyfin.Api/Attributes/HttpUnsubscribeAttribute.cs | 39 | ||||
| -rw-r--r-- | Jellyfin.Api/Attributes/ParameterObsoleteAttribute.cs | 15 | ||||
| -rw-r--r-- | Jellyfin.Api/Attributes/ProducesAudioFileAttribute.cs | 23 | ||||
| -rw-r--r-- | Jellyfin.Api/Attributes/ProducesFileAttribute.cs | 39 | ||||
| -rw-r--r-- | Jellyfin.Api/Attributes/ProducesImageFileAttribute.cs | 23 | ||||
| -rw-r--r-- | Jellyfin.Api/Attributes/ProducesPlaylistFileAttribute.cs | 23 | ||||
| -rw-r--r-- | Jellyfin.Api/Attributes/ProducesVideoFileAttribute.cs | 23 |
10 files changed, 138 insertions, 148 deletions
diff --git a/Jellyfin.Api/Attributes/AcceptsFileAttribute.cs b/Jellyfin.Api/Attributes/AcceptsFileAttribute.cs index fbe68b6b9..a6c89bab8 100644 --- a/Jellyfin.Api/Attributes/AcceptsFileAttribute.cs +++ b/Jellyfin.Api/Attributes/AcceptsFileAttribute.cs @@ -2,29 +2,28 @@ using System; -namespace Jellyfin.Api.Attributes +namespace Jellyfin.Api.Attributes; + +/// <summary> +/// Internal produces image attribute. +/// </summary> +[AttributeUsage(AttributeTargets.Method)] +public class AcceptsFileAttribute : Attribute { + private readonly string[] _contentTypes; + /// <summary> - /// Internal produces image attribute. + /// Initializes a new instance of the <see cref="AcceptsFileAttribute"/> class. /// </summary> - [AttributeUsage(AttributeTargets.Method)] - public class AcceptsFileAttribute : Attribute + /// <param name="contentTypes">Content types this endpoint produces.</param> + public AcceptsFileAttribute(params string[] contentTypes) { - private readonly string[] _contentTypes; - - /// <summary> - /// Initializes a new instance of the <see cref="AcceptsFileAttribute"/> class. - /// </summary> - /// <param name="contentTypes">Content types this endpoint produces.</param> - public AcceptsFileAttribute(params string[] contentTypes) - { - _contentTypes = contentTypes; - } - - /// <summary> - /// Gets the configured content types. - /// </summary> - /// <returns>the configured content types.</returns> - public string[] ContentTypes => _contentTypes; + _contentTypes = contentTypes; } + + /// <summary> + /// Gets the configured content types. + /// </summary> + /// <returns>the configured content types.</returns> + public string[] ContentTypes => _contentTypes; } diff --git a/Jellyfin.Api/Attributes/AcceptsImageFileAttribute.cs b/Jellyfin.Api/Attributes/AcceptsImageFileAttribute.cs index 244a29da4..57433202e 100644 --- a/Jellyfin.Api/Attributes/AcceptsImageFileAttribute.cs +++ b/Jellyfin.Api/Attributes/AcceptsImageFileAttribute.cs @@ -1,18 +1,17 @@ -namespace Jellyfin.Api.Attributes +namespace Jellyfin.Api.Attributes; + +/// <summary> +/// Produces file attribute of "image/*". +/// </summary> +public sealed class AcceptsImageFileAttribute : AcceptsFileAttribute { + private const string ContentType = "image/*"; + /// <summary> - /// Produces file attribute of "image/*". + /// Initializes a new instance of the <see cref="AcceptsImageFileAttribute"/> class. /// </summary> - public sealed class AcceptsImageFileAttribute : AcceptsFileAttribute + public AcceptsImageFileAttribute() + : base(ContentType) { - private const string ContentType = "image/*"; - - /// <summary> - /// Initializes a new instance of the <see cref="AcceptsImageFileAttribute"/> class. - /// </summary> - public AcceptsImageFileAttribute() - : base(ContentType) - { - } } } diff --git a/Jellyfin.Api/Attributes/HttpSubscribeAttribute.cs b/Jellyfin.Api/Attributes/HttpSubscribeAttribute.cs index 4dcf5976a..cbd32ed82 100644 --- a/Jellyfin.Api/Attributes/HttpSubscribeAttribute.cs +++ b/Jellyfin.Api/Attributes/HttpSubscribeAttribute.cs @@ -2,29 +2,28 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Mvc.Routing; -namespace Jellyfin.Api.Attributes +namespace Jellyfin.Api.Attributes; + +/// <summary> +/// Identifies an action that supports the HTTP GET method. +/// </summary> +public sealed class HttpSubscribeAttribute : HttpMethodAttribute { + private static readonly IEnumerable<string> _supportedMethods = new[] { "SUBSCRIBE" }; + /// <summary> - /// Identifies an action that supports the HTTP GET method. + /// Initializes a new instance of the <see cref="HttpSubscribeAttribute"/> class. /// </summary> - public sealed class HttpSubscribeAttribute : HttpMethodAttribute + public HttpSubscribeAttribute() + : base(_supportedMethods) { - 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) - => ArgumentNullException.ThrowIfNull(template); } + + /// <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) + => ArgumentNullException.ThrowIfNull(template); } diff --git a/Jellyfin.Api/Attributes/HttpUnsubscribeAttribute.cs b/Jellyfin.Api/Attributes/HttpUnsubscribeAttribute.cs index d0238424a..f4a6dcdaf 100644 --- a/Jellyfin.Api/Attributes/HttpUnsubscribeAttribute.cs +++ b/Jellyfin.Api/Attributes/HttpUnsubscribeAttribute.cs @@ -2,29 +2,28 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Mvc.Routing; -namespace Jellyfin.Api.Attributes +namespace Jellyfin.Api.Attributes; + +/// <summary> +/// Identifies an action that supports the HTTP GET method. +/// </summary> +public sealed class HttpUnsubscribeAttribute : HttpMethodAttribute { + private static readonly IEnumerable<string> _supportedMethods = new[] { "UNSUBSCRIBE" }; + /// <summary> - /// Identifies an action that supports the HTTP GET method. + /// Initializes a new instance of the <see cref="HttpUnsubscribeAttribute"/> class. /// </summary> - public sealed class HttpUnsubscribeAttribute : HttpMethodAttribute + public HttpUnsubscribeAttribute() + : base(_supportedMethods) { - 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) - => ArgumentNullException.ThrowIfNull(template); } + + /// <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) + => ArgumentNullException.ThrowIfNull(template); } diff --git a/Jellyfin.Api/Attributes/ParameterObsoleteAttribute.cs b/Jellyfin.Api/Attributes/ParameterObsoleteAttribute.cs index 514e7ce97..bf64fef5d 100644 --- a/Jellyfin.Api/Attributes/ParameterObsoleteAttribute.cs +++ b/Jellyfin.Api/Attributes/ParameterObsoleteAttribute.cs @@ -1,12 +1,11 @@ using System; -namespace Jellyfin.Api.Attributes +namespace Jellyfin.Api.Attributes; + +/// <summary> +/// Attribute to mark a parameter as obsolete. +/// </summary> +[AttributeUsage(AttributeTargets.Parameter)] +public sealed class ParameterObsoleteAttribute : Attribute { - /// <summary> - /// Attribute to mark a parameter as obsolete. - /// </summary> - [AttributeUsage(AttributeTargets.Parameter)] - public sealed class ParameterObsoleteAttribute : Attribute - { - } } diff --git a/Jellyfin.Api/Attributes/ProducesAudioFileAttribute.cs b/Jellyfin.Api/Attributes/ProducesAudioFileAttribute.cs index 9fc25f192..7ce09c299 100644 --- a/Jellyfin.Api/Attributes/ProducesAudioFileAttribute.cs +++ b/Jellyfin.Api/Attributes/ProducesAudioFileAttribute.cs @@ -1,18 +1,17 @@ -namespace Jellyfin.Api.Attributes +namespace Jellyfin.Api.Attributes; + +/// <summary> +/// Produces file attribute of "image/*". +/// </summary> +public sealed class ProducesAudioFileAttribute : ProducesFileAttribute { + private const string ContentType = "audio/*"; + /// <summary> - /// Produces file attribute of "image/*". + /// Initializes a new instance of the <see cref="ProducesAudioFileAttribute"/> class. /// </summary> - public sealed class ProducesAudioFileAttribute : ProducesFileAttribute + public ProducesAudioFileAttribute() + : base(ContentType) { - 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 index d8e4141ac..c728f68e0 100644 --- a/Jellyfin.Api/Attributes/ProducesFileAttribute.cs +++ b/Jellyfin.Api/Attributes/ProducesFileAttribute.cs @@ -2,29 +2,28 @@ using System; -namespace Jellyfin.Api.Attributes +namespace Jellyfin.Api.Attributes; + +/// <summary> +/// Internal produces image attribute. +/// </summary> +[AttributeUsage(AttributeTargets.Method)] +public class ProducesFileAttribute : Attribute { + private readonly string[] _contentTypes; + /// <summary> - /// Internal produces image attribute. + /// Initializes a new instance of the <see cref="ProducesFileAttribute"/> class. /// </summary> - [AttributeUsage(AttributeTargets.Method)] - public class ProducesFileAttribute : Attribute + /// <param name="contentTypes">Content types this endpoint produces.</param> + public ProducesFileAttribute(params string[] contentTypes) { - 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[] ContentTypes => _contentTypes; + _contentTypes = contentTypes; } + + /// <summary> + /// Gets the configured content types. + /// </summary> + /// <returns>the configured content types.</returns> + public string[] ContentTypes => _contentTypes; } diff --git a/Jellyfin.Api/Attributes/ProducesImageFileAttribute.cs b/Jellyfin.Api/Attributes/ProducesImageFileAttribute.cs index 1e5b542e2..f145a061e 100644 --- a/Jellyfin.Api/Attributes/ProducesImageFileAttribute.cs +++ b/Jellyfin.Api/Attributes/ProducesImageFileAttribute.cs @@ -1,18 +1,17 @@ -namespace Jellyfin.Api.Attributes +namespace Jellyfin.Api.Attributes; + +/// <summary> +/// Produces file attribute of "image/*". +/// </summary> +public sealed class ProducesImageFileAttribute : ProducesFileAttribute { + private const string ContentType = "image/*"; + /// <summary> - /// Produces file attribute of "image/*". + /// Initializes a new instance of the <see cref="ProducesImageFileAttribute"/> class. /// </summary> - public sealed class ProducesImageFileAttribute : ProducesFileAttribute + public ProducesImageFileAttribute() + : base(ContentType) { - 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 index 5b15cb1a5..c03ed740c 100644 --- a/Jellyfin.Api/Attributes/ProducesPlaylistFileAttribute.cs +++ b/Jellyfin.Api/Attributes/ProducesPlaylistFileAttribute.cs @@ -1,18 +1,17 @@ -namespace Jellyfin.Api.Attributes +namespace Jellyfin.Api.Attributes; + +/// <summary> +/// Produces file attribute of "image/*". +/// </summary> +public sealed class ProducesPlaylistFileAttribute : ProducesFileAttribute { + private const string ContentType = "application/x-mpegURL"; + /// <summary> - /// Produces file attribute of "image/*". + /// Initializes a new instance of the <see cref="ProducesPlaylistFileAttribute"/> class. /// </summary> - public sealed class ProducesPlaylistFileAttribute : ProducesFileAttribute + public ProducesPlaylistFileAttribute() + : base(ContentType) { - 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 index 6857d45ec..10dec0c00 100644 --- a/Jellyfin.Api/Attributes/ProducesVideoFileAttribute.cs +++ b/Jellyfin.Api/Attributes/ProducesVideoFileAttribute.cs @@ -1,18 +1,17 @@ -namespace Jellyfin.Api.Attributes +namespace Jellyfin.Api.Attributes; + +/// <summary> +/// Produces file attribute of "video/*". +/// </summary> +public sealed class ProducesVideoFileAttribute : ProducesFileAttribute { + private const string ContentType = "video/*"; + /// <summary> - /// Produces file attribute of "video/*". + /// Initializes a new instance of the <see cref="ProducesVideoFileAttribute"/> class. /// </summary> - public sealed class ProducesVideoFileAttribute : ProducesFileAttribute + public ProducesVideoFileAttribute() + : base(ContentType) { - private const string ContentType = "video/*"; - - /// <summary> - /// Initializes a new instance of the <see cref="ProducesVideoFileAttribute"/> class. - /// </summary> - public ProducesVideoFileAttribute() - : base(ContentType) - { - } } } |
