/*
* 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.531.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 CampaignSubmission {
#[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,
#[serde(rename = "platform")]
pub platform: Platform,
#[serde(rename = "platformPostId")]
pub platform_post_id: String,
#[serde(rename = "platformPostUrl", deserialize_with = "Option::deserialize")]
pub platform_post_url: Option<String>,
/// The tracked external post (see /v1/external-posts).
#[serde(rename = "externalPostId", deserialize_with = "Option::deserialize")]
pub external_post_id: Option<String>,
#[serde(rename = "trackingWindowId", deserialize_with = "Option::deserialize")]
pub tracking_window_id: Option<String>,
#[serde(rename = "mediaHash", deserialize_with = "Option::deserialize")]
pub media_hash: Option<String>,
#[serde(rename = "submittedAt")]
pub submitted_at: String,
#[serde(rename = "postPublishedAt", deserialize_with = "Option::deserialize")]
pub post_published_at: Option<String>,
#[serde(rename = "status")]
pub status: Status,
#[serde(rename = "rejectReason", deserialize_with = "Option::deserialize")]
pub reject_reason: Option<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", deserialize_with = "Option::deserialize")]
pub reviewed_by: Option<String>,
#[serde(rename = "reviewedAt", deserialize_with = "Option::deserialize")]
pub reviewed_at: Option<String>,
/// Views when the post was submitted. They count toward earnings like every later view.
#[serde(rename = "viewsAtSubmission", deserialize_with = "Option::deserialize")]
pub views_at_submission: Option<i32>,
/// Latest view count read for the post, frozen at the tracking window end.
#[serde(rename = "viewsLatest", deserialize_with = "Option::deserialize")]
pub views_latest: Option<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", deserialize_with = "Option::deserialize")]
pub views_eligible: Option<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", deserialize_with = "Option::deserialize")]
pub engagements_latest: Option<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", deserialize_with = "Option::deserialize")]
pub views_paid: Option<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", deserialize_with = "Option::deserialize")]
pub paid_views_read_at: Option<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", deserialize_with = "Option::deserialize")]
pub authenticity_score: Option<i32>,
#[serde(
rename = "authenticityConfidence",
deserialize_with = "Option::deserialize"
)]
pub authenticity_confidence: Option<f64>,
#[serde(rename = "flags")]
pub flags: Vec<models::CampaignSubmissionFlag>,
#[serde(rename = "createdAt")]
pub created_at: String,
#[serde(rename = "updatedAt")]
pub updated_at: String,
#[serde(rename = "creator")]
pub creator: Box<models::WebhookPayloadCampaignSubmissionCreator>,
#[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>,
}
impl CampaignSubmission {
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: Option<String>,
external_post_id: Option<String>,
tracking_window_id: Option<String>,
media_hash: Option<String>,
submitted_at: String,
post_published_at: Option<String>,
status: Status,
reject_reason: Option<String>,
review_round: i32,
reviewed_by: Option<String>,
reviewed_at: Option<String>,
views_at_submission: Option<i32>,
views_latest: Option<i32>,
views_eligible: Option<i32>,
engagements_latest: Option<i32>,
views_paid: Option<i32>,
paid_views_read_at: Option<String>,
last_accrued_views: i32,
accrued_cents: i32,
approved_cents: i32,
authenticity_score: Option<i32>,
authenticity_confidence: Option<f64>,
flags: Vec<models::CampaignSubmissionFlag>,
created_at: String,
updated_at: String,
creator: models::WebhookPayloadCampaignSubmissionCreator,
authenticity: models::CampaignSubmissionAuthenticity,
earned_cents: i32,
released_cents: i32,
paid_out_cents: i32,
window: models::CampaignSubmissionWindow,
post: models::CampaignSubmissionPost,
) -> CampaignSubmission {
CampaignSubmission {
id,
campaign_id,
participant_id,
creator_id,
account_id,
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,
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),
}
}
}
///
#[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
}
}