Skip to content

calternal_api::events

Draft webhook contracts from the shared action registry (DESIGN §55).

Versioned MCP webhook event contracts (#491, DESIGN §55). Payloads use explicit allowlists. Mail content never includes a body or snippet; Money amounts are integer minor units. The authenticated producer supplies the User ID separately, so payloads cannot choose a recipient.

Source: crates/calternal-api/src/events.rs

pub struct EventDefinition

Registry declaration of a supported webhook event and its filter fields.

Fields

  • pub name: String
  • pub description: String
  • pub plugin: String
  • pub filters: Vec<String>
  • pub fields: Vec<String>

Implements: Debug, Clone, Deserialize, Serialize

pub fn descriptor(&self) -> Value

Build draft descriptors from registry declarations, never a second list.

pub fn valid_arguments(&self, arguments: &Value) -> bool

Reject undeclared filters and unbounded strings before any outbound work.

pub fn payload(&self, data: &Value, arguments: &Value) -> Option<Value>

Project trusted producer data to the declared fields; match exact filters. Numeric Money amounts stay exact. Unknown and nested values never leave.

Source: crates/calternal-api/src/events.rs:11

pub fn registry() -> Vec<&'static EventDefinition>

Deduplicate declarations while retaining the action registry as the source.

Source: crates/calternal-api/src/events.rs:94