ghl-models 0.3.1

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

/// `CreatePublicAgentDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct CreatePublicAgentDTO {
    /// Location ID
    /// Required by the API.
    #[serde(rename = "locationId")]
    pub location_id: String,
    /// Name of the agent
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// Description of the agent
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// Agency ID
    #[serde(rename = "agencyId", default, skip_serializing_if = "Option::is_none")]
    pub agency_id: Option<String>,
    /// Author ID
    #[serde(rename = "authorId", default, skip_serializing_if = "Option::is_none")]
    pub author_id: Option<String>,
    /// Author name
    #[serde(
        rename = "authorName",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub author_name: Option<String>,
    /// Author email
    #[serde(
        rename = "authorEmail",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub author_email: Option<String>,
    /// Status of the agent
    /// Allowed values: `active`, `inactive`, `archived`.
    /// Required by the API.
    pub status: String,
    /// Version data for the agent including nodes, edges, and configuration
    /// Required by the API.
    pub version: serde_json::Value,
    /// Nodes array (deprecated, prefer using version.nodes)
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub nodes: Vec<String>,
    /// Edges array (deprecated, prefer using version.edges)
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub edges: Vec<String>,
}

/// `CreatePublicAgentResponseDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct CreatePublicAgentResponseDTO {
    /// Success status
    /// Required by the API.
    pub success: bool,
    /// Response message
    /// Required by the API.
    pub message: String,
    /// Created agent data with metadata
    /// Required by the API.
    pub agent: serde_json::Value,
    /// Created versions array (initial staging version)
    /// Required by the API.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub versions: Vec<serde_json::Value>,
}

/// `DeletePublicAgentResponseDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct DeletePublicAgentResponseDTO {
    /// Success status
    /// Required by the API.
    pub success: bool,
    /// Response message
    /// Required by the API.
    pub message: String,
    /// Deleted agent ID
    #[serde(rename = "agentId", default, skip_serializing_if = "Option::is_none")]
    pub agent_id: Option<String>,
}

/// `ExecutePublicAgentDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ExecutePublicAgentDTO {
    /// Message to send to the agent
    /// Required by the API.
    pub message: String,
    /// Unique session identifier that maintains conversational context across multiple
    /// interactions within the same agent session. Omit this field for the first message in a
    /// new session. Include the executionId returned from the previous response to maintain
    /// context in subsequent messages.
    #[serde(
        rename = "executionId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub execution_id: Option<String>,
    /// Input variables to pass to the agent. These should match the input variables defined in
    /// the agent configuration.
    #[serde(
        rename = "inputVariables",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub input_variables: Option<serde_json::Value>,
    /// Published version ID to execute. If not provided, the latest published production
    /// version will be used.
    #[serde(rename = "versionId", default, skip_serializing_if = "Option::is_none")]
    pub version_id: Option<String>,
    /// Attachments for the message
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub attachments: Vec<PublicAttachmentSchema>,
    /// Location ID
    /// Required by the API.
    #[serde(rename = "locationId")]
    pub location_id: String,
    /// Contact ID to associate with this execution. When provided, contact data will be
    /// hydrated and made available to the agent.
    #[serde(rename = "contactId", default, skip_serializing_if = "Option::is_none")]
    pub contact_id: Option<String>,
}

/// `ExecutePublicAgentResponseDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ExecutePublicAgentResponseDTO {
    /// Success status
    /// Required by the API.
    pub success: bool,
    /// Unique session identifier that maintains conversational context across multiple
    /// interactions within the same agent session. Use this ID in subsequent requests to
    /// continue the conversation.
    /// Required by the API.
    #[serde(rename = "executionId")]
    pub execution_id: String,
    /// Unique identifier for a single interaction cycle, consisting of one user input and the
    /// corresponding agent response. Each message exchange generates a new interactionId.
    /// Required by the API.
    #[serde(rename = "interactionId")]
    pub interaction_id: String,
    /// Agent response text
    /// Required by the API.
    pub response: String,
    /// Response type
    /// Required by the API.
    #[serde(rename = "type")]
    pub type_: String,
    /// Expected input type for next interaction
    /// Required by the API.
    #[serde(rename = "nextExpectedInput")]
    pub next_expected_input: String,
    /// When end node is added in the graph, this will be true if the agent reached the end node
    /// in the graph
    /// Required by the API.
    #[serde(rename = "goalCompletion")]
    pub goal_completion: bool,
    /// Execution status
    /// Required by the API.
    #[serde(rename = "executionStatus")]
    pub execution_status: String,
    /// Whether flow was switched
    /// Required by the API.
    #[serde(rename = "flowSwitch")]
    pub flow_switch: bool,
    /// Response attachments
    /// Required by the API.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub attachments: Vec<serde_json::Value>,
    /// Generated outputs
    /// Required by the API.
    #[serde(
        rename = "generativeOutputs",
        default,
        skip_serializing_if = "Vec::is_empty"
    )]
    pub generative_outputs: Vec<serde_json::Value>,
}

