ghl-models 0.3.1

Rust data models (DTOs) for the GoHighLevel (HighLevel) API v2 and v3, generated from the official OpenAPI specifications
Documentation
//! `emails` data models for GoHighLevel API V2 (12 types).
//!
//! Generated from HighLevel's official OpenAPI spec for the
//! **Emails** module. Every endpoint that uses these types, with its
//! parameters, required scopes and enum values, is documented in the
//! [`emails` API reference](https://github.com/Shahroz/ghl-rs/blob/main/docs/api/emails.md).
//!
//! Enable with `features = ["emails"]`.
// @generated by xtask/generate_models.py — do not edit by hand.
// Source: https://github.com/GoHighLevel/highlevel-api-docs
// Doc comments are HighLevel's own field descriptions, reflowed verbatim, so
// they aren't held to rustdoc's markdown conventions.
#![allow(
    missing_docs,
    clippy::doc_lazy_continuation,
    clippy::doc_overindented_list_items
)]

use serde::{Deserialize, Serialize};

/// `BuilderUpdateSuccessfulDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct BuilderUpdateSuccessfulDTO {
    /// ok
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub ok: Option<String>,
    /// trace id
    #[serde(rename = "traceId", default, skip_serializing_if = "Option::is_none")]
    pub trace_id: Option<String>,
    /// preview url
    #[serde(
        rename = "previewUrl",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub preview_url: Option<String>,
    /// template data download url
    #[serde(
        rename = "templateDownloadUrl",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub template_download_url: Option<String>,
}

/// `CreateBuilderDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct CreateBuilderDto {
    /// Required by the API.
    #[serde(rename = "locationId")]
    pub location_id: String,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub title: Option<String>,
    /// Allowed values: `html`, `folder`, `import`, `builder`, `blank`.
    /// Required by the API.
    #[serde(rename = "type")]
    pub type_: String,
    #[serde(rename = "updatedBy", default, skip_serializing_if = "Option::is_none")]
    pub updated_by: Option<String>,
    /// Allowed values: `1`, `2`.
    #[serde(
        rename = "builderVersion",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub builder_version: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    #[serde(rename = "parentId", default, skip_serializing_if = "Option::is_none")]
    pub parent_id: Option<String>,
    #[serde(
        rename = "templateDataUrl",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub template_data_url: Option<String>,
    /// Allowed values: `mailchimp`, `active_campaign`, `kajabi`.
    /// Required by the API.
    #[serde(rename = "importProvider")]
    pub import_provider: String,
    #[serde(rename = "importURL", default, skip_serializing_if = "Option::is_none")]
    pub import_url: Option<String>,
    #[serde(
        rename = "templateSource",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub template_source: Option<String>,
    #[serde(
        rename = "isPlainText",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub is_plain_text: Option<bool>,
}

/// `CreateBuilderSuccesfulResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct CreateBuilderSuccesfulResponseDto {
    /// template id
    /// Required by the API.
    pub redirect: String,
    /// trace id
    /// Required by the API.
    #[serde(rename = "traceId")]
    pub trace_id: String,
}

/// `DeleteBuilderSuccesfulResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct DeleteBuilderSuccesfulResponseDto {
    /// ok
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub ok: Option<String>,
    /// trace id
    #[serde(rename = "traceId", default, skip_serializing_if = "Option::is_none")]
    pub trace_id: Option<String>,
}

/// `FetchBuilderSuccesfulResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct FetchBuilderSuccesfulResponseDto {
    /// template name
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// updated by
    #[serde(rename = "updatedBy", default, skip_serializing_if = "Option::is_none")]
    pub updated_by: Option<String>,
    /// plain text based template
    #[serde(
        rename = "isPlainText",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub is_plain_text: Option<bool>,
    /// last updated
    #[serde(
        rename = "lastUpdated",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub last_updated: Option<String>,
    /// date added
    #[serde(rename = "dateAdded", default, skip_serializing_if = "Option::is_none")]
    pub date_added: Option<String>,
    /// preview url
    #[serde(
        rename = "previewUrl",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub preview_url: Option<String>,
    /// id
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// version
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub version: Option<String>,
    /// type
    #[serde(
        rename = "templateType",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub template_type: Option<String>,
}

