ghl-models 0.5.2

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 V3 (8 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};

/// `ListNumberItemResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ListNumberItemResponseDto {
    /// Phone number in E.164 format
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "phoneNumber",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub phone_number: Option<String>,
    /// Human-friendly label for the number
    #[serde(
        rename = "friendlyName",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub friendly_name: Option<String>,
    /// Provider number identifier
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub sid: Option<String>,
    /// ISO country code for the number
    #[serde(
        rename = "countryCode",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub country_code: Option<String>,
    /// Phone number capabilities
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub capabilities: Option<NumberCapabilitiesDto>,
    /// Phone number type
    #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
    pub type_: Option<String>,
    /// Whether this is the default outbound number
    #[serde(
        rename = "isDefaultNumber",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub is_default_number: Option<bool>,
    /// Linked user ID if the number is assigned
    #[serde(
        rename = "linkedUser",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub linked_user: Option<String>,
    /// Ring-all user IDs linked to the number
    #[serde(
        rename = "linkedRingAllUsers",
        default,
        skip_serializing_if = "Vec::is_empty"
    )]
    pub linked_ring_all_users: Vec<String>,
    /// Inbound call service metadata
    #[serde(
        rename = "inboundCallService",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub inbound_call_service: Option<serde_json::Value>,
    /// Forwarding number in E.164 format
    #[serde(
        rename = "forwardingNumber",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub forwarding_number: Option<String>,
    /// Whether group conversations are enabled
    #[serde(
        rename = "isGroupConversationEnabled",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub is_group_conversation_enabled: Option<bool>,
    /// Address SID used for regulated number purchases
    #[serde(
        rename = "addressSid",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub address_sid: Option<String>,
    /// Bundle SID used for regulated number purchases
    #[serde(rename = "bundleSid", default, skip_serializing_if = "Option::is_none")]
    pub bundle_sid: Option<String>,
    /// Date the number was added
    #[serde(rename = "dateAdded", default, skip_serializing_if = "Option::is_none")]
    pub date_added: Option<serde_json::Value>,
    /// Date the number was last updated
    #[serde(
        rename = "dateUpdated",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub date_updated: Option<serde_json::Value>,
    /// Legacy created-at field returned by some providers
    #[serde(
        rename = "dateCreated",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub date_created: Option<serde_json::Value>,
    /// Provider origin for the number
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub origin: Option<String>,
}

/// `ListNumbersV3Http200ResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ListNumbersV3Http200ResponseDto {
    /// Outcome indicator from the shared success helper.
    /// Allowed values: `success`.
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub status: Option<String>,
    /// V3 list payload: numbers, pagination fields, isUnderLc (renamed from isUnderGhl), etc.
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub data: Option<ListNumbersV3ResponseDto>,
    /// Human-readable success message.
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub message: Option<String>,
    /// HTTP status echoed in the response body.
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "statusCode",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub status_code: Option<f64>,
}

/// `ListNumbersV3ResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ListNumbersV3ResponseDto {
    /// Active numbers available for the location
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub numbers: Vec<ListNumberItemResponseDto>,
    /// Whether the account is managed under LC. Renamed from isUnderGhl.
    #[serde(rename = "isUnderLc", default, skip_serializing_if = "Option::is_none")]
    pub is_under_lc: Option<bool>,
    /// The page size requested
    #[serde(rename = "pageSize", default, skip_serializing_if = "Option::is_none")]
    pub page_size: Option<f64>,
    /// The zero-based page index requested
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub page: Option<f64>,
    /// Twilio account status for the location
    #[serde(
        rename = "accountStatus",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub account_status: Option<String>,
    /// Optional RCS sender IDs returned with the number list
    #[serde(
        rename = "rcsSenderIds",
        default,
        skip_serializing_if = "Vec::is_empty"
    )]
    pub rcs_sender_ids: Vec<RcsSenderIdResponseDto>,
    /// Total number of active numbers when available
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub total: Option<f64>,
}

/// `NumberCapabilitiesDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct NumberCapabilitiesDto {
    /// Whether the number supports voice calls
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub voice: Option<bool>,
    /// Whether the number supports SMS
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub sms: Option<bool>,
    /// Whether the number supports MMS
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub mms: Option<bool>,
    /// Whether the number supports fax
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub fax: Option<bool>,
}

/// `PurchaseNumberForLocationV3Http201ResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PurchaseNumberForLocationV3Http201ResponseDto {
    /// Outcome indicator from the shared success helper.
    /// Allowed values: `success`.
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub status: Option<String>,
    /// V3 purchase payload: purchased number, location, Twilio account id, and underLcAccount.
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub data: Option<PurchaseNumberForLocationV3ResponseDto>,
    /// Human-readable success message.
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub message: Option<String>,
    /// HTTP status echoed in the response body.
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "statusCode",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub status_code: Option<f64>,
}

/// `PurchaseNumberForLocationV3ResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PurchaseNumberForLocationV3ResponseDto {
    /// E.164 phone number that was purchased (from the request body)
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub number: Option<String>,
    /// Location that owns the Twilio / numbers account
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "locationId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub location_id: Option<String>,
    /// Twilio account document identifier
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// Whether the account is managed under LC. Renamed from under_ghl_account in the legacy
    /// document.
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "underLcAccount",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub under_lc_account: Option<bool>,
}

/// `PurchasePhoneNumberBodyDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PurchasePhoneNumberBodyDto {
    /// phoneNumber to purchase
    /// Required by the API.
    #[serde(rename = "phoneNumber")]
    pub phone_number: String,
    /// addressSid twilio address id
    /// Required by the API.
    #[serde(rename = "addressSid")]
    pub address_sid: String,
    /// bundleSid twilio bundle id
    /// Required by the API.
    #[serde(rename = "bundleSid")]
    pub bundle_sid: String,
    /// country for which the phone numbers are being requested
    /// Required by the API.
    #[serde(rename = "countryCode")]
    pub country_code: String,
    /// type of phone number to be purchased
    /// Required by the API.
    #[serde(rename = "numberType")]
    pub number_type: serde_json::Value,
    /// stripe payment intent id
    /// Required by the API.
    #[serde(rename = "paymentIntentId")]
    pub payment_intent_id: String,
    /// stripe account id
    /// Required by the API.
    #[serde(rename = "stripeAccountId")]
    pub stripe_account_id: String,
    /// stripe registered payment method id
    /// Required by the API.
    #[serde(rename = "paymentMethodId")]
    pub payment_method_id: String,
    /// locality of the user in which number is being purchased
    /// Required by the API.
    pub locality: String,
    /// region of the user in which number is being purchased
    /// Required by the API.
    pub region: String,
    /// fingerprintId is request id which is unique for every purchase number request
    /// Required by the API.
    #[serde(rename = "fingerprintId")]
    pub fingerprint_id: String,
    /// Skip location-level KYC verification if agency-level compliance has already been
    /// verified
    /// Required by the API.
    #[serde(rename = "skipLocationKYC")]
    pub skip_location_kyc: bool,
}

/// `RcsSenderIdResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct RcsSenderIdResponseDto {
    /// RCS sender ID
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub number: Option<String>,
    /// Entry type
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "numberType",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub number_type: Option<String>,
    /// Human-friendly label for the sender ID
    #[serde(
        rename = "friendlyName",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub friendly_name: Option<String>,
    /// RCS sender metadata
    #[serde(rename = "rcsMeta", default, skip_serializing_if = "Option::is_none")]
    pub rcs_meta: Option<serde_json::Value>,
}