From d2006b52e16b63c35f3193369dd0d8c34c625ecb Mon Sep 17 00:00:00 2001 From: ig Date: Fri, 24 Feb 2023 12:57:51 +0100 Subject: [PATCH] add ReturnsAttribute to make annotating API more convenient --- .../Backend/Controllers/ReturnsAttribute.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 csharp/app/Backend/Controllers/ReturnsAttribute.cs diff --git a/csharp/app/Backend/Controllers/ReturnsAttribute.cs b/csharp/app/Backend/Controllers/ReturnsAttribute.cs new file mode 100644 index 000000000..6d94088f5 --- /dev/null +++ b/csharp/app/Backend/Controllers/ReturnsAttribute.cs @@ -0,0 +1,22 @@ +using System.Net; +using Microsoft.AspNetCore.Mvc; + +namespace Innovenergy.Backend.Controllers; + +public class ReturnsAttribute : ProducesResponseTypeAttribute +{ + public ReturnsAttribute(HttpStatusCode statusCode) : base((Int32)statusCode) + { + } +} + +public class ReturnsAttribute : ProducesResponseTypeAttribute +{ + public ReturnsAttribute(HttpStatusCode statusCode) : base(typeof(T), (Int32)statusCode) + { + } + + public ReturnsAttribute() : base(typeof(T), (Int32)HttpStatusCode.OK) + { + } +} \ No newline at end of file