late 0.0.1078

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

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

/// AnalyticsDeltaEntryMetrics : Metrics a platform does not report are 0, not absent.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AnalyticsDeltaEntryMetrics {
    #[serde(rename = "impressions")]
    pub impressions: i32,
    #[serde(rename = "reach")]
    pub reach: i32,
    #[serde(rename = "likes")]
    pub likes: i32,
    #[serde(rename = "comments")]
    pub comments: i32,
    #[serde(rename = "shares")]
    pub shares: i32,
    #[serde(rename = "saves")]
    pub saves: i32,
    #[serde(rename = "sends")]
    pub sends: i32,
    #[serde(rename = "clicks")]
    pub clicks: i32,
    #[serde(rename = "views")]
    pub views: i32,
    /// Follows attributed to this post (Instagram)
    #[serde(rename = "follows")]
    pub follows: i32,
    /// Instagram Reels average watch time, in milliseconds
    #[serde(rename = "igReelsAvgWatchTime")]
    pub ig_reels_avg_watch_time: i32,
    /// Instagram Reels total watch time, in milliseconds
    #[serde(rename = "igReelsVideoViewTotalTime")]
    pub ig_reels_video_view_total_time: i32,
    #[serde(rename = "reposts")]
    pub reposts: i32,
    /// Instagram Reels skip rate, 0 to 1
    #[serde(rename = "reelsSkipRate")]
    pub reels_skip_rate: f64,
    /// TikTok business lane: share of viewers who watched to the end, 0 to 1
    #[serde(rename = "completionRate")]
    pub completion_rate: f64,
    /// TikTok business lane: profile views attributed to the post
    #[serde(rename = "profileViews")]
    pub profile_views: i32,
    /// TikTok business lane: website-link clicks attributed to the post (also inside clicks)
    #[serde(rename = "websiteClicks")]
    pub website_clicks: i32,
    /// TikTok business lane: share of views by surface (forYou, follow, search, personalProfile, sound, directMessage, other), fractions 0 to 1. Empty object elsewhere.
    #[serde(rename = "impressionSources")]
    pub impression_sources: std::collections::HashMap<String, f64>,
    /// TikTok business lane: follower / nonFollower and newViewer / returnViewer shares, fractions 0 to 1. Empty object elsewhere.
    #[serde(rename = "audienceTypes")]
    pub audience_types: std::collections::HashMap<String, f64>,
    /// TikTok business lane: viewer-country shares keyed by ISO-3166 alpha-2, fractions 0 to 1, top 20 with the tail in `other`. Empty object elsewhere.
    #[serde(rename = "audienceCountries")]
    pub audience_countries: std::collections::HashMap<String, f64>,
}

impl AnalyticsDeltaEntryMetrics {
    /// Metrics a platform does not report are 0, not absent.
    pub fn new(
        impressions: i32,
        reach: i32,
        likes: i32,
        comments: i32,
        shares: i32,
        saves: i32,
        sends: i32,
        clicks: i32,
        views: i32,
        follows: i32,
        ig_reels_avg_watch_time: i32,
        ig_reels_video_view_total_time: i32,
        reposts: i32,
        reels_skip_rate: f64,
        completion_rate: f64,
        profile_views: i32,
        website_clicks: i32,
        impression_sources: std::collections::HashMap<String, f64>,
        audience_types: std::collections::HashMap<String, f64>,
        audience_countries: std::collections::HashMap<String, f64>,
    ) -> AnalyticsDeltaEntryMetrics {
        AnalyticsDeltaEntryMetrics {
            impressions,
            reach,
            likes,
            comments,
            shares,
            saves,
            sends,
            clicks,
            views,
            follows,
            ig_reels_avg_watch_time,
            ig_reels_video_view_total_time,
            reposts,
            reels_skip_rate,
            completion_rate,
            profile_views,
            website_clicks,
            impression_sources,
            audience_types,
            audience_countries,
        }
    }
}