/*
* 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.504.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 CreateAdSetRequest {
/// Zernio SocialAccount id owning the Google Ads or Reddit Ads connection.
#[serde(rename = "accountId")]
pub account_id: String,
/// \"google\" and \"reddit\" are implemented; every other value returns 501.
#[serde(rename = "platform")]
pub platform: Platform,
/// Platform campaign ID the ad group is created under (numeric on Google).
#[serde(rename = "campaignId")]
pub campaign_id: String,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
pub status: Option<Status>,
/// Max CPC of the new ad group, in the account's currency units. Send it when the campaign uses Manual CPC: Google gives an ad group without one a 0.01 bid.
#[serde(rename = "maxCpc", skip_serializing_if = "Option::is_none")]
pub max_cpc: Option<f64>,
/// Platform ad account ID: the Google customer ID (digits only, only required when the connection has more than one) or the Reddit ad account id (required).
#[serde(rename = "adAccountId", skip_serializing_if = "Option::is_none")]
pub ad_account_id: Option<String>,
/// Google only. Alias of adAccountId, kept for existing callers
#[serde(rename = "customerId", skip_serializing_if = "Option::is_none")]
pub customer_id: Option<String>,
/// Reddit only. Budget of the new ad group, in the ad account's currency units. Required when the campaign has no campaign budget; 400 under campaign budget optimization, where the campaign budget funds the ad group.
#[serde(rename = "budgetAmount", skip_serializing_if = "Option::is_none")]
pub budget_amount: Option<f64>,
/// Reddit only. Sent together with budgetAmount.
#[serde(rename = "budgetType", skip_serializing_if = "Option::is_none")]
pub budget_type: Option<BudgetType>,
/// Reddit only. ISO 8601 start of the ad group. Defaults to now, or to the campaign start when it is in the future.
#[serde(rename = "startDate", skip_serializing_if = "Option::is_none")]
pub start_date: Option<String>,
/// Reddit only. ISO 8601 end of the ad group. Defaults to the campaign end.
#[serde(rename = "endDate", skip_serializing_if = "Option::is_none")]
pub end_date: Option<String>,
#[serde(rename = "targeting", skip_serializing_if = "Option::is_none")]
pub targeting: Option<Box<models::TargetingSpec>>,
#[serde(rename = "promotedObject", skip_serializing_if = "Option::is_none")]
pub promoted_object: Option<Box<models::CreateAdSetRequestPromotedObject>>,
/// Reddit only. VIDEO_VIEW_6S (default) or VIDEO_VIEW_15S on a video views campaign.
#[serde(rename = "optimizationGoal", skip_serializing_if = "Option::is_none")]
pub optimization_goal: Option<String>,
/// Reddit only. Defaults to LOWEST_COST_WITHOUT_CAP. Not accepted under campaign budget optimization.
#[serde(rename = "bidStrategy", skip_serializing_if = "Option::is_none")]
pub bid_strategy: Option<BidStrategy>,
/// Reddit only. Bid cap in currency units, sent with bidStrategy.
#[serde(rename = "bidAmount", skip_serializing_if = "Option::is_none")]
pub bid_amount: Option<f64>,
}
impl CreateAdSetRequest {
pub fn new(
account_id: String,
platform: Platform,
campaign_id: String,
name: String,
) -> CreateAdSetRequest {
CreateAdSetRequest {
account_id,
platform,
campaign_id,
name,
status: None,
max_cpc: None,
ad_account_id: None,
customer_id: None,
budget_amount: None,
budget_type: None,
start_date: None,
end_date: None,
targeting: None,
promoted_object: None,
optimization_goal: None,
bid_strategy: None,
bid_amount: None,
}
}
}
/// \"google\" and \"reddit\" are implemented; every other value returns 501.
#[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,
#[serde(rename = "reddit")]
Reddit,
}
impl Default for Platform {
fn default() -> Platform {
Self::Facebook
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "ACTIVE")]
Active,
#[serde(rename = "PAUSED")]
Paused,
}
impl Default for Status {
fn default() -> Status {
Self::Active
}
}
/// Reddit only. Sent together with budgetAmount.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum BudgetType {
#[serde(rename = "daily")]
Daily,
#[serde(rename = "lifetime")]
Lifetime,
}
impl Default for BudgetType {
fn default() -> BudgetType {
Self::Daily
}
}
/// Reddit only. Defaults to LOWEST_COST_WITHOUT_CAP. Not accepted under campaign budget optimization.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum BidStrategy {
#[serde(rename = "LOWEST_COST_WITHOUT_CAP")]
LowestCostWithoutCap,
#[serde(rename = "LOWEST_COST_WITH_BID_CAP")]
LowestCostWithBidCap,
#[serde(rename = "COST_CAP")]
CostCap,
}
impl Default for BidStrategy {
fn default() -> BidStrategy {
Self::LowestCostWithoutCap
}
}