/*
* 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};
/// WebhookPayloadAdStatusChanged : Webhook payload for the `ad.status_changed` event. Currently emitted only for Meta (`metaads`). Sourced from two Meta `ad_account` webhook fields: - `in_process_ad_objects` - the ad object finished processing and exited `IN_PROCESS`. `status.raw` carries Meta's `status_name`. - `with_issues_ad_objects` - the ad object entered `WITH_ISSUES`. `status.raw` is `WITH_ISSUES` and the `error` block is populated from Meta's `error_code` / `error_summary` / `error_message`.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WebhookPayloadAdStatusChanged {
/// Stable webhook event ID
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "event")]
pub event: Event,
#[serde(rename = "account")]
pub account: Box<models::WebhookPayloadAdStatusChangedAccount>,
#[serde(rename = "adObject")]
pub ad_object: Box<models::WebhookPayloadAdStatusChangedAdObject>,
#[serde(rename = "status")]
pub status: Box<models::WebhookPayloadAdStatusChangedStatus>,
#[serde(rename = "error", skip_serializing_if = "Option::is_none")]
pub error: Option<Box<models::WebhookPayloadAdStatusChangedError>>,
/// ISO-8601 timestamp the webhook was produced.
#[serde(rename = "timestamp")]
pub timestamp: String,
}
impl WebhookPayloadAdStatusChanged {
/// Webhook payload for the `ad.status_changed` event. Currently emitted only for Meta (`metaads`). Sourced from two Meta `ad_account` webhook fields: - `in_process_ad_objects` - the ad object finished processing and exited `IN_PROCESS`. `status.raw` carries Meta's `status_name`. - `with_issues_ad_objects` - the ad object entered `WITH_ISSUES`. `status.raw` is `WITH_ISSUES` and the `error` block is populated from Meta's `error_code` / `error_summary` / `error_message`.
pub fn new(
id: String,
event: Event,
account: models::WebhookPayloadAdStatusChangedAccount,
ad_object: models::WebhookPayloadAdStatusChangedAdObject,
status: models::WebhookPayloadAdStatusChangedStatus,
timestamp: String,
) -> WebhookPayloadAdStatusChanged {
WebhookPayloadAdStatusChanged {
id,
event,
account: Box::new(account),
ad_object: Box::new(ad_object),
status: Box::new(status),
error: None,
timestamp,
}
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Event {
#[serde(rename = "ad.status_changed")]
AdStatusChanged,
}
impl Default for Event {
fn default() -> Event {
Self::AdStatusChanged
}
}