Table of Contents

Method EmitAsync

Namespace
BpNexT.Actions.Abstractions
Assembly
BpNexT.Actions.Abstractions.dll

EmitAsync(IWebhookEvent, CancellationToken)

Emits one occurrence of an event: the payload is wrapped in the delivery envelope (id, module, event, timestamp, data), signed, and queued to every webhook an administrator subscribed to the event. Returns how many deliveries were queued — zero simply means nobody subscribed yet. The event name comes from the payload type's WebhookEventAttribute, so it cannot be misspelled.

Task<int> EmitAsync(IWebhookEvent payload, CancellationToken cancellationToken = default)

Parameters

payload IWebhookEvent
cancellationToken CancellationToken

Returns

Task<int>

EmitAsync(string, object, CancellationToken)

String-named variant of EmitAsync(IWebhookEvent, CancellationToken) for events declared with WebhookEventAttribute on the module class.

Task<int> EmitAsync(string eventName, object payload, CancellationToken cancellationToken = default)

Parameters

eventName string
payload object
cancellationToken CancellationToken

Returns

Task<int>

Exceptions

InvalidOperationException

The event is not declared.