Class RDWebEndpoint
- Namespace
- RDCore.Web.Endpoints
- Assembly
- RDCore.Web.dll
An endpoint of an RD-VBA application: the procedure of a controller module that serves an HTTP method on a route.
public sealed record RDWebEndpoint : IEquatable<RDWebEndpoint>
- Inheritance
-
RDWebEndpoint
- Implements
- Inherited Members
Properties
BodyParameter
The parameter the request's JSON body binds to: for a POST, the one '@FromBody names, else the first parameter the route does not
bind. null for a GET, and for a POST whose parameters the route binds all of.
public string? BodyParameter { get; }
Property Value
ContextParameters
The parameters declared As RDWeb.RequestContext, which are given the request's context, in the order Parameters declares them.
Neither the route, the query string nor the body binds them.
public ImmutableArray<string> ContextParameters { get; }
Property Value
ControllerDescription
The controller module's description: the text of its '@ModuleDescription annotation or of its VB_Description attribute
(GetModuleDescription(ModuleParseResult)); null for a module that has none.
public string? ControllerDescription { get; init; }
Property Value
Description
The procedure's description: the text of its '@Description annotation or of its VB_Description attribute
(GetMemberDescription(ModuleParseResult, string)); null for a procedure that has none.
public string? Description { get; init; }
Property Value
HttpMethod
The HTTP method the endpoint serves: GET or POST.
public string HttpMethod { get; }
Property Value
KeptMachineKey
The route parameter whose value is the key of the machine a request runs on, as the controller's '@KeptMachine names it;
null for an endpoint whose requests run on a machine of the pool.
public string? KeptMachineKey { get; }
Property Value
MakesMachine
Whether a request to the endpoint makes the machine of its key before the procedure runs ('@NewMachine).
public bool MakesMachine { get; }
Property Value
ModuleName
The name of the controller module.
public string ModuleName { get; }
Property Value
Parameters
The names of the procedure's parameters, in the order it declares them.
public ImmutableArray<string> Parameters { get; }
Property Value
ProcedureName
The name of the procedure that serves the endpoint.
public string ProcedureName { get; }
Property Value
ReturnsResult
Whether the procedure is a Function declared As RDWeb.Result, whose status and body are the response's when the request is
dispatched; any other value is a 200's body.
public bool ReturnsResult { get; init; }
Property Value
ReturnsValue
Whether the procedure is a Function, whose value is the response's body; a Sub's request is answered 204.
public bool ReturnsValue { get; }
Property Value
Route
The endpoint's route template, from the root of the application: /orders/{id}.
public string Route { get; }
Property Value
RouteParameters
The parameters the route binds, each by the name of a route parameter, in the order Parameters declares them.
public ImmutableArray<string> RouteParameters { get; }
Property Value
Methods
ConventionalRouteOf(string)
The route of a controller whose '@Controller annotation writes none: its module's name, less a Controller suffix, as ASP.NET Core
names a controller. ThingsController is routed under Things, which a request for /things matches, since routes match without
regard to case.
public static string ConventionalRouteOf(string moduleName)
Parameters
moduleNamestringThe name of the controller module.
Returns
- string
The name less its last ten letters when it ends with
Controller, in any case, and has letters before it; the name as written otherwise.
FromAnnotation(string, string?, string, IReadOnlyList<string>, string, string?, string?, string?, bool, IReadOnlyList<string>?, bool)
The endpoint a member annotation of a controller module declares.
public static RDWebEndpoint? FromAnnotation(string moduleName, string? controllerRoute, string procedureName, IReadOnlyList<string> parameters, string annotationName, string? route, string? bodyParameter = null, string? keptMachineKey = null, bool makesMachine = false, IReadOnlyList<string>? contextParameters = null, bool returnsValue = true)
Parameters
moduleNamestringThe name of the controller module.
controllerRoutestringThe argument of the module's
'@Controllerannotation; null when it writes none, which routes the controller under its conventional route (ConventionalRouteOf(string)).procedureNamestringThe name of the annotated procedure.
parametersIReadOnlyList<string>The names of the procedure's parameters, in the order it declares them.
annotationNamestringThe name of the member annotation.
routestringThe argument of the member annotation; null when it writes none, which serves the procedure on the controller's route. A route that starts with
/or~/is from the root of the application, and the controller's route does not prefix it.bodyParameterstringThe argument of the procedure's
'@FromBodyannotation: the parameter the body of aPOSTbinds to, matched in any case, as VBA matches names. null when the procedure has none, which binds the body to the first parameter the route does not bind. AGEThas no body, and binds none.keptMachineKeystringThe argument of the controller's
'@KeptMachineannotation: the route parameter whose value is the key of the machine a request runs on, matched in any case. It need not be a parameter of the procedure. null for a controller without one, whose requests run on a machine of the pool.makesMachineboolWhether the procedure has a
'@NewMachineannotation: a request makes the machine of its key.contextParametersIReadOnlyList<string>The parameters declared
As RDWeb.RequestContext(ContextParameters), which the route, the query and the body do not bind; none when it is null.returnsValueboolWhether the procedure is a
Function(ReturnsValue).
Returns
- RDWebEndpoint
The endpoint; null when the annotation is not one of an HTTP method (HttpMethodOf(string)).
Exceptions
- RDWebEndpointException
The route is not a valid route template, or it names a route parameter that is neither a parameter of the procedure nor the machine's key; for a
POST,bodyParameteris not a parameter of the procedure, or is one the route binds;keptMachineKeyis not a parameter of the route; ormakesMachineis true andkeptMachineKeyis null.