namespace OwnChar.ServerNew.Api.Endpoint; internal class ApiBuilder(WebApplication app) : IApiBuilder { public void Map(string method, string pattern, Delegate action) { if (method == ApiRequestMethods.Get) app.MapGet(pattern, action); else if (method == ApiRequestMethods.Post) app.MapPost(pattern, action); else if (method == ApiRequestMethods.Put) app.MapPut(pattern, action); else if (method == ApiRequestMethods.Patch) app.MapPatch(pattern, action); else if (method == ApiRequestMethods.Delete) app.MapDelete(pattern, action); else throw new NotSupportedException(); } public void Map(string pattern, Delegate action) { app.Map(pattern, action); } }