namespace NpgsqlRest { public interface IEndpointCreateHandler { /// /// Before creating endpoints. /// /// current application builder /// current NpgsqlRest options void Setup(IApplicationBuilder builder, NpgsqlRestOptions options) { } /// /// Called by the core comment parser, within its single parse pass, for each comment line /// that core did NOT recognize as a built-in directive. Lets a plugin claim its own /// annotations (e.g. openapi …, mcp …) without a second pass over the comment. /// /// If this plugin owns the line, apply it (typically by storing into /// ) and return a with a /// short label — core logs it centrally (consistent with built-in annotation logging) and /// stops offering the line to other handlers. Return null if the line is not this /// plugin's annotation; it is then offered to the next handler, and finally surfaced via /// (prose) if no handler claims it. /// /// / are pre-tokenized by core (split /// on space/comma; the lower-cased variant for keyword matching) so handlers do not re-tokenize. /// /// Set to true when the annotation means the /// routine should be exposed as an endpoint (e.g. mcp) — under /// this lets a routine with no HTTP tag still be /// created. Leave it false for pure modifiers (e.g. openapi hide), which must NOT by /// themselves cause an endpoint to be created. /// /// CommentLineResult? HandleCommentLine(RoutineEndpoint endpoint, string line, string[] words, string[] wordsLower) => null; /// /// Annotation keywords (first word of a comment line, lower-case, without the optional @ /// prefix) for which this handler's returns /// = true (e.g. mcp, mcp_name). /// /// Used by endpoint sources that need a cheap, textual pre-check for exposure intent before the /// comment parser runs — e.g. the SQL file source skips files with no HTTP tag, but a file whose /// comment carries one of these keywords is an endpoint candidate (an MCP-only tool) and must /// not be skipped. Default: empty (this handler never requests endpoints). /// /// string[] EndpointRequestingAnnotations => []; /// /// After successful endpoint creation. /// void Handle(RoutineEndpoint endpoint) { } /// /// After all endpoints are created. /// void Cleanup(RoutineEndpoint[] endpoints) { } /// /// After all endpoints are created. /// void Cleanup() { } } /// /// Result of when a plugin claims a comment /// line. Label is a short description logged centrally by core (consistent with built-in /// annotation logging). RequestsEndpoint = true signals the routine should be created as an /// endpoint even without an HTTP tag (exposure intent); false = modifier only. /// public readonly record struct CommentLineResult(string Label, bool RequestsEndpoint = false); }