/*
* 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.522.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 AutomationTemplate {
/// A team template's id (24 hex characters), or the id of one of Zernio's templates such as `stop_losers`.
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "description")]
pub description: String,
#[serde(rename = "publisher")]
pub publisher: Box<models::AutomationTemplatePublisher>,
/// `team`: your team only. `link`: anyone with the share link can read and install it. `public`: one of Zernio's templates.
#[serde(rename = "visibility")]
pub visibility: Visibility,
/// Goes up each time the content changes. Renaming or sharing keeps it.
#[serde(rename = "version")]
pub version: i32,
/// What its automations work on.
#[serde(rename = "areas")]
pub areas: Vec<Areas>,
#[serde(rename = "inputs")]
pub inputs: Vec<models::AutomationTemplateInput>,
#[serde(rename = "automations")]
pub automations: Vec<models::AutomationTemplateAutomation>,
/// Installs across every team. Always 0 on Zernio's templates.
#[serde(rename = "installs")]
pub installs: i32,
/// Your team's automations made from it. Absent on shared and Zernio templates.
#[serde(rename = "installedInTeam", skip_serializing_if = "Option::is_none")]
pub installed_in_team: Option<i32>,
#[serde(rename = "share")]
pub share: Box<models::AutomationTemplateShare>,
/// The user who saved it. Only on your team's templates.
#[serde(rename = "createdBy", skip_serializing_if = "Option::is_none")]
pub created_by: Option<String>,
/// Absent on Zernio's templates.
#[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")]
pub created_at: Option<String>,
/// Absent on Zernio's templates.
#[serde(rename = "updatedAt", skip_serializing_if = "Option::is_none")]
pub updated_at: Option<String>,
}
impl AutomationTemplate {
pub fn new(
id: String,
name: String,
description: String,
publisher: models::AutomationTemplatePublisher,
visibility: Visibility,
version: i32,
areas: Vec<Areas>,
inputs: Vec<models::AutomationTemplateInput>,
automations: Vec<models::AutomationTemplateAutomation>,
installs: i32,
share: models::AutomationTemplateShare,
) -> AutomationTemplate {
AutomationTemplate {
id,
name,
description,
publisher: Box::new(publisher),
visibility,
version,
areas,
inputs,
automations,
installs,
installed_in_team: None,
share: Box::new(share),
created_by: None,
created_at: None,
updated_at: None,
}
}
}
/// `team`: your team only. `link`: anyone with the share link can read and install it. `public`: one of Zernio's templates.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Visibility {
#[serde(rename = "team")]
Team,
#[serde(rename = "link")]
Link,
#[serde(rename = "public")]
Public,
}
impl Default for Visibility {
fn default() -> Visibility {
Self::Team
}
}
/// What its automations work on.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Areas {
#[serde(rename = "ads")]
Ads,
#[serde(rename = "events")]
Events,
#[serde(rename = "posts")]
Posts,
#[serde(rename = "inbox")]
Inbox,
#[serde(rename = "comments")]
Comments,
}
impl Default for Areas {
fn default() -> Areas {
Self::Ads
}
}