IWebhookStore
AgentPrism.Abstractions.dllThe store for webhook subscriptions and delivery history.
public interface IWebhookStoreMethods
Section titled “Methods”CreateDeliveryAsync(WebhookDelivery, CancellationToken)
Section titled “ CreateDeliveryAsync(WebhookDelivery, CancellationToken)”Creates a delivery record.
ValueTask<WebhookDelivery> CreateDeliveryAsync(WebhookDelivery delivery, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”delivery WebhookDelivery
The delivery.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”The created record.
DeleteSubscriptionAsync(string, string, CancellationToken)
Section titled “ DeleteSubscriptionAsync(string, string, CancellationToken)”Deletes a subscription and its delivery history.
ValueTask<bool> DeleteSubscriptionAsync(string tenantId, string name, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”tenantId string
The tenant identifier.
name string
The subscription name.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”true if the delete happened.
FindForEventAsync(string, string, CancellationToken)
Section titled “ FindForEventAsync(string, string, CancellationToken)”Fetches all enabled subscriptions subscribed to a specific event.
ValueTask<IReadOnlyList<WebhookSubscription>> FindForEventAsync(string tenantId, string eventType, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”tenantId string
The tenant identifier.
eventType string
The event name.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<IReadOnlyList<WebhookSubscription>>
The matching subscriptions. An empty list if none.
GetDeliveryAsync(Guid, CancellationToken)
Section titled “ GetDeliveryAsync(Guid, CancellationToken)”Fetches a single delivery record.
ValueTask<WebhookDelivery?> GetDeliveryAsync(Guid deliveryId, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”deliveryId Guid
The delivery identifier.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”The record; null if it does not exist.
GetSubscriptionAsync(string, string, CancellationToken)
Section titled “ GetSubscriptionAsync(string, string, CancellationToken)”Fetches a single subscription by name.
ValueTask<WebhookSubscription?> GetSubscriptionAsync(string tenantId, string name, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”tenantId string
The tenant identifier.
name string
The subscription name.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<WebhookSubscription?>
The subscription; null if it does not exist.
ListSubscriptionsAsync(string, CancellationToken)
Section titled “ ListSubscriptionsAsync(string, CancellationToken)”Lists a tenant’s subscriptions.
ValueTask<IReadOnlyList<WebhookSubscription>> ListSubscriptionsAsync(string tenantId, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”tenantId string
The tenant identifier.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<IReadOnlyList<WebhookSubscription>>
The subscriptions.
QueryDeliveriesAsync(WebhookDeliveryQuery, CancellationToken)
Section titled “ QueryDeliveriesAsync(WebhookDeliveryQuery, CancellationToken)”Lists delivery history. The newest record is returned first.
ValueTask<IReadOnlyList<WebhookDelivery>> QueryDeliveriesAsync(WebhookDeliveryQuery query, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”query WebhookDeliveryQuery
The filter.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<IReadOnlyList<WebhookDelivery>>
The records.
RecordDeliveryResultAsync(WebhookDeliveryResult, CancellationToken)
Section titled “ RecordDeliveryResultAsync(WebhookDeliveryResult, CancellationToken)”Writes a delivery attempt’s result.
ValueTask RecordDeliveryResultAsync(WebhookDeliveryResult result, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”result WebhookDeliveryResult
The result.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”The completion task.
RecordSubscriptionOutcomeAsync(Guid, bool, int, DateTimeOffset, CancellationToken)
Section titled “ RecordSubscriptionOutcomeAsync(Guid, bool, int, DateTimeOffset, CancellationToken)”Updates a subscription’s consecutive-failure counter, and disables the subscription if the threshold is exceeded.
ValueTask<bool> RecordSubscriptionOutcomeAsync(Guid subscriptionId, bool succeeded, int disableThreshold, DateTimeOffset updatedAt, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”subscriptionId Guid
The subscription identifier.
succeeded bool
Whether the most recent delivery succeeded.
disableThreshold int
The subscription is disabled after this many consecutive failures.
updatedAt DateTimeOffset
The update time (UTC).
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”true if the subscription was disabled during this call.
SaveSubscriptionAsync(WebhookSubscription, CancellationToken)
Section titled “ SaveSubscriptionAsync(WebhookSubscription, CancellationToken)”Creates or updates a subscription.
ValueTask<WebhookSubscription> SaveSubscriptionAsync(WebhookSubscription subscription, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”subscription WebhookSubscription
The subscription.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<WebhookSubscription>
The saved subscription.