96bbcb9
//! hook Operation method trait for the module.
use crate::hook::types::{HookEvent, HookEventKind, HookResult, ScriptOutput};
/// hook Operation trait.
pub trait HookOps {
/// Run pre-receive validation (rejects on error).
fn hook_pre_receive(&self, event: &HookEvent) -> Result<HookResult, crate::Error>;
/// Run the post-receive event.
fn hook_post_receive(&self, event: &HookEvent) -> Result<HookResult, crate::Error>;
/// Emit an event (e.g. webhook delivery).
fn hook_emit(&self, event: &HookEvent) -> Result<(), crate::Error>;
/// Execute an external script.
fn hook_execute_script(
&self,
script: &str,
args: &[&str],
) -> Result<ScriptOutput, crate::Error>;
/// Check whether an event type is supported.
fn hook_supported(&self, kind: HookEventKind) -> bool;
}