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 InternalEndpointCheckAttribute[] requiredChecks; /// /// a reference to the object in which this method is defined (or null if the class is static) /// internal readonly object? typeInstanceReference; public EndpointInvocationInfo(MethodInfo methodInfo, List queryParameters, InternalEndpointCheckAttribute[] requiredChecks, object? typeInstanceReference) { this.methodInfo = methodInfo ?? throw new ArgumentNullException(nameof(methodInfo)); this.queryParameters = queryParameters ?? throw new ArgumentNullException(nameof(queryParameters)); this.requiredChecks = requiredChecks; this.typeInstanceReference = typeInstanceReference; } public readonly bool CheckAll(HttpListenerRequest req) => requiredChecks.All(x => x.Check(req)); }