API reference — HTTP & web

Nuvora.Nexus.Relay.Http

First-class HTTP endpoint model for Nuvora Nexus Relay (attribute-driven MapRelayEndpoints + OpenAPI)

dotnet add package Nuvora.Nexus.Relay.Http

Nuvora.Nexus.Relay.Http.Attributes

RelayBindingSourceAttribute

public abstract class RelayBindingSourceAttribute : Attribute

Binding source for a message property. These are deliberately MVC-free markers (no dependency on Microsoft.AspNetCore.Mvc) so command/query types in the Application/Core layers can carry them without taking a web dependency. When absent, the binder applies a deterministic default: a property whose name matches a route token binds from the route, otherwise GET/DELETE bind from the query string and POST/PUT/PATCH bind from the request body.

Properties

string? Name { get; }

Optional source key; defaults to the property name when null.

RelayCursorPaginationAttribute

public sealed class RelayCursorPaginationAttribute : Attribute

Marks a query as cursor-based paginated: the endpoint binds cursor and limit from the query string into the message and documents them in OpenAPI. The handler is expected to return a CursorBasedResult<T> (or a PagedResult<T> carrying a cursor).

Properties

string CursorProperty { get; set; }

Property the cursor binds into (default Cursor).

string LimitProperty { get; set; }

Property the page limit binds into (default Limit).

RelayFromBodyAttribute

public sealed class RelayFromBodyAttribute : RelayBindingSourceAttribute

Binds the property from the JSON request body. When any property is explicitly RelayFromBodyAttribute, only those properties are read from the body; otherwise the whole message is deserialized from the body for body verbs (POST/PUT/PATCH).

Constructors

RelayFromBodyAttribute(string? name = null)

Binds the property from the JSON request body. When any property is explicitly RelayFromBodyAttribute, only those properties are read from the body; otherwise the whole message is deserialized from the body for body verbs (POST/PUT/PATCH).

RelayFromHeaderAttribute

public sealed class RelayFromHeaderAttribute : RelayBindingSourceAttribute

Binds the property from a request header.

Constructors

RelayFromHeaderAttribute(string? name = null)

Binds the property from a request header.

RelayFromQueryAttribute

public sealed class RelayFromQueryAttribute : RelayBindingSourceAttribute

Binds the property from the query string.

Constructors

RelayFromQueryAttribute(string? name = null)

Binds the property from the query string.

RelayFromRouteAttribute

public sealed class RelayFromRouteAttribute : RelayBindingSourceAttribute

Binds the property from a route token.

Constructors

RelayFromRouteAttribute(string? name = null)

Binds the property from a route token.

RelayHttpDeleteAttribute

public sealed class RelayHttpDeleteAttribute : RelayHttpMethodAttribute

Maps the message to an HTTP DELETE endpoint.

Constructors

RelayHttpDeleteAttribute(string template)

Maps the message to an HTTP DELETE endpoint.

RelayHttpGetAttribute

public sealed class RelayHttpGetAttribute : RelayHttpMethodAttribute

Maps the message to an HTTP GET endpoint.

Constructors

RelayHttpGetAttribute(string template)

Maps the message to an HTTP GET endpoint.

RelayHttpMethodAttribute

public abstract class RelayHttpMethodAttribute : Attribute

Marks a command or query as a first-class HTTP endpoint. Apply a concrete subclass (RelayHttpGetAttribute, RelayHttpPostAttribute, …) to the message type; MapRelayEndpoints() discovers it via the command/query registries and maps a Minimal-API endpoint that binds the request to the message, dispatches it through the bus, and maps the result.

Constructors

RelayHttpMethodAttribute(string httpMethod, string template)

Properties

string HttpMethod { get; }

The HTTP method (verb) the endpoint responds to.

string Template { get; }

The route template (may contain {tokens} bound from the message’s properties).

string? Name { get; set; }

Optional endpoint name (OpenAPI operationId); defaults to the message type name.

string? Summary { get; set; }

Optional one-line summary surfaced in OpenAPI.

RelayHttpPatchAttribute

public sealed class RelayHttpPatchAttribute : RelayHttpMethodAttribute

Maps the message to an HTTP PATCH endpoint.

Constructors

RelayHttpPatchAttribute(string template)

Maps the message to an HTTP PATCH endpoint.

RelayHttpPostAttribute

public sealed class RelayHttpPostAttribute : RelayHttpMethodAttribute

Maps the message to an HTTP POST endpoint.

Constructors

RelayHttpPostAttribute(string template)

Maps the message to an HTTP POST endpoint.

RelayHttpPutAttribute

public sealed class RelayHttpPutAttribute : RelayHttpMethodAttribute

Maps the message to an HTTP PUT endpoint.

Constructors

RelayHttpPutAttribute(string template)

Maps the message to an HTTP PUT endpoint.

RelayHttpTagAttribute

public sealed class RelayHttpTagAttribute : Attribute

Sets the OpenAPI tag(s) for the endpoint. When absent, the tag defaults to the last segment of the message’s namespace.

Constructors

RelayHttpTagAttribute(params string[] tags)

Sets the OpenAPI tag(s) for the endpoint. When absent, the tag defaults to the last segment of the message’s namespace.

Properties

IReadOnlyList<string> Tags { get; }

The tag names applied to the endpoint.

RelayPaginationAttribute

public sealed class RelayPaginationAttribute : Attribute

Marks a query as page-based paginated: the endpoint binds page and pageSize from the query string into the message (clamped via the Relay pagination rules) and documents them in OpenAPI. The query handler is expected to return a PagedResult<T>.

Properties

string PageProperty { get; set; }

Property the current page binds into (default Page).

string PageSizeProperty { get; set; }

Property the page size binds into (default PageSize).

Nuvora.Nexus.Relay.Http.Mapping

RelayEndpointMapper

public static class RelayEndpointMapper

Discovers HTTP-attributed commands/queries from the Relay registries and maps a Minimal-API endpoint for each: it binds the request to the message, dispatches through the command/query bus, and maps the result to an IResult. Auth, tenancy, validation and caching enforce at dispatch via the existing pipeline behaviors, so endpoints inherit them for free.

Methods

static IEndpointRouteBuilder MapRelayEndpoints(this IEndpointRouteBuilder endpoints, Action<RelayEndpointOptions>? configure = null)

Maps every command/query carrying a RelayHttpMethodAttribute as an HTTP endpoint.

RelayEndpointOptions

public sealed class RelayEndpointOptions

Options for MapRelayEndpoints().

Properties

bool HandleExceptionsInline { get; set; }

When true, the endpoint catches exceptions and writes an RFC-7807 ProblemDetails response using the registered IExceptionMapper. Default false: exceptions propagate to the GlobalExceptionHandlerMiddleware (UseRelayExceptionHandling()), which is the recommended setup so every code path — endpoints, controllers, middleware — produces identical problem responses. Enable this only for hosts that do not use the middleware.

string? RoutePrefix { get; set; }

Optional route prefix prepended to every mapped endpoint’s template (e.g. /api). The prefix and the per-message template are joined with a single slash.

Nuvora.Nexus.Relay.Http.OpenApi

RelayOpenApiExtensions

public static class RelayOpenApiExtensions

OpenAPI configuration helpers for the Relay HTTP endpoint model.

Methods

static OpenApiOptions AddRelayEndpoints(this OpenApiOptions options)

Enriches the generated OpenAPI document with the route/query/header parameters bound by MapRelayEndpoints(). Call inside AddOpenApi: builder.Services.AddOpenApi(o => o.AddRelayEndpoints());