Class ApiActionResult
- Namespace
- Hi.MachiningProcs
- Assembly
- HiNc.dll
The shared outcome envelope for a web-API action: whether it succeeded and the messages it reported, in order. Returned by the project-level surface (LocalProjectServiceController) and, on the no-active-session boundary, by the session-scoped surface (SessionShellController via RequireActiveSessionAttribute). A REST / AI caller therefore reads the progress / success / error notifications inline in the HTTP response instead of only out-of-band via the SignalR sinks, and can branch on Success without parsing severities.
public record ApiActionResult : IEquatable<ApiActionResult>
- Inheritance
-
ApiActionResult
- Implements
- Inherited Members
- Extension Methods
Constructors
ApiActionResult(bool, IReadOnlyList<MessageDto>)
The shared outcome envelope for a web-API action: whether it succeeded and the messages it reported, in order. Returned by the project-level surface (LocalProjectServiceController) and, on the no-active-session boundary, by the session-scoped surface (SessionShellController via RequireActiveSessionAttribute). A REST / AI caller therefore reads the progress / success / error notifications inline in the HTTP response instead of only out-of-band via the SignalR sinks, and can branch on Success without parsing severities.
public ApiActionResult(bool Success, IReadOnlyList<MessageDto> Messages)
Parameters
SuccessboolFalse when any reported message is an error; true otherwise.
MessagesIReadOnlyList<MessageDto>The messages reported during the call, in arrival order.
Properties
Messages
The messages reported during the call, in arrival order.
public IReadOnlyList<MessageDto> Messages { get; init; }
Property Value
Success
False when any reported message is an error; true otherwise.
public bool Success { get; init; }
Property Value
Methods
FromCollector(MessageCollector, bool?)
Builds a result from a per-call MessageCollector. Success is inferred as
“no error-severity message was reported” unless success overrides it.
public static ApiActionResult FromCollector(MessageCollector collector, bool? success = null)
Parameters
collectorMessageCollectorThe per-call sink whose messages to flatten.
successbool?Explicit success flag, or null to infer from the messages.
Returns
- ApiActionResult
The outcome envelope.
NoActiveSession()
The canonical “no active session” result: a single configuration error telling the caller to start a session first. Returned (with HTTP 409) by RequireActiveSessionAttribute when a session-scoped endpoint is invoked outside a session.
public static ApiActionResult NoActiveSession()
Returns
- ApiActionResult
An unsuccessful envelope carrying the guidance message.
NoProjectLoaded()
The canonical “no project loaded” result: a single configuration error telling the caller to create or load a project first. Returned (with HTTP 409) by RequireLoadedProjectAttribute when a project-level endpoint is invoked before any project is open.
public static ApiActionResult NoProjectLoaded()
Returns
- ApiActionResult
An unsuccessful envelope carrying the guidance message.