/*
* 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.605.0
* Contact: support@zernio.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// CreatorPortalCampaign : The campaign as a creator sees it: terms, never the budget.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreatorPortalCampaign {
/// The campaign id, as in a link-recovery URL.
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "brandName")]
pub brand_name: String,
#[serde(rename = "logoUrl", deserialize_with = "Option::deserialize")]
pub logo_url: Option<String>,
/// Same keys as the `welcomeTheme` parameter of `GET /v1/connect/{platform}`.
#[serde(rename = "theme", deserialize_with = "Option::deserialize")]
pub theme: Option<serde_json::Value>,
#[serde(rename = "status")]
pub status: Status,
#[serde(rename = "platforms")]
pub platforms: Vec<String>,
#[serde(rename = "contentRules", deserialize_with = "Option::deserialize")]
pub content_rules: Option<String>,
#[serde(rename = "startsAt", deserialize_with = "Option::deserialize")]
pub starts_at: Option<String>,
#[serde(rename = "endsAt", deserialize_with = "Option::deserialize")]
pub ends_at: Option<String>,
/// Posts published before this moment do not count: `startsAt`, else when the campaign went live.
#[serde(rename = "startedAt")]
pub started_at: String,
#[serde(rename = "currency")]
pub currency: String,
#[serde(rename = "economics")]
pub economics: Box<models::CreatorPortalEconomics>,
/// A post must be submitted within this many minutes of publishing. Null means any age. Either way, only posts published after the campaign started are accepted.
#[serde(rename = "maxPostAgeMinutes", deserialize_with = "Option::deserialize")]
pub max_post_age_minutes: Option<i32>,
/// Days approved earnings stay owed before they become payable.
#[serde(rename = "holdDays")]
pub hold_days: i32,
/// Days each submitted post is tracked for views.
#[serde(rename = "trackingDays")]
pub tracking_days: i32,
/// How many connected accounts can submit posts. Null means no limit.
#[serde(
rename = "maxAccountsPerParticipant",
deserialize_with = "Option::deserialize"
)]
pub max_accounts_per_participant: Option<i32>,
/// manual: a creator who joins through the open link waits `pending` until the campaign team accepts them.
#[serde(rename = "joinApproval")]
pub join_approval: JoinApproval,
/// The creator uploads a draft for review first, and submits the live post for an approved draft.
#[serde(rename = "requireDraftApproval")]
pub require_draft_approval: bool,
/// Products the creator can ask a free sample of; empty when the campaign offers none.
#[serde(rename = "sampleProducts")]
pub sample_products: Vec<models::CreatorCampaignSampleProduct>,
/// Days after a sample is approved by which a post is expected.
#[serde(rename = "sampleContentDueDays")]
pub sample_content_due_days: i32,
}
impl CreatorPortalCampaign {
/// The campaign as a creator sees it: terms, never the budget.
pub fn new(
id: String,
name: String,
brand_name: String,
logo_url: Option<String>,
theme: Option<serde_json::Value>,
status: Status,
platforms: Vec<String>,
content_rules: Option<String>,
starts_at: Option<String>,
ends_at: Option<String>,
started_at: String,
currency: String,
economics: models::CreatorPortalEconomics,
max_post_age_minutes: Option<i32>,
hold_days: i32,
tracking_days: i32,
max_accounts_per_participant: Option<i32>,
join_approval: JoinApproval,
require_draft_approval: bool,
sample_products: Vec<models::CreatorCampaignSampleProduct>,
sample_content_due_days: i32,
) -> CreatorPortalCampaign {
CreatorPortalCampaign {
id,
name,
brand_name,
logo_url,
theme,
status,
platforms,
content_rules,
starts_at,
ends_at,
started_at,
currency,
economics: Box::new(economics),
max_post_age_minutes,
hold_days,
tracking_days,
max_accounts_per_participant,
join_approval,
require_draft_approval,
sample_products,
sample_content_due_days,
}
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "draft")]
Draft,
#[serde(rename = "active")]
Active,
#[serde(rename = "paused")]
Paused,
#[serde(rename = "closed")]
Closed,
}
impl Default for Status {
fn default() -> Status {
Self::Draft
}
}
/// manual: a creator who joins through the open link waits `pending` until the campaign team accepts them.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum JoinApproval {
#[serde(rename = "auto")]
Auto,
#[serde(rename = "manual")]
Manual,
}
impl Default for JoinApproval {
fn default() -> JoinApproval {
Self::Auto
}
}