ghl-models 0.3.1

Rust data models (DTOs) for the GoHighLevel (HighLevel) API v2 and v3, generated from the official OpenAPI specifications
Documentation
//! `marketplace` data models for GoHighLevel API V3 (13 types).
//!
//! Generated from HighLevel's official OpenAPI spec for the
//! **Marketplace** module. Every endpoint that uses these types, with its
//! parameters, required scopes and enum values, is documented in the
//! [`marketplace` API reference](https://github.com/Shahroz/ghl-rs/blob/main/docs/api/marketplace.md).
//!
//! Enable with `features = ["marketplace"]`.
// @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};

/// `DeleteIntegrationBodyDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct DeleteIntegrationBodyDto {
    /// The company id from which the application is to be uninstalled. If you pass agency
    /// token, then companyId is required. It will uninstall application from agency as well as
    /// all sub-accounts.
    #[serde(rename = "companyId", default, skip_serializing_if = "Option::is_none")]
    pub company_id: Option<String>,
    /// The location id from which the application is to be uninstalled. If you pass location
    /// token, then locationId is required. It will uninstall application from that location
    /// only.
    #[serde(
        rename = "locationId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub location_id: Option<String>,
    /// The reason for uninstalling the application. Reason is required if you are uninstalling
    /// the application as a developer.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub reason: Option<String>,
}

/// `DeleteIntegrationResponse` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct DeleteIntegrationResponse {
    /// The status of the uninstallation of the application
    /// Required by the API.
    pub success: bool,
}

/// `GetInstallerDetailsResponseDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct GetInstallerDetailsResponseDTO {
    /// Installation details
    /// Required by the API.
    #[serde(rename = "installationDetails")]
    pub installation_details: InstallerDetailsDTO,
}

/// `GetRebillingConfigResponseDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct GetRebillingConfigResponseDTO {
    /// The rebilling plans configuration
    /// Required by the API.
    pub plans: PlansDTO,
}

/// `InstallerDetailsDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct InstallerDetailsDTO {
    /// Company ID
    /// Required by the API.
    #[serde(rename = "companyId")]
    pub company_id: String,
    /// Location ID (if applicable)
    #[serde(
        rename = "locationId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub location_id: Option<String>,
    /// Company name
    /// Required by the API.
    #[serde(rename = "companyName")]
    pub company_name: String,
    /// Company relationship number
    /// Required by the API.
    #[serde(rename = "relationshipNumber")]
    pub relationship_number: String,
    /// Company email. Will be null for sub-account installations due to PII concerns.
    #[serde(
        rename = "companyEmail",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub company_email: Option<String>,
    /// Company owner full name. Will be null for sub-account installations due to PII concerns.
    #[serde(
        rename = "companyOwnerFullName",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub company_owner_full_name: Option<String>,
    /// User ID who installed the app
    /// Required by the API.
    #[serde(rename = "userId")]
    pub user_id: String,
    /// Whether the company is a whitelabel company
    /// Required by the API.
    #[serde(rename = "isWhitelabelCompany")]
    pub is_whitelabel_company: bool,
    /// Company plan. Will be null for sub-account installations due to business sensitivity.
    #[serde(
        rename = "companyPlan",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub company_plan: Option<String>,
    /// Company plan. Will be null for sub-account installations due to business sensitivity.
    #[serde(
        rename = "companyHighLevelPlan",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub company_high_level_plan: Option<String>,
    /// Marketplace app plan ID for paid apps
    #[serde(
        rename = "marketplaceAppPlanId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub marketplace_app_plan_id: Option<String>,
    /// Whitelabel details (only present if isWhitelabelCompany is true)
    #[serde(
        rename = "whitelabelDetails",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub whitelabel_details: Option<WhitelabelDetailsDTO>,
}

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

/// `MigrateConnectionDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct MigrateConnectionDto {
    /// Type of authentication - basic or oauth2
    /// Allowed values: `oauth2`, `basic`.
    /// Required by the API.
    #[serde(rename = "type")]
    pub type_: String,
    /// Location ID
    /// Required by the API.
    #[serde(rename = "locationId")]
    pub location_id: String,
    /// App ID
    /// Required by the API.
    #[serde(rename = "appId")]
    pub app_id: String,
    /// App Version ID
    /// Required by the API.
    #[serde(rename = "appVersionId")]
    pub app_version_id: String,
    /// Connection identifier
    /// Required by the API.
    #[serde(rename = "accountId")]
    pub account_id: String,
    /// API Key (supported when type is basic)
    #[serde(rename = "apiKey", default, skip_serializing_if = "Option::is_none")]
    pub api_key: Option<String>,
    /// Basic auth credentials as key/value pairs (supported when type is basic). Keys are
    /// validated against the app version externalAuthConfig.fields.
    #[serde(
        rename = "basicCredentials",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub basic_credentials: Option<serde_json::Value>,
    /// Access token (required when type is oauth2)
    #[serde(
        rename = "accessToken",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub access_token: Option<String>,
    /// Refresh token (required when type is oauth2)
    #[serde(
        rename = "refreshToken",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub refresh_token: Option<String>,
    /// Access token expiry time in milliseconds (optional for oauth2)
    #[serde(rename = "expiryIn", default, skip_serializing_if = "Option::is_none")]
    pub expiry_in: Option<f64>,
    /// Timestamp for access token expiry (optional for oauth2)
    #[serde(rename = "expiryAt", default, skip_serializing_if = "Option::is_none")]
    pub expiry_at: Option<f64>,
    /// OAuth2 scopes (optional for oauth2)
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub scopes: Vec<String>,
    /// Display name for the connection (optional, defaults to accountId)
    #[serde(
        rename = "displayName",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub display_name: Option<String>,
    /// Whether this is the default connection for the location (optional, defaults to false)
    #[serde(rename = "isDefault", default, skip_serializing_if = "Option::is_none")]
    pub is_default: Option<bool>,
}

