using System.Net; using System.Reflection; namespace SimpleHttpServer.Types; internal readonly struct EndpointInvocationInfo { internal record struct QueryParameterInfo(string Name, Type Type, bool IsOptional); internal readonly MethodInfo methodInfo; internal readonly List queryParameters; internal readonly BaseEndpointCheckAttribute[] requiredChecks; public EndpointInvocationInfo(MethodInfo methodInfo, List queryParameters, BaseEndpointCheckAttribute[] requiredChecks) { this.methodInfo = methodInfo ?? throw new ArgumentNullException(nameof(methodInfo)); this.queryParameters = queryParameters ?? throw new ArgumentNullException(nameof(queryParameters)); this.requiredChecks = requiredChecks; } public readonly bool CheckAll(HttpListenerRequest req) => requiredChecks.All(x => x.Check(req)); }