/*
* 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.416.0
* Contact: support@zernio.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// MediaItem : Media referenced in posts. URLs must be publicly reachable over HTTPS. Use POST /v1/media/presign for uploads up to 5GB. Zernio auto-compresses images and videos that exceed platform limits (videos over 200 MB may not be compressed).
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct MediaItem {
/// Optional when the item names a connected file (`fileId`): inferred from the file's MIME type.
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
pub r#type: Option<Type>,
/// A media item with a null, missing or empty url is dropped, unless it names a connected file with `fileId` + `accountId`.
#[serde(rename = "url", skip_serializing_if = "Option::is_none")]
pub url: Option<String>,
/// A file of a connected Google Drive or OneDrive account (see the Files endpoints). Requires `accountId`. The file is copied into Zernio media storage when the post is created, and the item is stored as a plain `url`. A folder, an undownloadable file or an unknown id fails the request with a 4xx naming `mediaItems[i].fileId`.
#[serde(rename = "fileId", skip_serializing_if = "Option::is_none")]
pub file_id: Option<String>,
/// The connected Google or Microsoft account the `fileId` belongs to (must have the `files` area). Required with `fileId`.
#[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
pub account_id: Option<String>,
/// Optional title for the media item. Used as the document title for LinkedIn PDF/carousel posts. If omitted, falls back to the post title, then the filename.
#[serde(rename = "title", skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
/// Accessibility alternative text for an image. Set once per image; the same value is sent to each selected platform. - Applied on: Instagram (feed images only, not Reels/Stories), Facebook, Threads, X (max 1000 chars), LinkedIn, Bluesky, Pinterest (max 500 chars). - Ignored on platforms without alt-text support (TikTok, YouTube, Snapchat, Telegram, Reddit, Google Business Profile, WhatsApp) and on video items where the platform does not accept it.
#[serde(rename = "altText", skip_serializing_if = "Option::is_none")]
pub alt_text: Option<String>,
#[serde(rename = "filename", skip_serializing_if = "Option::is_none")]
pub filename: Option<String>,
/// Optional file size in bytes
#[serde(rename = "size", skip_serializing_if = "Option::is_none")]
pub size: Option<i32>,
/// Optional MIME type (e.g. image/jpeg, video/mp4)
#[serde(rename = "mimeType", skip_serializing_if = "Option::is_none")]
pub mime_type: Option<String>,
/// Optional custom thumbnail/cover image URL for videos. Supported for Facebook video posts, Facebook Reels, regular video uploads, and LinkedIn video posts. Max 10MB, JPG/PNG recommended.
#[serde(rename = "thumbnail", skip_serializing_if = "Option::is_none")]
pub thumbnail: Option<String>,
/// Custom cover image URL for Instagram Reels. Can also be set via platformSpecificData.instagramThumbnail or platformSpecificData.reelCover. Resolution order: this field > platformSpecificData.instagramThumbnail > platformSpecificData.reelCover > platformSpecificData.thumbnailUrl (legacy).
#[serde(rename = "instagramThumbnail", skip_serializing_if = "Option::is_none")]
pub instagram_thumbnail: Option<String>,
/// Subtitle (closed caption) files for a video item, in SRT or WebVTT. Each language may appear once per video. Zernio downloads each file when the post is created or updated and converts it to the format each platform requires. Sent to YouTube, Facebook videos, LinkedIn, X and Bluesky; ignored with a warning elsewhere. Per platform: - YouTube: every track. - Facebook: every track, up to 200 KB each. - Bluesky: every track, up to 20 KB each after conversion to WebVTT. - X: the first track only (one subtitle per video). - LinkedIn: the first English track only. Tracks a platform cannot take are skipped and reported in the response warnings. A file that is unreachable, redirects, exceeds 1 MB, is not valid SRT or WebVTT, or is over a platform limit is rejected with a 400 (code INVALID_SUBTITLES). If a platform rejects a file at publish time, the post still publishes, without subtitles.
#[serde(rename = "subtitles", skip_serializing_if = "Option::is_none")]
pub subtitles: Option<Vec<models::MediaSubtitle>>,
/// Internal flag indicating the image was resized for TikTok
#[serde(rename = "tiktokProcessed", skip_serializing_if = "Option::is_none")]
pub tiktok_processed: Option<bool>,
}
impl MediaItem {
/// Media referenced in posts. URLs must be publicly reachable over HTTPS. Use POST /v1/media/presign for uploads up to 5GB. Zernio auto-compresses images and videos that exceed platform limits (videos over 200 MB may not be compressed).
pub fn new() -> MediaItem {
MediaItem {
r#type: None,
url: None,
file_id: None,
account_id: None,
title: None,
alt_text: None,
filename: None,
size: None,
mime_type: None,
thumbnail: None,
instagram_thumbnail: None,
subtitles: None,
tiktok_processed: None,
}
}
}
/// Optional when the item names a connected file (`fileId`): inferred from the file's MIME type.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "image")]
Image,
#[serde(rename = "video")]
Video,
#[serde(rename = "gif")]
Gif,
#[serde(rename = "document")]
Document,
}
impl Default for Type {
fn default() -> Type {
Self::Image
}
}