pub struct Trigger {Show 16 fields
pub trigger_id: TriggerId,
pub tenant_id: TenantId,
pub name: String,
pub description: Option<String>,
pub trigger_type: TriggerType,
pub status: TriggerStatus,
pub condition: TriggerCondition,
pub action: TriggerAction,
pub start_at: Option<DateTime<Utc>>,
pub end_at: Option<DateTime<Utc>>,
pub max_fires: Option<u32>,
pub fire_count: u32,
pub cooldown_ms: Option<u64>,
pub last_fired_at: Option<DateTime<Utc>>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
Trigger - Event-based callable invocation definition @see packages/enact-schemas/src/execution.schemas.ts - triggerSchema
Fields§
§trigger_id: TriggerIdUnique trigger identifier
tenant_id: TenantIdTenant that owns this trigger
name: StringHuman-readable name
description: Option<String>Optional description
trigger_type: TriggerTypeTrigger type
status: TriggerStatusCurrent status
condition: TriggerConditionCondition (when to fire)
action: TriggerActionAction (what to do when fired)
start_at: Option<DateTime<Utc>>When to start listening
end_at: Option<DateTime<Utc>>When to stop (expire)
max_fires: Option<u32>Max times to fire (None = unlimited)
fire_count: u32Times fired so far
cooldown_ms: Option<u64>Cooldown in milliseconds (prevent rapid re-firing)
last_fired_at: Option<DateTime<Utc>>Last time this trigger fired
created_at: DateTime<Utc>When the trigger was created
updated_at: DateTime<Utc>When the trigger was last updated
Implementations§
Source§impl Trigger
impl Trigger
Sourcepub fn new(
tenant_id: TenantId,
name: impl Into<String>,
trigger_type: TriggerType,
condition: TriggerCondition,
action: TriggerAction,
) -> Self
pub fn new( tenant_id: TenantId, name: impl Into<String>, trigger_type: TriggerType, condition: TriggerCondition, action: TriggerAction, ) -> Self
Create a new trigger
Sourcepub fn record_fire(&mut self)
pub fn record_fire(&mut self)
Record that the trigger fired
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Trigger
impl<'de> Deserialize<'de> for Trigger
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Trigger
impl RefUnwindSafe for Trigger
impl Send for Trigger
impl Sync for Trigger
impl Unpin for Trigger
impl UnsafeUnpin for Trigger
impl UnwindSafe for Trigger
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more