/*
* 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).
*
* The version of the OpenAPI document: 1.71.0
* Contact: support@zernio.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// AnalyticsDeltaEntry : One changed analytics snapshot. Metrics are the absolute values recorded at `syncedAt`, not the amount they moved by since the previous snapshot, so a later entry for the same `postId` always supersedes an earlier one.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AnalyticsDeltaEntry {
/// External post ID. The same identifier as `posts[]._id` in GET /v1/analytics.
#[serde(rename = "postId")]
pub post_id: String,
/// Account this post was published through
#[serde(rename = "accountId")]
pub account_id: String,
/// Profile the account belongs to
#[serde(rename = "profileId")]
pub profile_id: String,
#[serde(rename = "platform")]
pub platform: String,
/// Platform-side post ID (for example the YouTube video ID)
#[serde(rename = "platformPostId")]
pub platform_post_id: String,
/// When the post was published, ISO-8601 UTC
#[serde(rename = "publishedAt")]
pub published_at: String,
/// When the sync cycle that produced this snapshot STARTED, ISO-8601 UTC. This is NOT the order entries arrive in and it is not a resume point: a slow cycle writes its rows after a faster cycle that started later, so `syncedAt` can go backwards between consecutive entries. Use `nextCursor` to resume.
#[serde(rename = "syncedAt")]
pub synced_at: String,
/// True when the post was detected as deleted on the platform at this sync
#[serde(rename = "isDeleted")]
pub is_deleted: bool,
#[serde(rename = "metrics")]
pub metrics: Box<models::AnalyticsDeltaEntryMetrics>,
}
impl AnalyticsDeltaEntry {
/// One changed analytics snapshot. Metrics are the absolute values recorded at `syncedAt`, not the amount they moved by since the previous snapshot, so a later entry for the same `postId` always supersedes an earlier one.
pub fn new(
post_id: String,
account_id: String,
profile_id: String,
platform: String,
platform_post_id: String,
published_at: String,
synced_at: String,
is_deleted: bool,
metrics: models::AnalyticsDeltaEntryMetrics,
) -> AnalyticsDeltaEntry {
AnalyticsDeltaEntry {
post_id,
account_id,
profile_id,
platform,
platform_post_id,
published_at,
synced_at,
is_deleted,
metrics: Box::new(metrics),
}
}
}