Skip to main content

ephemeris_forge_github/api/request/
webhooks.rs

1use facet::Facet;
2
3/// The delivery settings sent when a webhook is created or updated.
4#[derive(Clone, Debug, Eq, Facet, PartialEq)]
5pub struct WebhookConfigBody {
6    /// The delivery URL.
7    pub url: String,
8    /// The body format, `json` or `form`.
9    pub content_type: String,
10    /// "0" or "1".
11    pub insecure_ssl: String,
12}
13
14/// The body that creates a webhook.
15#[derive(Clone, Debug, Eq, Facet, PartialEq)]
16pub struct WebhookBody {
17    /// The hook type, always `web`.
18    pub name: String,
19    /// The delivery settings.
20    pub config: WebhookConfigBody,
21    /// The events that trigger a delivery.
22    pub events: Vec<String>,
23    /// Whether GitHub delivers events.
24    pub active: bool,
25}
26
27/// The body that updates a webhook.
28#[derive(Clone, Debug, Eq, Facet, PartialEq)]
29pub struct WebhookPatch {
30    /// The delivery settings. Left out when they do not change, because
31    /// GitHub removes a secret that a config update does not resend.
32    #[facet(skip_serializing_if = Option::is_none)]
33    pub config: Option<WebhookConfigBody>,
34    /// The events that trigger a delivery.
35    pub events: Vec<String>,
36    /// Whether GitHub delivers events.
37    pub active: bool,
38}