/// `IBuilderJsonMapper` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct IBuilderJsonMapper {
    /// Required by the API.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub elements: Vec<String>,
    /// Required by the API.
    pub attrs: serde_json::Value,
    /// Required by the API.
    #[serde(rename = "templateSettings")]
    pub template_settings: TemplateSettings,
}

/// `InvalidLocationDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct InvalidLocationDTO {
    #[serde(
        rename = "statusCode",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub status_code: Option<f64>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub message: Option<String>,
}

/// `NotFoundDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct NotFoundDTO {
    #[serde(
        rename = "statusCode",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub status_code: Option<f64>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub message: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub error: Option<String>,
}

/// `SaveBuilderDataDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct SaveBuilderDataDto {
    /// Required by the API.
    #[serde(rename = "locationId")]
    pub location_id: String,
    /// Required by the API.
    #[serde(rename = "templateId")]
    pub template_id: String,
    /// Required by the API.
    #[serde(rename = "updatedBy")]
    pub updated_by: String,
    /// Required by the API.
    pub dnd: IBuilderJsonMapper,
    /// Required by the API.
    pub html: String,
    /// Allowed values: `html`, `builder`.
    /// Required by the API.
    #[serde(rename = "editorType")]
    pub editor_type: String,
    #[serde(
        rename = "previewText",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub preview_text: Option<String>,
    #[serde(
        rename = "isPlainText",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub is_plain_text: Option<bool>,
}

/// `ScheduleDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ScheduleDto {
    /// Required by the API.
    pub name: String,
    /// Required by the API.
    #[serde(rename = "repeatAfter")]
    pub repeat_after: String,
    /// Required by the API.
    pub id: String,
    /// Required by the API.
    #[serde(rename = "parentId")]
    pub parent_id: String,
    /// Required by the API.
    #[serde(rename = "childCount")]
    pub child_count: f64,
    /// Required by the API.
    #[serde(rename = "campaignType")]
    pub campaign_type: String,
    /// Required by the API.
    #[serde(rename = "bulkActionVersion")]
    pub bulk_action_version: String,
    /// Required by the API.
    #[serde(rename = "_id")]
    pub id_alt: String,
    /// Required by the API.
    pub status: String,
    /// Required by the API.
    #[serde(rename = "sendDays", default, skip_serializing_if = "Vec::is_empty")]
    pub send_days: Vec<String>,
    /// Required by the API.
    pub deleted: bool,
    /// Required by the API.
    pub migrated: bool,
    /// Required by the API.
    pub archived: bool,
    /// Required by the API.
    #[serde(rename = "hasTracking")]
    pub has_tracking: bool,
    /// Required by the API.
    #[serde(rename = "isPlainText")]
    pub is_plain_text: bool,
    /// Required by the API.
    #[serde(rename = "hasUtmTracking")]
    pub has_utm_tracking: bool,
    /// Required by the API.
    #[serde(rename = "enableResendToUnopened")]
    pub enable_resend_to_unopened: bool,
    /// Required by the API.
    #[serde(rename = "locationId")]
    pub location_id: String,
    /// Required by the API.
    #[serde(rename = "templateId")]
    pub template_id: String,
    /// Required by the API.
    #[serde(rename = "templateType")]
    pub template_type: String,
    /// Required by the API.
    #[serde(rename = "createdAt")]
    pub created_at: String,
    /// Required by the API.
    #[serde(rename = "updatedAt")]
    pub updated_at: String,
    /// Required by the API.
    #[serde(rename = "__v")]
    pub v: f64,
    /// Required by the API.
    #[serde(rename = "documentId")]
    pub document_id: String,
    /// Required by the API.
    #[serde(rename = "downloadUrl")]
    pub download_url: String,
    /// Required by the API.
    #[serde(rename = "templateDataDownloadUrl")]
    pub template_data_download_url: String,
    /// Required by the API.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub child: Vec<String>,
}

/// `ScheduleFetchSuccessfulDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ScheduleFetchSuccessfulDTO {
    /// The list of campaigns
    /// Required by the API.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub schedules: Vec<ScheduleDto>,
    /// The total number of campaigns
    /// Required by the API.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub total: Vec<String>,
    /// Trace Id
    /// Required by the API.
    #[serde(rename = "traceId")]
    pub trace_id: String,
}

/// `TemplateSettings` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct TemplateSettings {
    /// The spec defines no fields for this schema.
    #[serde(flatten)]
    pub extra: serde_json::Map<String, serde_json::Value>,
}