/*
* 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 CreateAdInsightsReportRequest {
/// Zernio SocialAccount id (posting or ads variant).
#[serde(rename = "accountId")]
pub account_id: String,
/// Meta insights node: act_<n>, campaign id, ad set id or ad id.
#[serde(rename = "objectId")]
pub object_id: String,
#[serde(rename = "level", skip_serializing_if = "Option::is_none")]
pub level: Option<Level>,
/// Comma-separated Graph insights fields.
#[serde(rename = "fields", skip_serializing_if = "Option::is_none")]
pub fields: Option<String>,
/// Comma-separated Graph breakdowns.
#[serde(rename = "breakdowns", skip_serializing_if = "Option::is_none")]
pub breakdowns: Option<String>,
/// Comma-separated Graph action breakdowns (e.g. action_type,action_destination). Pass `none` to clear Meta's default action_type breakdown, needed for some non-action breakdowns such as instagram_ads_follow_type.
#[serde(rename = "actionBreakdowns", skip_serializing_if = "Option::is_none")]
pub action_breakdowns: Option<String>,
/// Meta attribution windows (e.g. [\"7d_click\", \"1d_view\"]). Action values are returned keyed per window.
#[serde(
rename = "actionAttributionWindows",
skip_serializing_if = "Option::is_none"
)]
pub action_attribution_windows: Option<Vec<String>>,
/// When actions are counted: impression, conversion or mixed.
#[serde(rename = "actionReportTime", skip_serializing_if = "Option::is_none")]
pub action_report_time: Option<String>,
/// Use the ad sets' own attribution settings for action counting.
#[serde(
rename = "useUnifiedAttributionSetting",
skip_serializing_if = "Option::is_none"
)]
pub use_unified_attribution_setting: Option<bool>,
/// Meta filter objects, applied server-side.
#[serde(rename = "filtering", skip_serializing_if = "Option::is_none")]
pub filtering: Option<Vec<models::CreateAdInsightsReportRequestFilteringInner>>,
/// Mutually exclusive with fromDate/toDate.
#[serde(rename = "datePreset", skip_serializing_if = "Option::is_none")]
pub date_preset: Option<String>,
#[serde(rename = "fromDate", skip_serializing_if = "Option::is_none")]
pub from_date: Option<String>,
#[serde(rename = "toDate", skip_serializing_if = "Option::is_none")]
pub to_date: Option<String>,
#[serde(rename = "timeIncrement", skip_serializing_if = "Option::is_none")]
pub time_increment: Option<Box<models::CreateAdInsightsReportRequestTimeIncrement>>,
}
impl CreateAdInsightsReportRequest {
pub fn new(account_id: String, object_id: String) -> CreateAdInsightsReportRequest {
CreateAdInsightsReportRequest {
account_id,
object_id,
level: None,
fields: None,
breakdowns: None,
action_breakdowns: None,
action_attribution_windows: None,
action_report_time: None,
use_unified_attribution_setting: None,
filtering: None,
date_preset: None,
from_date: None,
to_date: None,
time_increment: None,
}
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Level {
#[serde(rename = "ad")]
Ad,
#[serde(rename = "adset")]
Adset,
#[serde(rename = "campaign")]
Campaign,
#[serde(rename = "account")]
Account,
}
impl Default for Level {
fn default() -> Level {
Self::Ad
}
}