/*
* Zernio API
*
* API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema). Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
*
* The version of the OpenAPI document: 1.104.0
* 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 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", deserialize_with = "Option::deserialize")]
pub url: Option<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", deserialize_with = "Option::deserialize")]
pub thumbnail_url: Option<String>,
#[serde(rename = "publishedAt")]
pub published_at: String,
/// Instagram only: the platform media product type (e.g. FEED, REELS, STORY, AD). Absent when the platform did not report it.
#[serde(rename = "mediaProductType", skip_serializing_if = "Option::is_none")]
pub media_product_type: Option<String>,
/// Instagram only: whether Instagram labeled the media as AI-generated. Absent when the platform did not report it.
#[serde(rename = "isAiGenerated", skip_serializing_if = "Option::is_none")]
pub is_ai_generated: Option<bool>,
/// Instagram reels only: whether the reel is also shared to the main feed. Absent when the platform did not report it.
#[serde(rename = "isSharedToFeed", skip_serializing_if = "Option::is_none")]
pub is_shared_to_feed: Option<bool>,
/// Instagram only: audio type of the media (MUSIC or ORIGINAL_SOUND). Absent when the platform did not report it.
#[serde(rename = "mediaAudioType", skip_serializing_if = "Option::is_none")]
pub media_audio_type: Option<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",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub deleted_at: Option<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: Option<String>,
content: String,
media_type: String,
media_items: Vec<models::ExternalPostMediaItem>,
thumbnail_url: Option<String>,
published_at: String,
source: Source,
) -> ExternalPostWebhookPost {
ExternalPostWebhookPost {
id,
platform,
account_id,
url,
content,
media_type,
media_items,
thumbnail_url,
published_at,
media_product_type: None,
is_ai_generated: None,
is_shared_to_feed: None,
media_audio_type: None,
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
}
}