zernio 0.0.132

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.1
 * Contact: support@zernio.com
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PlatformTarget {
    /// Supported values: twitter, threads, instagram, youtube, facebook, linkedin, pinterest, reddit, tiktok, bluesky, googlebusiness, telegram
    #[serde(rename = "platform", skip_serializing_if = "Option::is_none")]
    pub platform: Option<String>,
    #[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
    pub account_id: Option<Box<models::PlatformTargetAccountId>>,
    /// Platform-specific text override. When set, this content is used instead of the top-level post content for this platform. Useful for tailoring captions per platform (e.g. keeping tweets under 280 characters).
    #[serde(rename = "customContent", skip_serializing_if = "Option::is_none")]
    pub custom_content: Option<String>,
    #[serde(rename = "customMedia", skip_serializing_if = "Option::is_none")]
    pub custom_media: Option<Vec<models::MediaItem>>,
    /// Optional per-platform scheduled time override (uses post.scheduledFor when omitted)
    #[serde(rename = "scheduledFor", skip_serializing_if = "Option::is_none")]
    pub scheduled_for: Option<String>,
    #[serde(
        rename = "platformSpecificData",
        skip_serializing_if = "Option::is_none"
    )]
    pub platform_specific_data: Option<Box<models::PlatformTargetPlatformSpecificData>>,
    /// Platform-specific status: pending, publishing, published, failed
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<String>,
    /// The native post ID on the platform (populated after successful publish)
    #[serde(rename = "platformPostId", skip_serializing_if = "Option::is_none")]
    pub platform_post_id: Option<String>,
    /// Public URL of the published post. Included in the response for immediate posts; for scheduled posts, fetch via GET /v1/posts/{postId} after publish time.
    #[serde(rename = "platformPostUrl", skip_serializing_if = "Option::is_none")]
    pub platform_post_url: Option<String>,
    /// Timestamp when the post was published to this platform
    #[serde(rename = "publishedAt", skip_serializing_if = "Option::is_none")]
    pub published_at: Option<String>,
    /// Human-readable error message when status is failed. Contains platform-specific error details explaining why the publish failed.
    #[serde(rename = "errorMessage", skip_serializing_if = "Option::is_none")]
    pub error_message: Option<String>,
    /// Error category for programmatic handling: auth_expired (token expired/revoked), user_content (wrong format/too long), user_abuse (rate limits/spam), account_issue (config problems), platform_rejected (policy violation), platform_error (5xx/maintenance), system_error (Zernio infra), unknown
    #[serde(rename = "errorCategory", skip_serializing_if = "Option::is_none")]
    pub error_category: Option<ErrorCategory>,
    /// Who caused the error: user (fix content/reconnect), platform (outage/API change), system (Zernio issue, rare)
    #[serde(rename = "errorSource", skip_serializing_if = "Option::is_none")]
    pub error_source: Option<ErrorSource>,
}

impl PlatformTarget {
    pub fn new() -> PlatformTarget {
        PlatformTarget {
            platform: None,
            account_id: None,
            custom_content: None,
            custom_media: None,
            scheduled_for: None,
            platform_specific_data: None,
            status: None,
            platform_post_id: None,
            platform_post_url: None,
            published_at: None,
            error_message: None,
            error_category: None,
            error_source: None,
        }
    }
}
/// Error category for programmatic handling: auth_expired (token expired/revoked), user_content (wrong format/too long), user_abuse (rate limits/spam), account_issue (config problems), platform_rejected (policy violation), platform_error (5xx/maintenance), system_error (Zernio infra), unknown
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ErrorCategory {
    #[serde(rename = "auth_expired")]
    AuthExpired,
    #[serde(rename = "user_content")]
    UserContent,
    #[serde(rename = "user_abuse")]
    UserAbuse,
    #[serde(rename = "account_issue")]
    AccountIssue,
    #[serde(rename = "platform_rejected")]
    PlatformRejected,
    #[serde(rename = "platform_error")]
    PlatformError,
    #[serde(rename = "system_error")]
    SystemError,
    #[serde(rename = "unknown")]
    Unknown,
}

impl Default for ErrorCategory {
    fn default() -> ErrorCategory {
        Self::AuthExpired
    }
}
/// Who caused the error: user (fix content/reconnect), platform (outage/API change), system (Zernio issue, rare)
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ErrorSource {
    #[serde(rename = "user")]
    User,
    #[serde(rename = "platform")]
    Platform,
    #[serde(rename = "system")]
    System,
}

impl Default for ErrorSource {
    fn default() -> ErrorSource {
        Self::User
    }
}