ghl-models 0.3.1

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

/// `AvailableNumbersResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct AvailableNumbersResponseDto {
    /// Unique fingerprint ID for this search result, required when purchasing one of the
    /// returned numbers
    /// Required by the API.
    #[serde(rename = "fingerprintId")]
    pub fingerprint_id: String,
    /// List of available phone numbers matching the search criteria
    /// Required by the API.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub numbers: Vec<AvailablePhoneNumberDto>,
}

/// `AvailablePhoneNumberDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct AvailablePhoneNumberDto {
    /// E.164 formatted phone number
    /// Required by the API.
    #[serde(rename = "phoneNumber")]
    pub phone_number: String,
    /// Human-readable formatted phone number
    /// Required by the API.
    #[serde(rename = "friendlyName")]
    pub friendly_name: String,
    /// ISO 3166-1 alpha-2 country code
    /// Required by the API.
    #[serde(rename = "isoCountry")]
    pub iso_country: String,
    /// Local Access and Transport Area code
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub lata: Option<String>,
    /// City or locality of the number
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub locality: Option<String>,
    /// Rate center of the number
    #[serde(
        rename = "rateCenter",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub rate_center: Option<String>,
    /// Latitude coordinate of the number's location
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub latitude: Option<String>,
    /// Longitude coordinate of the number's location
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub longitude: Option<String>,
    /// State or region abbreviation
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub region: Option<String>,
    /// Postal code of the number
    #[serde(
        rename = "postalCode",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub postal_code: Option<String>,
    /// Address requirements for purchasing this number
    /// Allowed values: `none`, `any`, `local`, `foreign`.
    /// Required by the API.
    #[serde(rename = "addressRequirements")]
    pub address_requirements: String,
    /// Whether this is a beta number
    /// Required by the API.
    pub beta: bool,
    /// Communication capabilities supported by this number
    /// Nested object; raw JSON (see the API docs for its fields).
    /// Required by the API.
    pub capabilities: serde_json::Value,
    /// Pricing information for this number
    /// Nested object; raw JSON (see the API docs for its fields).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub price: Option<serde_json::Value>,
}

/// `DetailedPhoneNumberDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct DetailedPhoneNumberDto {
    /// E.164 formatted phone number
    /// Required by the API.
    #[serde(rename = "phoneNumber")]
    pub phone_number: String,
    /// Human-readable name assigned to the number
    #[serde(
        rename = "friendlyName",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub friendly_name: Option<String>,
    /// Phone number SID (unique identifier)
    /// Required by the API.
    pub sid: String,
    /// ISO 3166-1 alpha-2 country code
    /// Required by the API.
    #[serde(rename = "countryCode")]
    pub country_code: String,
    /// Communication capabilities supported by this number
    /// Nested object; raw JSON (see the API docs for its fields).
    /// Required by the API.
    pub capabilities: serde_json::Value,
    /// Type of phone number (local, toll-free, mobile, etc.)
    /// Allowed values: `local`, `toll-free`, `mobile`, `national`.
    /// Required by the API.
    #[serde(rename = "type")]
    pub type_: String,
    /// Whether this is the default outbound number for the location
    /// Required by the API.
    #[serde(rename = "isDefaultNumber")]
    pub is_default_number: bool,
    /// User ID of the user assigned to this number
    #[serde(
        rename = "linkedUser",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub linked_user: Option<String>,
    /// Array of user IDs that should ring when this number is called
    /// Required by the API.
    #[serde(
        rename = "linkedRingAllUsers",
        default,
        skip_serializing_if = "Vec::is_empty"
    )]
    pub linked_ring_all_users: Vec<String>,
    /// Configuration for inbound call handling service
    /// Nested object; raw JSON (see the API docs for its fields).
    #[serde(
        rename = "inboundCallService",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub inbound_call_service: Option<serde_json::Value>,
    /// Phone number to forward calls to
    #[serde(
        rename = "forwardingNumber",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub forwarding_number: Option<String>,
    /// Whether group conversations are enabled for this number (US/CA numbers with SMS/MMS
    /// only)
    /// Required by the API.
    #[serde(rename = "isGroupConversationEnabled")]
    pub is_group_conversation_enabled: bool,
    /// Address SID for compliance purposes
    #[serde(
        rename = "addressSid",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub address_sid: Option<String>,
    /// Bundle SID for regulatory compliance
    #[serde(rename = "bundleSid", default, skip_serializing_if = "Option::is_none")]
    pub bundle_sid: Option<String>,
    /// When the number was originally purchased/added
    /// Format: date-time (ISO-8601 string).
    #[serde(rename = "dateAdded", default, skip_serializing_if = "Option::is_none")]
    pub date_added: Option<String>,
    /// When the number configuration was last updated
    /// Format: date-time (ISO-8601 string).
    #[serde(
        rename = "dateUpdated",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub date_updated: Option<String>,
    /// Source or origin of the phone number
    /// Allowed values: `twilio`, `hosted`, `ported`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub origin: Option<String>,
}

