/*
* 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};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AdCampaign {
#[serde(rename = "platformCampaignId", skip_serializing_if = "Option::is_none")]
pub platform_campaign_id: Option<String>,
#[serde(rename = "platform", skip_serializing_if = "Option::is_none")]
pub platform: Option<Platform>,
#[serde(rename = "campaignName", skip_serializing_if = "Option::is_none")]
pub campaign_name: Option<String>,
/// Delivery status derived from child ad statuses. Distinct from `reviewStatus`.
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
pub status: Option<models::AdStatus>,
#[serde(
rename = "reviewStatus",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub review_status: Option<Option<models::AdReviewStatus>>,
/// Raw platform-level campaign status (Meta `effective_status`; ChatGPT (OpenAI): the campaign's own switch, active / paused / archived).
#[serde(
rename = "platformCampaignStatus",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub platform_campaign_status: Option<Option<String>>,
/// Platform-reported campaign issues (Meta `issues_info[]`).
#[serde(
rename = "campaignIssuesInfo",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub campaign_issues_info: Option<Option<Vec<serde_json::Value>>>,
#[serde(rename = "adCount", skip_serializing_if = "Option::is_none")]
pub ad_count: Option<i32>,
#[serde(
rename = "budget",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub budget: Option<Option<Box<models::AdCampaignBudget>>>,
#[serde(
rename = "campaignBudget",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub campaign_budget: Option<Option<Box<models::AdCampaignBudget>>>,
/// Canonical CBO/ABO indicator. See AdTreeCampaign.budgetLevel.
#[serde(
rename = "budgetLevel",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub budget_level: Option<Option<BudgetLevel>>,
/// Meta-only. Mirrors Campaign.is_budget_schedule_enabled.
#[serde(
rename = "isBudgetScheduleEnabled",
skip_serializing_if = "Option::is_none"
)]
pub is_budget_schedule_enabled: Option<bool>,
/// ISO 4217 currency code for all budget amounts. Budgets are NOT normalized to USD.
#[serde(
rename = "currency",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub currency: Option<Option<String>>,
#[serde(rename = "metrics", skip_serializing_if = "Option::is_none")]
pub metrics: Option<Box<models::AdMetrics>>,
#[serde(
rename = "platformAdAccountId",
skip_serializing_if = "Option::is_none"
)]
pub platform_ad_account_id: Option<String>,
/// Human-readable advertiser/account name from the platform. Refreshed on every sync.
#[serde(
rename = "platformAdAccountName",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub platform_ad_account_name: Option<Option<String>>,
#[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
pub account_id: Option<String>,
#[serde(rename = "profileId", skip_serializing_if = "Option::is_none")]
pub profile_id: Option<String>,
/// Google-only. Raw campaign.advertising_channel_type. See AdTreeCampaign.advertisingChannelType.
#[serde(
rename = "advertisingChannelType",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub advertising_channel_type: Option<Option<String>>,
/// Raw Meta campaign objective (e.g. OUTCOME_SALES, OUTCOME_LEADS, OUTCOME_TRAFFIC)
#[serde(
rename = "platformObjective",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub platform_objective: Option<Option<String>>,
#[serde(rename = "optimizationGoal", skip_serializing_if = "Option::is_none")]
pub optimization_goal: Option<Box<models::AdTreeCampaignOptimizationGoal>>,
#[serde(
rename = "bidStrategy",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub bid_strategy: Option<Option<models::BidStrategy>>,
/// Representative bid from the top-spending ad set (whole currency units). Meta: populated when bidStrategy is LOWEST_COST_WITH_BID_CAP or COST_CAP. LinkedIn: the campaign unitCost, ungated, where 0 is a real delivery-stopping value.
#[serde(
rename = "bidAmount",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub bid_amount: Option<Option<f64>>,
/// Representative ROAS floor from the top-spending ad set. Decimal multiplier (2.0 = 2.0x).
#[serde(
rename = "roasAverageFloor",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub roas_average_floor: Option<Option<f64>>,
#[serde(rename = "promotedObject", skip_serializing_if = "Option::is_none")]
pub promoted_object: Option<Box<models::AdTreeCampaignPromotedObject>>,
#[serde(rename = "earliestAd", skip_serializing_if = "Option::is_none")]
pub earliest_ad: Option<String>,
#[serde(rename = "latestAd", skip_serializing_if = "Option::is_none")]
pub latest_ad: Option<String>,
}
impl AdCampaign {
pub fn new() -> AdCampaign {
AdCampaign {
platform_campaign_id: None,
platform: None,
campaign_name: None,
status: None,
review_status: None,
platform_campaign_status: None,
campaign_issues_info: None,
ad_count: None,
budget: None,
campaign_budget: None,
budget_level: None,
is_budget_schedule_enabled: None,
currency: None,
metrics: None,
platform_ad_account_id: None,
platform_ad_account_name: None,
account_id: None,
profile_id: None,
advertising_channel_type: None,
platform_objective: None,
optimization_goal: None,
bid_strategy: None,
bid_amount: None,
roas_average_floor: None,
promoted_object: None,
earliest_ad: None,
latest_ad: None,
}
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Platform {
#[serde(rename = "facebook")]
Facebook,
#[serde(rename = "instagram")]
Instagram,
#[serde(rename = "tiktok")]
Tiktok,
#[serde(rename = "linkedin")]
Linkedin,
#[serde(rename = "pinterest")]
Pinterest,
#[serde(rename = "google")]
Google,
#[serde(rename = "twitter")]
Twitter,
#[serde(rename = "openai")]
Openai,
}
impl Default for Platform {
fn default() -> Platform {
Self::Facebook
}
}
/// Canonical CBO/ABO indicator. See AdTreeCampaign.budgetLevel.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum BudgetLevel {
#[serde(rename = "campaign")]
Campaign,
#[serde(rename = "adset")]
Adset,
}
impl Default for BudgetLevel {
fn default() -> BudgetLevel {
Self::Campaign
}
}