Skip to main content

zlayer_types/api/
webhooks.rs

1//! Webhook receiver / management API DTOs.
2//!
3//! Wire types for the public webhook receiver
4//! (`POST /webhooks/{provider}/{project_id}`) and the auth-required webhook
5//! management endpoints (`GET /api/v1/projects/{id}/webhook` and
6//! `POST /api/v1/projects/{id}/webhook/rotate`).
7
8use serde::{Deserialize, Serialize};
9
10/// Response for the public webhook receiver.
11#[derive(Debug, Serialize, utoipa::ToSchema)]
12pub struct WebhookResponse {
13    /// Operation result -- always `"ok"` on success.
14    pub status: String,
15    /// HEAD commit SHA after the pull.
16    pub sha: String,
17}
18
19/// Response for `GET /api/v1/projects/{id}/webhook`.
20#[derive(Debug, Serialize, utoipa::ToSchema)]
21pub struct WebhookInfoResponse {
22    /// Full URL to configure in the git host's webhook settings.
23    pub url: String,
24    /// The HMAC secret to paste into the git host.
25    pub secret: String,
26}
27
28/// Path parameters for the public webhook receiver.
29#[derive(Debug, Deserialize)]
30pub struct WebhookPath {
31    pub provider: String,
32    pub project_id: String,
33}