pub struct WebhookEvent {
pub task_id: TaskId,
pub task_name: String,
pub status: TaskStatus,
pub result: Option<String>,
pub error: Option<String>,
pub started_at: DateTime<Utc>,
pub completed_at: DateTime<Utc>,
pub duration_ms: u64,
}Expand description
Webhook event payload
Contains all information about a completed task for webhook notification.
§Example
use reinhardt_tasks::webhook::{WebhookEvent, TaskStatus};
use reinhardt_tasks::TaskId;
use chrono::Utc;
let now = Utc::now();
let event = WebhookEvent {
task_id: TaskId::new(),
task_name: "send_email".to_string(),
status: TaskStatus::Success,
result: Some("Email sent".to_string()),
error: None,
started_at: now - chrono::Duration::seconds(5),
completed_at: now,
duration_ms: 5000,
};
assert_eq!(event.status, TaskStatus::Success);
assert_eq!(event.duration_ms, 5000);Fields§
§task_id: TaskIdUnique task identifier
task_name: StringTask name
status: TaskStatusTask completion status
result: Option<String>Task result (if successful)
error: Option<String>Error message (if failed)
started_at: DateTime<Utc>Task start time
completed_at: DateTime<Utc>Task completion time
duration_ms: u64Task duration in milliseconds
Trait Implementations§
Source§impl Clone for WebhookEvent
impl Clone for WebhookEvent
Source§fn clone(&self) -> WebhookEvent
fn clone(&self) -> WebhookEvent
Returns a duplicate of the value. Read more
1.0.0 · 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 WebhookEvent
impl Debug for WebhookEvent
Source§impl<'de> Deserialize<'de> for WebhookEvent
impl<'de> Deserialize<'de> for WebhookEvent
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 WebhookEvent
impl RefUnwindSafe for WebhookEvent
impl Send for WebhookEvent
impl Sync for WebhookEvent
impl Unpin for WebhookEvent
impl UnsafeUnpin for WebhookEvent
impl UnwindSafe for WebhookEvent
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