From 1634b4b7b15659263463f3fb370be032cec6e2da Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 15 Dec 2025 11:40:44 +0100 Subject: [PATCH] Add RestType enum and extension methods for HTTP verbs Introduced RestType enum in ReC.Domain.Constants to represent HTTP methods, including support for None and Invalid values. Added RestTypeExtensions with ToHttpMethod and IsValid methods to facilitate HTTP method handling and validation. --- src/ReC.Domain/Constants/RestType.cs | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/ReC.Domain/Constants/RestType.cs diff --git a/src/ReC.Domain/Constants/RestType.cs b/src/ReC.Domain/Constants/RestType.cs new file mode 100644 index 0000000..66ee1db --- /dev/null +++ b/src/ReC.Domain/Constants/RestType.cs @@ -0,0 +1,29 @@ +namespace ReC.Domain.Constants; + +public enum RestType +{ + None = 0, + Get = 1, + Post = 2, + Put = 3, + Patch = 4, + Delete = 5, + Head = 6, + Options = 7, + Connect = 8, + Trace = 9, + Invalid = -1, +} + +public static class RestTypeExtensions +{ + public static string ToHttpMethod(this RestType restType) + { + return restType.ToString().ToUpper(); + } + + public static bool IsValid(this RestType restType) + { + return restType != RestType.Invalid && restType != RestType.None; + } +} \ No newline at end of file