pub struct ApprovalEngine { /* private fields */ }Expand description
Approval gate engine — rich approval workflow with escalation.
Implementations§
Source§impl ApprovalEngine
impl ApprovalEngine
pub fn new() -> Self
Sourcepub fn define_gate(&mut self, gate: ApprovalGate) -> WorkflowResult<()>
pub fn define_gate(&mut self, gate: ApprovalGate) -> WorkflowResult<()>
Define an approval gate.
Sourcepub fn request_approval(
&mut self,
gate_id: &str,
execution_id: &str,
step_id: &str,
context: Value,
) -> WorkflowResult<String>
pub fn request_approval( &mut self, gate_id: &str, execution_id: &str, step_id: &str, context: Value, ) -> WorkflowResult<String>
Request approval — creates a pending approval.
Sourcepub fn decide(
&mut self,
pending_id: &str,
decision: ApprovalDecision,
decided_by: &str,
reason: Option<String>,
) -> WorkflowResult<ApprovalReceipt>
pub fn decide( &mut self, pending_id: &str, decision: ApprovalDecision, decided_by: &str, reason: Option<String>, ) -> WorkflowResult<ApprovalReceipt>
Decide on a pending approval.
Sourcepub fn list_pending(&self) -> Vec<(&str, &PendingApproval)>
pub fn list_pending(&self) -> Vec<(&str, &PendingApproval)>
List pending approvals.
Sourcepub fn get_receipts(&self, gate_id: Option<&str>) -> Vec<&ApprovalReceipt>
pub fn get_receipts(&self, gate_id: Option<&str>) -> Vec<&ApprovalReceipt>
Get approval audit trail.
Sourcepub fn escalate(&mut self, pending_id: &str) -> WorkflowResult<()>
pub fn escalate(&mut self, pending_id: &str) -> WorkflowResult<()>
Escalate a pending approval to the next approver in the chain.
Sourcepub fn get_gate(&self, gate_id: &str) -> Option<&ApprovalGate>
pub fn get_gate(&self, gate_id: &str) -> Option<&ApprovalGate>
Get a gate definition.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ApprovalEngine
impl RefUnwindSafe for ApprovalEngine
impl Send for ApprovalEngine
impl Sync for ApprovalEngine
impl Unpin for ApprovalEngine
impl UnsafeUnpin for ApprovalEngine
impl UnwindSafe for ApprovalEngine
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