mindcontrol_types 0.21.0

Mind Control types
Documentation
use litty::literal;
use serde::{Deserialize, Serialize};
use genotype_runtime::Any;

/// Collecton webhook body.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct WebhookCollectionV1 {
    /// Webhook type.
    pub r#type: WebhookCollectionV1TypeCollection,
    /// Collection id.
    pub id: String,
    /// Collection.
    pub collection: super::collection::CollectionV1,
}

#[literal("collection")]
pub struct WebhookCollectionV1TypeCollection;

/// Ping webhook body.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct WebhookPingV1 {
    /// Webhook type.
    pub r#type: WebhookPingV1TypePing,
    /// Webhook id to ping
    pub id: String,
}

#[literal("ping")]
pub struct WebhookPingV1TypePing;

/// Webhook pong response.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct WebhookPongV1 {
    /// Ping response message.
    pub ping: WebhookPongV1PingPong,
}

#[literal("pong")]
pub struct WebhookPongV1PingPong;

/// Webhook body.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct WebhookV1 {
    /// Schema version
    pub v: Any,
    /// Webhook id.
    pub id: String,
    /// Webhook timestamp.
    pub time: i64,
    /// Webhook payload.
    pub payload: WebhookV1Payload,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum WebhookV1Payload {
    WebhookPingV1(WebhookPingV1),
    WebhookCollectionV1(WebhookCollectionV1),
}