/*
* 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 CreatorPortalSubmission {
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "platform")]
pub platform: String,
#[serde(rename = "postId")]
pub post_id: String,
/// A TikTok post whose Spark code the creator pasted, so the brand can run it as a Spark Ad. The code itself is never returned.
#[serde(rename = "hasSparkCode")]
pub has_spark_code: bool,
#[serde(rename = "url", deserialize_with = "Option::deserialize")]
pub url: Option<String>,
#[serde(rename = "status")]
pub status: Status,
#[serde(rename = "submittedAt")]
pub submitted_at: String,
#[serde(rename = "publishedAt", deserialize_with = "Option::deserialize")]
pub published_at: Option<String>,
/// Latest view count read for the post.
#[serde(rename = "views")]
pub views: i32,
/// The campaign engagement types summed at the latest read. Null until the post is read.
#[serde(rename = "engagements", deserialize_with = "Option::deserialize")]
pub engagements: Option<i32>,
/// Views that came from ads the creator ran, on YouTube and X. Null where the platform does not report them or before the first read.
#[serde(rename = "viewsFromAds", deserialize_with = "Option::deserialize")]
pub views_from_ads: Option<i32>,
#[serde(rename = "earnedCents")]
pub earned_cents: i32,
#[serde(rename = "rejectReason", deserialize_with = "Option::deserialize")]
pub reject_reason: Option<String>,
/// Creator-safe flags only. Every other review flag shows as `under_review`.
#[serde(rename = "flags")]
pub flags: Vec<Flags>,
#[serde(rename = "trackingEndsAt", deserialize_with = "Option::deserialize")]
pub tracking_ends_at: Option<String>,
/// The approved draft this post publishes.
#[serde(rename = "draftId", deserialize_with = "Option::deserialize")]
pub draft_id: Option<String>,
}
impl CreatorPortalSubmission {
pub fn new(
id: String,
platform: String,
post_id: String,
has_spark_code: bool,
url: Option<String>,
status: Status,
submitted_at: String,
published_at: Option<String>,
views: i32,
engagements: Option<i32>,
views_from_ads: Option<i32>,
earned_cents: i32,
reject_reason: Option<String>,
flags: Vec<Flags>,
tracking_ends_at: Option<String>,
draft_id: Option<String>,
) -> CreatorPortalSubmission {
CreatorPortalSubmission {
id,
platform,
post_id,
has_spark_code,
url,
status,
submitted_at,
published_at,
views,
engagements,
views_from_ads,
earned_cents,
reject_reason,
flags,
tracking_ends_at,
draft_id,
}
}
}
///
#[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
}
}
/// Creator-safe flags only. Every other review flag shows as `under_review`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Flags {
#[serde(rename = "unreachable")]
Unreachable,
#[serde(rename = "post_deleted")]
PostDeleted,
#[serde(rename = "duplicate_post")]
DuplicatePost,
#[serde(rename = "under_review")]
UnderReview,
}
impl Default for Flags {
fn default() -> Flags {
Self::Unreachable
}
}