/*
* 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.390.0
* Contact: support@zernio.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// ConversationAdAttribution : The ad that opened the conversation, enriched from the ads Zernio syncs for the account owner. null when the conversation did not start from a Meta referral (ad click or ig.me / m.me ref link). Meta's referral carries the ad ID but no campaign or ad set ID. When the ad is in your synced ads (`GET /v1/ads`), `synced` is true and the ad name, campaign, ad set and ad account come from there. Otherwise `synced` is false, `name` falls back to the ad title (Instagram, Facebook) or headline (WhatsApp) Meta sent with the click, and the other fields are null. A team member limited to some profiles, or an API key scoped to profiles, is enriched only from the ads it can list with `GET /v1/ads`; any other ad comes back `synced` false. A non-null object with `adId` null is a referral that is not an ad click: an ig.me / m.me ref link (`name` null) or a WhatsApp click on a post (`ctwa_source_type` post, `name` is Meta's headline). Nothing is looked up in your ads for it and `synced` is false.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ConversationAdAttribution {
/// Meta's ad ID: `meta_ad_id` on Instagram and Facebook, `ctwa_source_id` on WhatsApp when `ctwa_source_type` is `ad`. Accepted by `GET /v1/ads/{adId}`.
#[serde(rename = "adId", deserialize_with = "Option::deserialize")]
pub ad_id: Option<String>,
/// The synced ad's name, else the ad title or headline Meta sent.
#[serde(rename = "name", deserialize_with = "Option::deserialize")]
pub name: Option<String>,
/// True when the ad was found in your synced ads.
#[serde(rename = "synced")]
pub synced: bool,
/// Meta campaign ID. Synced ads only.
#[serde(rename = "campaignId", deserialize_with = "Option::deserialize")]
pub campaign_id: Option<String>,
/// Campaign name. Synced ads only.
#[serde(rename = "campaignName", deserialize_with = "Option::deserialize")]
pub campaign_name: Option<String>,
/// Meta ad set ID. Synced ads only.
#[serde(rename = "adSetId", deserialize_with = "Option::deserialize")]
pub ad_set_id: Option<String>,
/// Ad set name. Synced ads only.
#[serde(rename = "adSetName", deserialize_with = "Option::deserialize")]
pub ad_set_name: Option<String>,
/// Meta ad account ID (act_...). Synced ads only.
#[serde(rename = "adAccountId", deserialize_with = "Option::deserialize")]
pub ad_account_id: Option<String>,
/// Ad account name. Synced ads only.
#[serde(rename = "adAccountName", deserialize_with = "Option::deserialize")]
pub ad_account_name: Option<String>,
/// The post the ad promotes, from the synced ad or else Meta's `post_id` on the click.
#[serde(rename = "platformPostId", deserialize_with = "Option::deserialize")]
pub platform_post_id: Option<String>,
/// True when the ad was created outside Zernio (synced from Ads Manager), false when created through Zernio, null when not synced.
#[serde(rename = "isExternal", deserialize_with = "Option::deserialize")]
pub is_external: Option<bool>,
}
impl ConversationAdAttribution {
/// The ad that opened the conversation, enriched from the ads Zernio syncs for the account owner. null when the conversation did not start from a Meta referral (ad click or ig.me / m.me ref link). Meta's referral carries the ad ID but no campaign or ad set ID. When the ad is in your synced ads (`GET /v1/ads`), `synced` is true and the ad name, campaign, ad set and ad account come from there. Otherwise `synced` is false, `name` falls back to the ad title (Instagram, Facebook) or headline (WhatsApp) Meta sent with the click, and the other fields are null. A team member limited to some profiles, or an API key scoped to profiles, is enriched only from the ads it can list with `GET /v1/ads`; any other ad comes back `synced` false. A non-null object with `adId` null is a referral that is not an ad click: an ig.me / m.me ref link (`name` null) or a WhatsApp click on a post (`ctwa_source_type` post, `name` is Meta's headline). Nothing is looked up in your ads for it and `synced` is false.
pub fn new(
ad_id: Option<String>,
name: Option<String>,
synced: bool,
campaign_id: Option<String>,
campaign_name: Option<String>,
ad_set_id: Option<String>,
ad_set_name: Option<String>,
ad_account_id: Option<String>,
ad_account_name: Option<String>,
platform_post_id: Option<String>,
is_external: Option<bool>,
) -> ConversationAdAttribution {
ConversationAdAttribution {
ad_id,
name,
synced,
campaign_id,
campaign_name,
ad_set_id,
ad_set_name,
ad_account_id,
ad_account_name,
platform_post_id,
is_external,
}
}
}