/// `NumberPoolDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct NumberPoolDto {
    /// Unique identifier for the number pool
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// Human-readable name of the number pool
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// Location ID this pool belongs to
    #[serde(
        rename = "locationId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub location_id: Option<String>,
    /// Phone numbers in this pool
    /// Nested object; raw JSON (see the API docs for its fields).
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub numbers: Vec<serde_json::Value>,
    /// Number to forward calls to
    #[serde(
        rename = "forwardingNumber",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub forwarding_number: Option<String>,
    /// Whether whisper is enabled
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub whisper: Option<bool>,
    /// Message played during whisper
    #[serde(
        rename = "whisperMessage",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub whisper_message: Option<String>,
    /// Whether call recording is enabled
    #[serde(
        rename = "callRecording",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub call_recording: Option<bool>,
    /// Whether the number pool is active
    #[serde(rename = "isActive", default, skip_serializing_if = "Option::is_none")]
    pub is_active: Option<bool>,
    /// Inbound call service configuration
    /// Nested object; raw JSON (see the API docs for its fields).
    #[serde(
        rename = "inboundCallService",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub inbound_call_service: Option<serde_json::Value>,
}

/// `PurchasePhoneNumberBodyDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PurchasePhoneNumberBodyDto {
    /// The phone number to purchase
    /// Required by the API.
    #[serde(rename = "phoneNumber")]
    pub phone_number: String,
    /// ISO 3166-1 alpha-2 country code of the number
    #[serde(
        rename = "countryCode",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub country_code: Option<String>,
    /// Type of phone number
    /// Allowed values: `local`, `tollFree`, `mobile`.
    #[serde(
        rename = "numberType",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub number_type: Option<String>,
    /// Twilio address SID for compliance
    #[serde(
        rename = "addressSid",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub address_sid: Option<String>,
    /// Twilio bundle SID for regulatory compliance
    #[serde(rename = "bundleSid", default, skip_serializing_if = "Option::is_none")]
    pub bundle_sid: Option<String>,
    /// Locality where the number is being purchased
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub locality: Option<String>,
    /// Region where the number is being purchased
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub region: Option<String>,
    /// Unique request ID for idempotency (fingerprint of the purchase request)
    #[serde(
        rename = "fingerprintId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub fingerprint_id: Option<String>,
    /// Skip location-level KYC verification if agency-level compliance has already been
    /// verified
    #[serde(
        rename = "skipLocationKYC",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub skip_location_kyc: Option<bool>,
}

/// `TwilioAccountResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct TwilioAccountResponseDto {
    /// Unique identifier of the Twilio account record
    /// Required by the API.
    pub id: String,
    /// Twilio Account SID
    /// Required by the API.
    pub account_sid: String,
    /// Whether this location is under a GHL-managed Twilio account
    /// Required by the API.
    pub under_ghl_account: bool,
    /// Whether SMS validation is enabled
    /// Required by the API.
    pub validate_sms: bool,
    /// The location ID this Twilio account belongs to
    /// Required by the API.
    pub location_id: String,
    /// Current migration status of the account
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub migration_status: Option<String>,
    /// List of numbers being migrated
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub migration_numbers: Vec<String>,
    /// Map of phone numbers to assigned user IDs
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub assigned_to_numbers: Option<serde_json::Value>,
    /// Map of phone numbers to their service type (e.g. 'conversation')
    /// Required by the API.
    pub numbers: serde_json::Value,
    /// Map of phone numbers to their friendly names
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub number_name: Option<serde_json::Value>,
    /// New account SID if the account has been migrated to new credentials
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub new_account_sid: Option<String>,
}