/// `GetAgentByIdResponseDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct GetAgentByIdResponseDTO {
    /// Success status
    /// Required by the API.
    pub success: bool,
    /// Response message
    /// Required by the API.
    pub message: String,
    /// Agent metadata with all active versions
    /// Required by the API.
    pub agent: serde_json::Value,
    /// Request trace ID for debugging
    #[serde(rename = "traceId", default, skip_serializing_if = "Option::is_none")]
    pub trace_id: Option<String>,
}

/// `GetPublishedAgentsResponseDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct GetPublishedAgentsResponseDTO {
    /// Success status
    /// Required by the API.
    pub success: bool,
    /// Response message
    /// Required by the API.
    pub message: String,
    /// List of agents with metadata
    /// Nested object; raw JSON (see the API docs for its fields).
    /// Required by the API.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub agents: Vec<serde_json::Value>,
    /// Pagination metadata
    /// Nested object; raw JSON (see the API docs for its fields).
    /// Required by the API.
    pub pagination: serde_json::Value,
}

/// `InternalServerErrorDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct InternalServerErrorDTO {
    #[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>,
}

/// `PromoteAndPublishDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PromoteAndPublishDTO {
    /// Location ID for authorization
    /// Required by the API.
    #[serde(rename = "locationId")]
    pub location_id: String,
    /// User ID performing the promotion action
    #[serde(rename = "userId", default, skip_serializing_if = "Option::is_none")]
    pub user_id: Option<String>,
    /// User name performing the promotion action
    #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")]
    pub user_name: Option<String>,
    /// User email performing the promotion action
    #[serde(rename = "userEmail", default, skip_serializing_if = "Option::is_none")]
    pub user_email: Option<String>,
}

/// `PromoteAndPublishResponseDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PromoteAndPublishResponseDTO {
    /// Success status
    /// Required by the API.
    pub success: bool,
    /// Response message
    /// Required by the API.
    pub message: String,
    /// Result data with production and new draft version details
    /// Required by the API.
    pub data: serde_json::Value,
}

/// `PublicAttachmentSchema` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PublicAttachmentSchema {
    /// Type of attachment
    /// Required by the API.
    #[serde(rename = "type")]
    pub type_: String,
    /// URL of the image attachment
    /// Required by the API.
    #[serde(rename = "imageUrl")]
    pub image_url: String,
}

/// `UpdatePublicAgentMetadataDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct UpdatePublicAgentMetadataDTO {
    /// Location ID for authorization (cannot be updated)
    /// Required by the API.
    #[serde(rename = "locationId")]
    pub location_id: String,
    /// Name of the agent
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// Description of the agent
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// Status of the agent
    /// Allowed values: `active`, `inactive`, `archived`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub status: Option<String>,
}

/// `UpdatePublicAgentResponseDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct UpdatePublicAgentResponseDTO {
    /// Success status
    /// Required by the API.
    pub success: bool,
    /// Response message
    /// Required by the API.
    pub message: String,
    /// Updated agent or version data
    /// Required by the API.
    pub data: serde_json::Value,
}

/// `UpdatePublicAgentVersionDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct UpdatePublicAgentVersionDTO {
    /// Location ID for authorization
    /// Required by the API.
    #[serde(rename = "locationId")]
    pub location_id: String,
    /// Version name
    #[serde(
        rename = "versionName",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub version_name: Option<String>,
    /// Description of the version
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// Complete array of nodes for the agent workflow. Provide all nodes including unchanged
    /// ones.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub nodes: Vec<serde_json::Value>,
    /// Complete array of edges connecting the nodes. Provide all edges including unchanged
    /// ones.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub edges: Vec<serde_json::Value>,
    /// Global variables accessible throughout the agent workflow
    #[serde(
        rename = "globalVariables",
        default,
        skip_serializing_if = "Vec::is_empty"
    )]
    pub global_variables: Vec<serde_json::Value>,
    /// Input variables required from user at execution time
    #[serde(
        rename = "inputVariables",
        default,
        skip_serializing_if = "Vec::is_empty"
    )]
    pub input_variables: Vec<serde_json::Value>,
    /// Runtime variables generated during agent execution
    #[serde(
        rename = "runtimeVariables",
        default,
        skip_serializing_if = "Vec::is_empty"
    )]
    pub runtime_variables: Vec<serde_json::Value>,
    /// Global configuration including prompts and settings
    #[serde(
        rename = "globalConfig",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub global_config: Option<serde_json::Value>,
    /// User ID performing the update
    #[serde(rename = "userId", default, skip_serializing_if = "Option::is_none")]
    pub user_id: Option<String>,
    /// User name performing the update
    #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")]
    pub user_name: Option<String>,
}