Table of Contents

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, with HTTP 409, by the session-scoped surface (SessionShellController): on the no-active-session boundary (via RequireActiveSessionAttribute), and when one of its session calls is refused while the player is running or paused (ResetRuntime–Busy, EndSession–Busy, BeginSession–Busy) or another thread plays (ResetRuntime–BusyAnotherThread, EndSession–BusyAnotherThread), or when its player reset is refused while another thread than the player's plays (Reset–Busy), and on 200 by its RecomputeStepPhysics, whose per-call collector it flattens. 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, with HTTP 409, by the session-scoped surface (SessionShellController): on the no-active-session boundary (via RequireActiveSessionAttribute), and when one of its session calls is refused while the player is running or paused (ResetRuntime–Busy, EndSession–Busy, BeginSession–Busy) or another thread plays (ResetRuntime–BusyAnotherThread, EndSession–BusyAnotherThread), or when its player reset is refused while another thread than the player's plays (Reset–Busy), and on 200 by its RecomputeStepPhysics, whose per-call collector it flattens. 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

Success bool

False when any reported message is an error; true otherwise.

Messages IReadOnlyList<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

IReadOnlyList<MessageDto>

Success

False when any reported message is an error; true otherwise.

public bool Success { get; init; }

Property Value

bool

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

collector MessageCollector

The per-call sink whose messages to flatten.

success bool?

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.