/*
* 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.0.4
* Contact: support@zernio.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SocialAccount {
#[serde(rename = "_id")]
pub _id: String,
#[serde(rename = "platform")]
pub platform: Platform,
#[serde(rename = "profileId")]
pub profile_id: Box<models::SocialAccountProfileId>,
#[serde(rename = "username", skip_serializing_if = "Option::is_none")]
pub username: Option<String>,
#[serde(rename = "displayName", skip_serializing_if = "Option::is_none")]
pub display_name: Option<String>,
/// URL to the account's profile picture on the platform. May be null if the platform does not provide one.
#[serde(
rename = "profilePicture",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub profile_picture: Option<Option<String>>,
/// Full profile URL for the connected account on its platform.
#[serde(rename = "profileUrl", skip_serializing_if = "Option::is_none")]
pub profile_url: Option<String>,
#[serde(rename = "isActive")]
pub is_active: bool,
/// The platform definitively reported the stored OAuth token as dead. While true, GET /v1/connect/{platform}/ads returns a fresh authUrl (implicit force=true) instead of alreadyConnected, so re-running the connect flow recovers the account. Cleared automatically when the account is re-authorized.
#[serde(rename = "needsReconnection", skip_serializing_if = "Option::is_none")]
pub needs_reconnection: Option<bool>,
/// Follower count (only included if user has analytics add-on)
#[serde(rename = "followersCount", skip_serializing_if = "Option::is_none")]
pub followers_count: Option<f64>,
/// Last time follower count was updated (only included if user has analytics add-on)
#[serde(
rename = "followersLastUpdated",
skip_serializing_if = "Option::is_none"
)]
pub followers_last_updated: Option<String>,
/// Reference to the parent posting SocialAccount. Set for ads accounts that share or derive from a posting account's OAuth token. null for standalone ads (Google Ads) and all posting accounts.
#[serde(
rename = "parentAccountId",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub parent_account_id: Option<Option<String>>,
/// Whether the user explicitly activated this account. false means the account was created as a side effect (e.g., posting account auto-created when user connected ads first). Posting UI and scheduler ignore accounts with enabled: false.
#[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
pub enabled: Option<bool>,
/// Platform-specific metadata. Fields vary by platform. For WhatsApp accounts, includes: - qualityRating: Phone number quality rating from Meta (GREEN, YELLOW, RED, or UNKNOWN) - nameStatus: Display name review status (APPROVED, PENDING_REVIEW, DECLINED, or NONE). A declined or pending display name does not by itself block sending; sendability is reported separately via health_status (can_send_message). - messagingLimitTier: Maximum unique business-initiated conversations per 24h rolling window (TIER_250, TIER_1K, TIER_10K, TIER_100K, or TIER_UNLIMITED). Scales automatically as quality rating improves. - verifiedName: Meta-verified business display name - displayPhoneNumber: Formatted phone number (e.g., \"+1 555-123-4567\") - wabaId: WhatsApp Business Account ID - phoneNumberId: Meta phone number ID For LinkedIn accounts, profileData carries the profile details refreshed on each daily snapshot: - profileData.bio: The member's headline for personal accounts, or the organization description for organization accounts. null when the member has not set one. - profileData.extraData.vanityName: The member's profile slug, i.e. the /in/{vanityName} segment of profileUrl. Personal accounts only; an organization's own slug is in metadata.organizationInfo.vanityName.
#[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
pub metadata: Option<serde_json::Value>,
}
impl SocialAccount {
pub fn new(
_id: String,
platform: Platform,
profile_id: models::SocialAccountProfileId,
is_active: bool,
) -> SocialAccount {
SocialAccount {
_id,
platform,
profile_id: Box::new(profile_id),
username: None,
display_name: None,
profile_picture: None,
profile_url: None,
is_active,
needs_reconnection: None,
followers_count: None,
followers_last_updated: None,
parent_account_id: None,
enabled: None,
metadata: None,
}
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Platform {
#[serde(rename = "tiktok")]
Tiktok,
#[serde(rename = "instagram")]
Instagram,
#[serde(rename = "facebook")]
Facebook,
#[serde(rename = "youtube")]
Youtube,
#[serde(rename = "linkedin")]
Linkedin,
#[serde(rename = "twitter")]
Twitter,
#[serde(rename = "threads")]
Threads,
#[serde(rename = "pinterest")]
Pinterest,
#[serde(rename = "reddit")]
Reddit,
#[serde(rename = "bluesky")]
Bluesky,
#[serde(rename = "googlebusiness")]
Googlebusiness,
#[serde(rename = "telegram")]
Telegram,
#[serde(rename = "snapchat")]
Snapchat,
#[serde(rename = "discord")]
Discord,
#[serde(rename = "slack")]
Slack,
#[serde(rename = "whatsapp")]
Whatsapp,
#[serde(rename = "linkedinads")]
Linkedinads,
#[serde(rename = "metaads")]
Metaads,
#[serde(rename = "pinterestads")]
Pinterestads,
#[serde(rename = "tiktokads")]
Tiktokads,
#[serde(rename = "xads")]
Xads,
#[serde(rename = "googleads")]
Googleads,
#[serde(rename = "openaiads")]
Openaiads,
#[serde(rename = "sms")]
Sms,
#[serde(rename = "phone")]
Phone,
#[serde(rename = "rcs")]
Rcs,
}
impl Default for Platform {
fn default() -> Platform {
Self::Tiktok
}
}