MentorEndpointActionExtensions class
Story 1287 — an endpoint of the application as an action of the coordinator, without writing it again:
On this page
app.MapPost("/orders/{id}/cancel", CancelOrder)
.WithName("CancelOrder")
.WithMentorAction(a => a.Describe("Cancels an order").RequireRoles("Manager"));The action runs the endpoint itself, in the process, as the user of the turn: its authorization first, then its filters, its binding and its validation. A controller's action is declared with [MentorAction] on its method. Needs AddMentorAgentServer().
Definition
Section titled “Definition”Namespace: Novior.MentorAgent.Server.Extensions. Package: Novior.MentorAgent.Server.
public static class MentorEndpointActionExtensions
dotnet add package Novior.MentorAgent.ServerMethods
Section titled “Methods”WithMentorAction
Section titled “WithMentorAction”public static TBuilder WithMentorAction<TBuilder>(this TBuilder builder, Action<MentorActionBuilder> configure)
Declares the endpoint as an action of the coordinator, named after the endpoint's name (WithName) or its handler's method, in snake_case. A lambda without WithName needs MentorEndpointActionExtensions.WithMentorAction.
public static TBuilder WithMentorAction<TBuilder>(this TBuilder builder, string name, Action<MentorActionBuilder> configure)
Declares the endpoint as an action of the coordinator named name, as a model's tool name: letters, digits, _ and -, up to 64.
