pub struct HookMetadata {
pub kind: String,
pub subject: Option<String>,
pub callback: Option<HookCallbackRoute>,
pub labels: BTreeMap<String, String>,
pub data: BTreeMap<String, JsonValue>,
}Expand description
Typed helper for common hook metadata fields.
Hook metadata is still persisted as JSON in flow.hook.created events. This
type only gives Rust workflow authors a stable shape for audit and callback
routing fields.
Fields§
§kind: String§subject: Option<String>§callback: Option<HookCallbackRoute>§labels: BTreeMap<String, String>§data: BTreeMap<String, JsonValue>Implementations§
Source§impl HookMetadata
impl HookMetadata
pub fn new(kind: impl Into<String>) -> Self
pub fn human_approval(subject: impl Into<String>) -> Self
pub fn with_subject(self, subject: impl Into<String>) -> Self
pub fn with_callback_route(self, callback: HookCallbackRoute) -> Self
pub fn with_label( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
pub fn with_data( self, key: impl Into<String>, value: impl Into<JsonValue>, ) -> Self
pub fn into_json(self) -> Result<JsonValue>
Trait Implementations§
Source§impl Clone for HookMetadata
impl Clone for HookMetadata
Source§fn clone(&self) -> HookMetadata
fn clone(&self) -> HookMetadata
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HookMetadata
impl Debug for HookMetadata
Source§impl<'de> Deserialize<'de> for HookMetadata
impl<'de> Deserialize<'de> for HookMetadata
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
Source§impl PartialEq for HookMetadata
impl PartialEq for HookMetadata
Source§fn eq(&self, other: &HookMetadata) -> bool
fn eq(&self, other: &HookMetadata) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for HookMetadata
impl Serialize for HookMetadata
impl StructuralPartialEq for HookMetadata
Auto Trait Implementations§
impl Freeze for HookMetadata
impl RefUnwindSafe for HookMetadata
impl Send for HookMetadata
impl Sync for HookMetadata
impl Unpin for HookMetadata
impl UnsafeUnpin for HookMetadata
impl UnwindSafe for HookMetadata
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