1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
* 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};
#[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,
/// Meta ad account id (act_<n>).
#[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>,
/// Advantage+ creative enhancements: partial map of Meta creative feature keys (snake_case) to enroll status, forwarded as degrees_of_freedom_spec.creative_features_spec. Unspecified features default to OPT_OUT.
#[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 — Meta rejects it there.
#[serde(rename = "multiAdvertiser", skip_serializing_if = "Option::is_none")]
pub multi_advertiser: Option<MultiAdvertiser>,
}
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,
creative_features: None,
multi_advertiser: None,
}
}
}
/// Advantage+ creative enhancements: partial map of Meta creative feature keys (snake_case) to enroll status, forwarded as degrees_of_freedom_spec.creative_features_spec. Unspecified features default to OPT_OUT.
#[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 — 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
}
}