/// `MigrateConnectionResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct MigrateConnectionResponseDto {
    /// Indicates if the migration was successful
    /// Required by the API.
    pub success: bool,
    /// Unique identifier for the migrated connection
    /// Required by the API.
    pub identifier: String,
    /// Message describing the result
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub message: Option<String>,
}

/// `PlansDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PlansDTO {
    /// Subscription plans
    /// Required by the API.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub subscription: Vec<SubscriptionPlanDTO>,
    /// Usage-based plans
    /// Required by the API.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub usage: Vec<UsagePlanDTO>,
}

/// `RaiseChargeBodyDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct RaiseChargeBodyDTO {
    /// App ID of the App
    /// Required by the API.
    #[serde(rename = "appId")]
    pub app_id: String,
    /// Billing Meter ID (you can find this on your app's pricing page)
    /// Required by the API.
    #[serde(rename = "meterId")]
    pub meter_id: String,
    /// Event ID / Transaction ID on your server's side. This will help you maintain the
    /// reference of the event/transaction on your end that you charged the customer for.
    /// Required by the API.
    #[serde(rename = "eventId")]
    pub event_id: String,
    /// User ID
    #[serde(rename = "userId", default, skip_serializing_if = "Option::is_none")]
    pub user_id: Option<String>,
    /// ID of the Sub-Account to be charged
    /// Required by the API.
    #[serde(rename = "locationId")]
    pub location_id: String,
    /// ID of the Agency the Sub-account belongs to
    /// Required by the API.
    #[serde(rename = "companyId")]
    pub company_id: String,
    /// Description of the charge
    /// Required by the API.
    pub description: String,
    /// Price per unit to charge
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub price: Option<f64>,
    /// Number of units to charge
    /// Required by the API.
    pub units: f64,
    /// The timestamp when the event/transaction was performed. If blank, the billing timestamp
    /// will be set as the event time. ISO8601 Format.
    #[serde(rename = "eventTime", default, skip_serializing_if = "Option::is_none")]
    pub event_time: Option<String>,
}

/// `SubscriptionPlanDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct SubscriptionPlanDTO {
    /// The reselling amount
    /// Required by the API.
    #[serde(rename = "resellingAmount")]
    pub reselling_amount: f64,
    /// The base amount
    /// Required by the API.
    #[serde(rename = "baseAmount")]
    pub base_amount: f64,
    /// The plan id
    /// Required by the API.
    #[serde(rename = "planId")]
    pub plan_id: String,
    /// The features
    /// Required by the API.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub features: Vec<String>,
    /// The payment time
    /// Required by the API.
    #[serde(rename = "paymentType")]
    pub payment_type: String,
    /// The plan name
    /// Required by the API.
    pub name: String,
    /// The payment time
    /// Required by the API.
    #[serde(rename = "paymentTime")]
    pub payment_time: String,
}

/// `UsagePlanDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct UsagePlanDTO {
    /// The product type
    /// Required by the API.
    #[serde(rename = "productType")]
    pub product_type: String,
    /// The product name
    /// Required by the API.
    #[serde(rename = "productName")]
    pub product_name: String,
    /// The usage unit for the meter
    /// Required by the API.
    #[serde(rename = "usageUnit")]
    pub usage_unit: String,
    /// The meter id
    /// Required by the API.
    #[serde(rename = "meterId")]
    pub meter_id: String,
    /// The meter name
    /// Required by the API.
    #[serde(rename = "meterName")]
    pub meter_name: String,
    /// The fixed price per unit, applicable for fixed price type
    /// Required by the API.
    #[serde(rename = "fixedPricePerUnit")]
    pub fixed_price_per_unit: f64,
    /// The price type
    /// Allowed values: `fixed`, `dynamic`.
    /// Required by the API.
    #[serde(rename = "priceType")]
    pub price_type: String,
    /// The min price per unit, applicable for dynamic price type
    /// Required by the API.
    #[serde(rename = "minPricePerUnit")]
    pub min_price_per_unit: String,
    /// The max price per unit, applicable for dynamic price type
    /// Required by the API.
    #[serde(rename = "maxPricePerUnit")]
    pub max_price_per_unit: String,
    /// The execution limit per cycle
    /// Required by the API.
    #[serde(rename = "executionLimitPerCycle")]
    pub execution_limit_per_cycle: f64,
}

/// `WhitelabelDetailsDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct WhitelabelDetailsDTO {
    /// Domain of the whitelabel company
    /// Required by the API.
    pub domain: String,
    /// Logo URL of the whitelabel company
    /// Required by the API.
    #[serde(rename = "logoUrl")]
    pub logo_url: String,
}