/*
* 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};
/// TrackingTag : A platform measurement tag: the thing you create, install on a website, send events to, and target ads against. On Meta this is a Pixel (`kind: pixel`). The shape is platform-neutral so other platforms (Pinterest Tag, LinkedIn Insight Tag, etc.) can be added without changing the contract; platform-specific fields are absent where a platform has no equivalent. Returned by `listTrackingTags`, `createTrackingTag`, `getTrackingTag`, and `updateTrackingTag`.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct TrackingTag {
/// Platform-native tag id. Meta: numeric pixel id, as a string.
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "platform")]
pub platform: Platform,
/// Platform-native flavor of the tag (Meta: `pixel`).
#[serde(rename = "kind")]
pub kind: Kind,
/// `inactive` when the platform reports the tag as broken/unavailable.
#[serde(rename = "status")]
pub status: Status,
/// The base-code `<script>` snippet to install on the site. Meta only; populated by `getTrackingTag`, omitted from the list view.
#[serde(rename = "code", skip_serializing_if = "Option::is_none")]
pub code: Option<String>,
/// Unix seconds of the last event the tag received, or `null` if it never fired. The practical \"is it installed and working\" signal.
#[serde(
rename = "lastFiredTime",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub last_fired_time: Option<Option<i32>>,
/// Whether the tag is in a broken/unavailable state (Meta `is_unavailable`).
#[serde(rename = "isUnavailable", skip_serializing_if = "Option::is_none")]
pub is_unavailable: Option<bool>,
/// Convenience flag derived from `lastFiredTime`: has the tag ever fired.
#[serde(rename = "installed", skip_serializing_if = "Option::is_none")]
pub installed: Option<bool>,
/// Unix seconds the tag was created.
#[serde(rename = "creationTime", skip_serializing_if = "Option::is_none")]
pub creation_time: Option<i32>,
/// Business Manager id that owns the tag, or `null` when the tag lives on a personal (non-BM) ad account. Such tags can't be shared with other ad accounts.
#[serde(
rename = "ownerBusinessId",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub owner_business_id: Option<Option<String>>,
/// Ad account id (`act_...`) that owns the tag, when reported.
#[serde(rename = "ownerAdAccountId", skip_serializing_if = "Option::is_none")]
pub owner_ad_account_id: Option<String>,
}
impl TrackingTag {
/// A platform measurement tag: the thing you create, install on a website, send events to, and target ads against. On Meta this is a Pixel (`kind: pixel`). The shape is platform-neutral so other platforms (Pinterest Tag, LinkedIn Insight Tag, etc.) can be added without changing the contract; platform-specific fields are absent where a platform has no equivalent. Returned by `listTrackingTags`, `createTrackingTag`, `getTrackingTag`, and `updateTrackingTag`.
pub fn new(
id: String,
name: String,
platform: Platform,
kind: Kind,
status: Status,
) -> TrackingTag {
TrackingTag {
id,
name,
platform,
kind,
status,
code: None,
last_fired_time: None,
is_unavailable: None,
installed: None,
creation_time: None,
owner_business_id: None,
owner_ad_account_id: None,
}
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Platform {
#[serde(rename = "metaads")]
Metaads,
}
impl Default for Platform {
fn default() -> Platform {
Self::Metaads
}
}
/// Platform-native flavor of the tag (Meta: `pixel`).
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Kind {
#[serde(rename = "pixel")]
Pixel,
#[serde(rename = "tag")]
Tag,
#[serde(rename = "insight_tag")]
InsightTag,
}
impl Default for Kind {
fn default() -> Kind {
Self::Pixel
}
}
/// `inactive` when the platform reports the tag as broken/unavailable.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "active")]
Active,
#[serde(rename = "inactive")]
Inactive,
}
impl Default for Status {
fn default() -> Status {
Self::Active
}
}