diff --git a/Activout.RestClient/DomainExceptions/DomainHttpErrorAttribute.cs b/Activout.RestClient/DomainExceptions/DomainHttpErrorAttribute.cs index 09c9db8..34bf3ae 100644 --- a/Activout.RestClient/DomainExceptions/DomainHttpErrorAttribute.cs +++ b/Activout.RestClient/DomainExceptions/DomainHttpErrorAttribute.cs @@ -1,19 +1,11 @@ -#nullable disable -using System; +using System; using System.Net; -namespace Activout.RestClient.DomainExceptions -{ - [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Method, AllowMultiple = true)] - public class DomainHttpErrorAttribute : Attribute - { - public HttpStatusCode HttpStatusCode { get; } - public object DomainErrorValue { get; } +namespace Activout.RestClient.DomainExceptions; - public DomainHttpErrorAttribute(HttpStatusCode httpStatusCode, object domainErrorValue) - { - HttpStatusCode = httpStatusCode; - DomainErrorValue = domainErrorValue; - } - } +[AttributeUsage(AttributeTargets.Interface | AttributeTargets.Method, AllowMultiple = true)] +public class DomainHttpErrorAttribute(HttpStatusCode httpStatusCode, object domainErrorValue) : Attribute +{ + public HttpStatusCode HttpStatusCode { get; } = httpStatusCode; + public object DomainErrorValue { get; } = domainErrorValue; } \ No newline at end of file diff --git a/Activout.RestClient/ErrorResponseAttribute.cs b/Activout.RestClient/ErrorResponseAttribute.cs index 8e81236..4a293cf 100644 --- a/Activout.RestClient/ErrorResponseAttribute.cs +++ b/Activout.RestClient/ErrorResponseAttribute.cs @@ -1,16 +1,9 @@ -#nullable disable using System; -namespace Activout.RestClient -{ - [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Method)] - public class ErrorResponseAttribute : Attribute - { - public ErrorResponseAttribute(Type type) - { - Type = type; - } +namespace Activout.RestClient; - public Type Type { get; } - } +[AttributeUsage(AttributeTargets.Interface | AttributeTargets.Method)] +public class ErrorResponseAttribute(Type type) : Attribute +{ + public Type Type { get; } = type; } \ No newline at end of file diff --git a/Activout.RestClient/FormParamAttribute.cs b/Activout.RestClient/FormParamAttribute.cs index a57c9fe..e561b38 100644 --- a/Activout.RestClient/FormParamAttribute.cs +++ b/Activout.RestClient/FormParamAttribute.cs @@ -1,13 +1,6 @@ -#nullable disable using System; -namespace Activout.RestClient -{ - [AttributeUsage(AttributeTargets.Parameter)] - public class FormParamAttribute : NamedParamAttribute - { - public FormParamAttribute(string name = null) : base(name) - { - } - } -} \ No newline at end of file +namespace Activout.RestClient; + +[AttributeUsage(AttributeTargets.Parameter)] +public class FormParamAttribute(string? name = null) : NamedParamAttribute(name); \ No newline at end of file diff --git a/Activout.RestClient/HeaderParamAttribute.cs b/Activout.RestClient/HeaderParamAttribute.cs index 42b5767..b20385d 100644 --- a/Activout.RestClient/HeaderParamAttribute.cs +++ b/Activout.RestClient/HeaderParamAttribute.cs @@ -1,16 +1,9 @@ -#nullable disable -using System; +using System; -namespace Activout.RestClient -{ - [AttributeUsage(AttributeTargets.Parameter)] - public class HeaderParamAttribute : NamedParamAttribute - { - public bool Replace { get; } +namespace Activout.RestClient; - public HeaderParamAttribute(string name = null, bool replace = true) : base(name) - { - Replace = replace; - } - } +[AttributeUsage(AttributeTargets.Parameter)] +public class HeaderParamAttribute(string? name = null, bool replace = true) : NamedParamAttribute(name) +{ + public bool Replace { get; } = replace; } \ No newline at end of file diff --git a/Activout.RestClient/HttpMethodAttribute.cs b/Activout.RestClient/HttpMethodAttribute.cs index 3965809..b970edb 100644 --- a/Activout.RestClient/HttpMethodAttribute.cs +++ b/Activout.RestClient/HttpMethodAttribute.cs @@ -1,54 +1,20 @@ -#nullable disable using System; using System.Net.Http; -namespace Activout.RestClient -{ - [AttributeUsage(AttributeTargets.Method)] - public abstract class HttpMethodAttribute : TemplateAttribute - { - public HttpMethod HttpMethod { get; } - - protected HttpMethodAttribute(HttpMethod httpMethod, string template) : base(template) - { - HttpMethod = httpMethod; - } - } +namespace Activout.RestClient; - public class DeleteAttribute : HttpMethodAttribute - { - public DeleteAttribute(string template = null) : base(HttpMethod.Delete, template) - { - } - } - - public class GetAttribute : HttpMethodAttribute - { - public GetAttribute(string template = null) : base(HttpMethod.Get, template) - { - } - } +[AttributeUsage(AttributeTargets.Method)] +public abstract class HttpMethodAttribute(HttpMethod httpMethod, string? template) : TemplateAttribute(template) +{ + public HttpMethod HttpMethod { get; } = httpMethod; +} +public class DeleteAttribute(string? template = null) : HttpMethodAttribute(HttpMethod.Delete, template); - public class PostAttribute : HttpMethodAttribute - { - public PostAttribute(string template = null) : base(HttpMethod.Post, template) - { - } - } +public class GetAttribute(string? template = null) : HttpMethodAttribute(HttpMethod.Get, template); +public class PostAttribute(string? template = null) : HttpMethodAttribute(HttpMethod.Post, template); - public class PutAttribute : HttpMethodAttribute - { - public PutAttribute(string template = null) : base(HttpMethod.Put, template) - { - } - } +public class PutAttribute(string? template = null) : HttpMethodAttribute(HttpMethod.Put, template); - public class PatchAttribute : HttpMethodAttribute - { - public PatchAttribute(string template = null) : base(HttpMethod.Patch, template) - { - } - } -} \ No newline at end of file +public class PatchAttribute(string? template = null) : HttpMethodAttribute(HttpMethod.Patch, template); \ No newline at end of file diff --git a/Activout.RestClient/NamedParamAttribute.cs b/Activout.RestClient/NamedParamAttribute.cs index 2b7c218..b6f963d 100644 --- a/Activout.RestClient/NamedParamAttribute.cs +++ b/Activout.RestClient/NamedParamAttribute.cs @@ -1,16 +1,9 @@ -#nullable disable using System; -namespace Activout.RestClient -{ - [AttributeUsage(AttributeTargets.Parameter)] - public abstract class NamedParamAttribute : Attribute - { - public string Name { get; } +namespace Activout.RestClient; - protected NamedParamAttribute(string name) - { - Name = name; - } - } +[AttributeUsage(AttributeTargets.Parameter)] +public abstract class NamedParamAttribute(string? name) : Attribute +{ + public string? Name { get; } = name; } \ No newline at end of file diff --git a/Activout.RestClient/PartParamAttribute.cs b/Activout.RestClient/PartParamAttribute.cs index 12b096e..274e359 100644 --- a/Activout.RestClient/PartParamAttribute.cs +++ b/Activout.RestClient/PartParamAttribute.cs @@ -1,18 +1,11 @@ -#nullable disable using System; -namespace Activout.RestClient -{ - [AttributeUsage(AttributeTargets.Parameter)] - public class PartParamAttribute : NamedParamAttribute - { - public string FileName { get; } - public MediaType ContentType { get; } +namespace Activout.RestClient; - public PartParamAttribute(string name = null, string fileName = null, string contentType = null) : base(name) - { - FileName = fileName; - ContentType = MediaType.ValueOf(contentType); - } - } +[AttributeUsage(AttributeTargets.Parameter)] +public class PartParamAttribute(string? name = null, string? fileName = null, string? contentType = null) + : NamedParamAttribute(name) +{ + public string? FileName { get; } = fileName; + public MediaType? ContentType { get; } = MediaType.ValueOf(contentType); } \ No newline at end of file diff --git a/Activout.RestClient/PathAttribute.cs b/Activout.RestClient/PathAttribute.cs index 8a45433..38c948c 100644 --- a/Activout.RestClient/PathAttribute.cs +++ b/Activout.RestClient/PathAttribute.cs @@ -1,13 +1,6 @@ -#nullable disable using System; -namespace Activout.RestClient -{ - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Interface)] - public class PathAttribute : TemplateAttribute - { - public PathAttribute(string template) : base(template) - { - } - } -} \ No newline at end of file +namespace Activout.RestClient; + +[AttributeUsage(AttributeTargets.Method | AttributeTargets.Interface)] +public class PathAttribute(string template) : TemplateAttribute(template); \ No newline at end of file diff --git a/Activout.RestClient/PathParamAttribute.cs b/Activout.RestClient/PathParamAttribute.cs index b0783f7..dd7d51d 100644 --- a/Activout.RestClient/PathParamAttribute.cs +++ b/Activout.RestClient/PathParamAttribute.cs @@ -1,10 +1,3 @@ -#nullable disable -namespace Activout.RestClient -{ - public class PathParamAttribute : NamedParamAttribute - { - public PathParamAttribute(string name = null) : base(name) - { - } - } -} \ No newline at end of file +namespace Activout.RestClient; + +public class PathParamAttribute(string? name = null) : NamedParamAttribute(name); \ No newline at end of file diff --git a/Activout.RestClient/QueryParamAttribute.cs b/Activout.RestClient/QueryParamAttribute.cs index 8e8d5ee..bfc0710 100644 --- a/Activout.RestClient/QueryParamAttribute.cs +++ b/Activout.RestClient/QueryParamAttribute.cs @@ -1,10 +1,3 @@ -#nullable disable -namespace Activout.RestClient -{ - public class QueryParamAttribute : NamedParamAttribute - { - public QueryParamAttribute(string name = null) : base(name) - { - } - } -} \ No newline at end of file +namespace Activout.RestClient; + +public class QueryParamAttribute(string? name = null) : NamedParamAttribute(name); \ No newline at end of file diff --git a/Activout.RestClient/RouteAttribute.cs b/Activout.RestClient/RouteAttribute.cs deleted file mode 100644 index 122f12f..0000000 --- a/Activout.RestClient/RouteAttribute.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace Activout.RestClient -{ - [Obsolete("Please use [Path] instead!")] - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Interface)] - public class RouteAttribute : PathAttribute - { - public RouteAttribute(string template) : base(template) - { - } - } -} \ No newline at end of file diff --git a/Activout.RestClient/RouteParamAttribute.cs b/Activout.RestClient/RouteParamAttribute.cs deleted file mode 100644 index 8bd428c..0000000 --- a/Activout.RestClient/RouteParamAttribute.cs +++ /dev/null @@ -1,13 +0,0 @@ -#nullable disable -using System; - -namespace Activout.RestClient -{ - [Obsolete("Please use [PathParam] instead!")] - public class RouteParamAttribute : PathParamAttribute - { - public RouteParamAttribute(string name = null) : base(name) - { - } - } -} \ No newline at end of file diff --git a/Activout.RestClient/TemplateAttribute.cs b/Activout.RestClient/TemplateAttribute.cs index df093a6..f5885b5 100644 --- a/Activout.RestClient/TemplateAttribute.cs +++ b/Activout.RestClient/TemplateAttribute.cs @@ -1,15 +1,8 @@ -#nullable disable using System; -namespace Activout.RestClient -{ - public abstract class TemplateAttribute : Attribute - { - protected TemplateAttribute(string template = null) - { - Template = template; - } +namespace Activout.RestClient; - public string Template { get; set; } - } +public abstract class TemplateAttribute(string? template = null) : Attribute +{ + public string? Template { get; } = template; } \ No newline at end of file