late 0.0.375

API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
Documentation
/*
 * Zernio API
 *
 * API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
 *
 * The version of the OpenAPI document: 1.0.4
 * Contact: support@zernio.com
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// ExternalPostWebhookPost : Native (external) post data shared by all post.external.* payloads.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ExternalPostWebhookPost {
    /// Platform-native post ID (NOT a Zernio post ID).
    #[serde(rename = "id")]
    pub id: String,
    /// Platform the post lives on (e.g. \"googlebusiness\").
    #[serde(rename = "platform")]
    pub platform: String,
    /// Zernio social account ID the post belongs to.
    #[serde(rename = "accountId")]
    pub account_id: String,
    /// Direct URL to the post on the platform, when available.
    #[serde(rename = "url")]
    pub url: String,
    /// Post text. May be empty.
    #[serde(rename = "content")]
    pub content: String,
    /// One of image, video, gif, document, text, carousel.
    #[serde(rename = "mediaType")]
    pub media_type: String,
    #[serde(rename = "mediaItems")]
    pub media_items: Vec<models::ExternalPostMediaItem>,
    #[serde(rename = "thumbnailUrl")]
    pub thumbnail_url: String,
    #[serde(rename = "publishedAt")]
    pub published_at: String,
    /// Always \"external\" — distinguishes these from Zernio-originated post.* events.
    #[serde(rename = "source")]
    pub source: Source,
    /// Detection time of deletion. Present on post.external.deleted; null/absent otherwise.
    #[serde(rename = "deletedAt", skip_serializing_if = "Option::is_none")]
    pub deleted_at: Option<String>,
}

impl ExternalPostWebhookPost {
    /// Native (external) post data shared by all post.external.* payloads.
    pub fn new(
        id: String,
        platform: String,
        account_id: String,
        url: String,
        content: String,
        media_type: String,
        media_items: Vec<models::ExternalPostMediaItem>,
        thumbnail_url: String,
        published_at: String,
        source: Source,
    ) -> ExternalPostWebhookPost {
        ExternalPostWebhookPost {
            id,
            platform,
            account_id,
            url,
            content,
            media_type,
            media_items,
            thumbnail_url,
            published_at,
            source,
            deleted_at: None,
        }
    }
}
/// Always \"external\" — distinguishes these from Zernio-originated post.* events.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Source {
    #[serde(rename = "external")]
    External,
}

impl Default for Source {
    fn default() -> Source {
        Self::External
    }
}