/*
* 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).
*
* The version of the OpenAPI document: 1.11.0
* 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 CreateAdCreativeRequest {
/// Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token and Page.
#[serde(rename = "accountId")]
pub account_id: String,
/// Platform ad account id (Meta act_<n>, Google customer id, LinkedIn account id, ...).
#[serde(rename = "adAccountId")]
pub ad_account_id: String,
#[serde(rename = "headline")]
pub headline: String,
/// Primary text
#[serde(rename = "body")]
pub body: String,
/// Link description below the headline; omitted = Meta scrapes the destination's OG description.
#[serde(rename = "description", skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// CTA type (same whitelist as POST /v1/ads/create).
#[serde(rename = "callToAction", skip_serializing_if = "Option::is_none")]
pub call_to_action: Option<String>,
#[serde(rename = "linkUrl")]
pub link_url: String,
/// Publicly reachable image; uploaded to the account's library server-side.
#[serde(rename = "imageUrl", skip_serializing_if = "Option::is_none")]
pub image_url: Option<String>,
/// Existing library image hash (POST /v1/ads/images or GET /v1/ads/images).
#[serde(rename = "imageHash", skip_serializing_if = "Option::is_none")]
pub image_hash: Option<String>,
#[serde(rename = "carouselCards", skip_serializing_if = "Option::is_none")]
pub carousel_cards: Option<Vec<models::CreateAdCreativeRequestCarouselCardsInner>>,
/// Appended to every outbound URL (e.g. utm_source=fb).
#[serde(rename = "urlTags", skip_serializing_if = "Option::is_none")]
pub url_tags: Option<String>,
/// Not supported. Meta validates creative_sourcing_spec.promotion_metadata_spec on the create call and then discards it, so a Promotion set through the Marketing API never reaches the creative. Any object is rejected with 400 invalid_field_value. Send null or omit the field, and set the Promotion on the ad in Ads Manager. Verified on 2026-09-11 across Graph v19.0 to v25.0 and every write path.
#[serde(
rename = "promotion",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub promotion: Option<Option<serde_json::Value>>,
/// Meta only. Applied to each new creative, including standalone and attach shapes. With creatives[], these are defaults; an item replaces the whole feature map, including an empty map. auto_promotion_tag is an Advantage+ enhancement, not the Ads Manager Promotion setting.
#[serde(rename = "creativeFeatures", skip_serializing_if = "Option::is_none")]
pub creative_features: Option<CreativeFeatures>,
/// Meta only. Multi-advertiser ads: whether Meta may show this ad alongside other advertisers' in one unit. Meta auto-enrols since Aug 2024, so send OPT_OUT to leave. It is a top-level creative field, NOT a `creativeFeatures` key, and Meta rejects it there.
#[serde(rename = "multiAdvertiser", skip_serializing_if = "Option::is_none")]
pub multi_advertiser: Option<MultiAdvertiser>,
/// Meta only. Meta's \"Ad includes media created or edited with AI\" disclosure, the checkbox in Ads Manager, stored on the creative as `generative_asset_spec.transparency_metadata.self_disclosure`. OPT_IN checks it, OPT_OUT explicitly declares no AI media, omitted leaves Meta's default. Applied to each new creative, including standalone, creatives[] and attach shapes, and preserved when a creative is rebuilt. This sets the disclosure on the ad; whether and when the viewer-facing label renders is Meta's decision.
#[serde(rename = "aiDisclosure", skip_serializing_if = "Option::is_none")]
pub ai_disclosure: Option<AiDisclosure>,
}
impl CreateAdCreativeRequest {
pub fn new(
account_id: String,
ad_account_id: String,
headline: String,
body: String,
link_url: String,
) -> CreateAdCreativeRequest {
CreateAdCreativeRequest {
account_id,
ad_account_id,
headline,
body,
description: None,
call_to_action: None,
link_url,
image_url: None,
image_hash: None,
carousel_cards: None,
url_tags: None,
promotion: None,
creative_features: None,
multi_advertiser: None,
ai_disclosure: None,
}
}
}
/// Meta only. Applied to each new creative, including standalone and attach shapes. With creatives[], these are defaults; an item replaces the whole feature map, including an empty map. auto_promotion_tag is an Advantage+ enhancement, not the Ads Manager Promotion setting.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum CreativeFeatures {
#[serde(rename = "OPT_IN")]
OptIn,
#[serde(rename = "OPT_OUT")]
OptOut,
}
impl Default for CreativeFeatures {
fn default() -> CreativeFeatures {
Self::OptIn
}
}
/// Meta only. Multi-advertiser ads: whether Meta may show this ad alongside other advertisers' in one unit. Meta auto-enrols since Aug 2024, so send OPT_OUT to leave. It is a top-level creative field, NOT a `creativeFeatures` key, and Meta rejects it there.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum MultiAdvertiser {
#[serde(rename = "OPT_IN")]
OptIn,
#[serde(rename = "OPT_OUT")]
OptOut,
}
impl Default for MultiAdvertiser {
fn default() -> MultiAdvertiser {
Self::OptIn
}
}
/// Meta only. Meta's \"Ad includes media created or edited with AI\" disclosure, the checkbox in Ads Manager, stored on the creative as `generative_asset_spec.transparency_metadata.self_disclosure`. OPT_IN checks it, OPT_OUT explicitly declares no AI media, omitted leaves Meta's default. Applied to each new creative, including standalone, creatives[] and attach shapes, and preserved when a creative is rebuilt. This sets the disclosure on the ad; whether and when the viewer-facing label renders is Meta's decision.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum AiDisclosure {
#[serde(rename = "OPT_IN")]
OptIn,
#[serde(rename = "OPT_OUT")]
OptOut,
}
impl Default for AiDisclosure {
fn default() -> AiDisclosure {
Self::OptIn
}
}