late 0.0.1389

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.
Documentation
/*
 * 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.610.0
 * Contact: support@zernio.com
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// WebhookPayloadCampaignUpdated : Webhook payload for the `campaign.updated` event. Fires when a campaign is edited through Zernio (API, MCP or dashboard), after the platform and Zernio both accepted the edit, once per user who can see the campaign. It also fires when the sync detects an edit made outside Zernio.  `source` is `zernio` for edits through Zernio, `platform` for edits the sync detected outside Zernio, up to one sync interval late, sent only to the user whose sync saw it.  From the sync, `changes` covers only `name`, `status` and `schedule` (schedule only on Google, LinkedIn, Pinterest and OpenAI Ads). Budget edits made outside Zernio are not announced. Never for history loaded when an account connects. An ad rule that changes a campaign arrives as `ad_rule.triggered`.  Ad set edits arrive as `ad_set.updated`. Google sub-resource edits (ad schedule, targeting, negative keywords, conversion goals, assets, asset groups, listing group filters) are not announced.  `changes` names the edited fields and never their values: read the campaign with `GET /v1/ads/campaigns/{campaignId}` for the current state. Ignore values you do not know, new ones can be added.  Events are not deduplicated: every edit is announced. Use the event `id` to drop repeats.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WebhookPayloadCampaignUpdated {
    /// Stable webhook event ID: the dedupe key, also sent as the X-Zernio-Event-Id header and identical on every retry and redelivery.
    #[serde(rename = "id")]
    pub id: String,
    /// The profiles this event belongs to, each with the externalId you set on it (null when none is set). Use it to route the event to your tenant without storing Zernio profile ids.  Present on every event tied to a profile, absent on events that belong to none. Events spanning several profiles (a post published to accounts of different profiles) list each once.
    #[serde(rename = "profiles", skip_serializing_if = "Option::is_none")]
    pub profiles: Option<Vec<models::WebhookProfilesInner>>,
    /// Always true when present: only a sample sent by POST /v1/webhooks/test with an event carries it. Real deliveries never do.
    #[serde(rename = "test", skip_serializing_if = "Option::is_none")]
    pub test: Option<bool>,
    #[serde(rename = "event")]
    pub event: Event,
    #[serde(rename = "account")]
    pub account: Box<models::WebhookAdsAccount>,
    #[serde(rename = "adObject")]
    pub ad_object: Box<models::WebhookPayloadCampaignCreatedAdObject>,
    /// Fields edited by this request. `status` is the campaign's own on/off switch. Ignore values you do not know.
    #[serde(rename = "changes")]
    pub changes: Vec<Changes>,
    /// Where the edit was made. `zernio` for edits through Zernio, `platform` for edits the sync detected outside Zernio.
    #[serde(rename = "source")]
    pub source: Source,
    /// UTC time at which Zernio generated this event.
    #[serde(rename = "timestamp")]
    pub timestamp: String,
}

impl WebhookPayloadCampaignUpdated {
    /// Webhook payload for the `campaign.updated` event. Fires when a campaign is edited through Zernio (API, MCP or dashboard), after the platform and Zernio both accepted the edit, once per user who can see the campaign. It also fires when the sync detects an edit made outside Zernio.  `source` is `zernio` for edits through Zernio, `platform` for edits the sync detected outside Zernio, up to one sync interval late, sent only to the user whose sync saw it.  From the sync, `changes` covers only `name`, `status` and `schedule` (schedule only on Google, LinkedIn, Pinterest and OpenAI Ads). Budget edits made outside Zernio are not announced. Never for history loaded when an account connects. An ad rule that changes a campaign arrives as `ad_rule.triggered`.  Ad set edits arrive as `ad_set.updated`. Google sub-resource edits (ad schedule, targeting, negative keywords, conversion goals, assets, asset groups, listing group filters) are not announced.  `changes` names the edited fields and never their values: read the campaign with `GET /v1/ads/campaigns/{campaignId}` for the current state. Ignore values you do not know, new ones can be added.  Events are not deduplicated: every edit is announced. Use the event `id` to drop repeats.
    pub fn new(
        id: String,
        event: Event,
        account: models::WebhookAdsAccount,
        ad_object: models::WebhookPayloadCampaignCreatedAdObject,
        changes: Vec<Changes>,
        source: Source,
        timestamp: String,
    ) -> WebhookPayloadCampaignUpdated {
        WebhookPayloadCampaignUpdated {
            id,
            profiles: None,
            test: None,
            event,
            account: Box::new(account),
            ad_object: Box::new(ad_object),
            changes,
            source,
            timestamp,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Event {
    #[serde(rename = "campaign.updated")]
    CampaignUpdated,
}

impl Default for Event {
    fn default() -> Event {
        Self::CampaignUpdated
    }
}
/// Fields edited by this request. `status` is the campaign's own on/off switch. Ignore values you do not know.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Changes {
    #[serde(rename = "name")]
    Name,
    #[serde(rename = "status")]
    Status,
    #[serde(rename = "budget")]
    Budget,
    #[serde(rename = "bid")]
    Bid,
    #[serde(rename = "schedule")]
    Schedule,
    #[serde(rename = "targeting")]
    Targeting,
    #[serde(rename = "creative")]
    Creative,
    #[serde(rename = "settings")]
    Settings,
}

impl Default for Changes {
    fn default() -> Changes {
        Self::Name
    }
}
/// Where the edit was made. `zernio` for edits through Zernio, `platform` for edits the sync detected outside Zernio.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Source {
    #[serde(rename = "zernio")]
    Zernio,
    #[serde(rename = "platform")]
    Platform,
}

impl Default for Source {
    fn default() -> Source {
        Self::Zernio
    }
}