use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct CreateWebhookRequest {
pub url: String,
}
#[derive(Debug, Clone, Serialize)]
pub struct WebhookResponse {
pub id: crate::domain::id::Id,
pub team_id: crate::domain::id::Id,
pub url: String,
pub created_at: chrono::DateTime<chrono::Utc>,
pub is_active: bool,
pub secret: Option<String>,
}
#[derive(Debug, Clone, Serialize)]
pub struct WebhookListEntry {
pub id: crate::domain::id::Id,
pub team_id: crate::domain::id::Id,
pub url: String,
pub created_at: chrono::DateTime<chrono::Utc>,
pub is_active: bool,
}
impl From<WebhookResponse> for WebhookListEntry {
fn from(resp: WebhookResponse) -> Self {
Self {
id: resp.id,
team_id: resp.team_id,
url: resp.url,
created_at: resp.created_at,
is_active: resp.is_active,
}
}
}
#[derive(Debug, Clone, Serialize)]
pub struct WebhookListResponse {
pub webhooks: Vec<WebhookListEntry>,
pub total: usize,
}