Skip to content

Trigger Contracts

Assembly: Trigger.Contracts

Namespace: Trigger.Contracts

HttpTriggerDispatcher

HTTP-based implementation of Trigger.Contracts.ITriggerDispatcher that posts JSON payloads to Python and C# trigger endpoints using a shared Trigger.Contracts.HttpTriggerDispatcher.HttpClient instance.

Remarks

Dispatch calls run in a fire-and-forget manner to keep UI threads responsive. Hosting applications are responsible for surfacing failures via their own logging layers when an exception is thrown during dispatch. Supply the optional failure callback via the constructor to bridge errors into SmrtHub.Logging without creating a hard dependency from the contracts assembly.

Methods

Dispatch(string hotkey)

Dispatches the specified hotkey to the appropriate HTTP endpoint.

Parameters

  • hotkey — Logical hotkey identifier.

Remarks

Dispatch is asynchronous and intentionally fire-and-forget; awaiting is not supported by the current contract. Configure the failure callback in the constructor if dispatch errors need to be forwarded to logging or telemetry.

HttpTriggerDispatcher(string endpointUrl, Action onDispatchFailure)

Creates a new HTTP trigger dispatcher.

Parameters

  • endpointUrl — Trigger endpoint URL.
  • onDispatchFailure — Optional handler invoked when an exception occurs during dispatch.

ITriggerDispatcher

Contract for dispatching hotkey-triggered actions to the appropriate backend.

Remarks

Implementations should remain lightweight and avoid blocking UI threads; fire-and-forget patterns are acceptable when dispatch failures are logged by the hosting application.

Methods

Dispatch(string hotkey)

Dispatches a hotkey to the configured trigger endpoint.

Parameters

  • hotkey — A logical hotkey identifier (e.g., "HOTKEY_SMRTSAVE").

Exceptions

  • System.ArgumentException — Thrown when hotkey is null, empty, or whitespace.