/*
* 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.565.0
* 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 CampaignSubmissionDetail {
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "campaignId")]
pub campaign_id: String,
#[serde(rename = "participantId")]
pub participant_id: String,
#[serde(rename = "creatorId")]
pub creator_id: String,
/// The creator account the post was published from.
#[serde(rename = "accountId")]
pub account_id: String,
/// The creator pasted a TikTok Spark code for this post, so it can launch as a Spark Ad. The code itself is never returned.
#[serde(rename = "hasSparkCode", skip_serializing_if = "Option::is_none")]
pub has_spark_code: Option<bool>,
#[serde(rename = "platform")]
pub platform: Platform,
#[serde(rename = "platformPostId")]
pub platform_post_id: String,
#[serde(rename = "platformPostUrl")]
pub platform_post_url: String,
/// The tracked external post (see /v1/external-posts).
#[serde(rename = "externalPostId")]
pub external_post_id: String,
#[serde(rename = "trackingWindowId")]
pub tracking_window_id: String,
#[serde(rename = "mediaHash")]
pub media_hash: String,
#[serde(rename = "submittedAt")]
pub submitted_at: String,
#[serde(rename = "postPublishedAt")]
pub post_published_at: String,
#[serde(rename = "status")]
pub status: Status,
#[serde(rename = "rejectReason")]
pub reject_reason: String,
/// How many times the post was reopened after a reject. 0 until the first reopen.
#[serde(rename = "reviewRound")]
pub review_round: i32,
/// User id of the reviewer.
#[serde(rename = "reviewedBy")]
pub reviewed_by: String,
#[serde(rename = "reviewedAt")]
pub reviewed_at: String,
/// Views when the post was submitted. They count toward earnings like every later view.
#[serde(rename = "viewsAtSubmission")]
pub views_at_submission: i32,
/// Latest view count read for the post, frozen at the tracking window end.
#[serde(rename = "viewsLatest")]
pub views_latest: i32,
/// Views that count toward earnings: every view the platform reports for the post, including those before submission, read at the tracking window end at the latest: once the window completes or is cancelled, the last read at or before its end is final and this value stops moving.
#[serde(rename = "viewsEligible")]
pub views_eligible: i32,
/// The campaign engagement types summed at the latest read (all four on a views campaign), frozen at the tracking window end like `viewsEligible`. An `engagements` campaign earns on this count.
#[serde(rename = "engagementsLatest")]
pub engagements_latest: i32,
/// Views from ads the creator ran: YouTube views from the advertising traffic source, X impressions beyond the organic ones. Null on other platforms and before the first read. On an organic-only campaign `viewsEligible` is the latest views minus these.
#[serde(rename = "viewsPaid")]
pub views_paid: i32,
/// When `viewsPaid` was last read. YouTube refreshes every 6 hours and reports ad views up to 2 days late; X about once a day while the post is under 30 days old.
#[serde(rename = "paidViewsReadAt")]
pub paid_views_read_at: String,
#[serde(rename = "lastAccruedViews")]
pub last_accrued_views: i32,
#[serde(rename = "accruedCents")]
pub accrued_cents: i32,
#[serde(rename = "approvedCents")]
pub approved_cents: i32,
#[serde(rename = "authenticityScore")]
pub authenticity_score: i32,
#[serde(rename = "authenticityConfidence")]
pub authenticity_confidence: f64,
#[serde(rename = "flags")]
pub flags: Vec<models::CampaignSubmissionFlag>,
/// The approved draft this post publishes, on a campaign with `requireDraftApproval`.
#[serde(rename = "draftId")]
pub draft_id: String,
#[serde(rename = "createdAt")]
pub created_at: String,
#[serde(rename = "updatedAt")]
pub updated_at: String,
#[serde(rename = "creator")]
pub creator: Box<models::CreatorCampaignAdResultsSubmissionsInnerCreator>,
#[serde(rename = "authenticity")]
pub authenticity: Box<models::CampaignSubmissionAuthenticity>,
/// approvedCents once approved, otherwise accruedCents.
#[serde(rename = "earnedCents")]
pub earned_cents: i32,
/// Approved cents whose hold is over, so payable or already paid out. 0 unless approved.
#[serde(rename = "releasedCents")]
pub released_cents: i32,
/// What rejecting this post could not take back now: releasedCents beyond the creator's payable balance. It stays paid; the dashboard warns before such a reject.
#[serde(rename = "paidOutCents")]
pub paid_out_cents: i32,
#[serde(rename = "window")]
pub window: Box<models::CampaignSubmissionWindow>,
#[serde(rename = "post")]
pub post: Box<models::CampaignSubmissionPost>,
/// Counters per sync, newest first, up to 500.
#[serde(rename = "samples")]
pub samples: Vec<models::CampaignSubmissionDetailAllOfSamples>,
}
impl CampaignSubmissionDetail {
pub fn new(
id: String,
campaign_id: String,
participant_id: String,
creator_id: String,
account_id: String,
platform: Platform,
platform_post_id: String,
platform_post_url: String,
external_post_id: String,
tracking_window_id: String,
media_hash: String,
submitted_at: String,
post_published_at: String,
status: Status,
reject_reason: String,
review_round: i32,
reviewed_by: String,
reviewed_at: String,
views_at_submission: i32,
views_latest: i32,
views_eligible: i32,
engagements_latest: i32,
views_paid: i32,
paid_views_read_at: String,
last_accrued_views: i32,
accrued_cents: i32,
approved_cents: i32,
authenticity_score: i32,
authenticity_confidence: f64,
flags: Vec<models::CampaignSubmissionFlag>,
draft_id: String,
created_at: String,
updated_at: String,
creator: models::CreatorCampaignAdResultsSubmissionsInnerCreator,
authenticity: models::CampaignSubmissionAuthenticity,
earned_cents: i32,
released_cents: i32,
paid_out_cents: i32,
window: models::CampaignSubmissionWindow,
post: models::CampaignSubmissionPost,
samples: Vec<models::CampaignSubmissionDetailAllOfSamples>,
) -> CampaignSubmissionDetail {
CampaignSubmissionDetail {
id,
campaign_id,
participant_id,
creator_id,
account_id,
has_spark_code: None,
platform,
platform_post_id,
platform_post_url,
external_post_id,
tracking_window_id,
media_hash,
submitted_at,
post_published_at,
status,
reject_reason,
review_round,
reviewed_by,
reviewed_at,
views_at_submission,
views_latest,
views_eligible,
engagements_latest,
views_paid,
paid_views_read_at,
last_accrued_views,
accrued_cents,
approved_cents,
authenticity_score,
authenticity_confidence,
flags,
draft_id,
created_at,
updated_at,
creator: Box::new(creator),
authenticity: Box::new(authenticity),
earned_cents,
released_cents,
paid_out_cents,
window: Box::new(window),
post: Box::new(post),
samples,
}
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Platform {
#[serde(rename = "tiktok")]
Tiktok,
#[serde(rename = "instagram")]
Instagram,
#[serde(rename = "youtube")]
Youtube,
#[serde(rename = "threads")]
Threads,
#[serde(rename = "pinterest")]
Pinterest,
#[serde(rename = "facebook")]
Facebook,
#[serde(rename = "twitter")]
Twitter,
}
impl Default for Platform {
fn default() -> Platform {
Self::Tiktok
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "received")]
Received,
#[serde(rename = "tracking")]
Tracking,
#[serde(rename = "pending_review")]
PendingReview,
#[serde(rename = "approved")]
Approved,
#[serde(rename = "rejected")]
Rejected,
#[serde(rename = "expired")]
Expired,
#[serde(rename = "withdrawn")]
Withdrawn,
}
impl Default for Status {
fn default() -> Status {
Self::Received
}
}