Skip to main content

ghl_models/v2/
agent_studio.rs

1//! `agent-studio` data models for GoHighLevel API V2 (14 types).
2//!
3//! Generated from HighLevel's official OpenAPI spec for the
4//! **Agent Studio** module. Every endpoint that uses these types, with its
5//! parameters, required scopes and enum values, is documented in the
6//! [`agent-studio` API reference](https://github.com/Shahroz/ghl-rs/blob/main/docs/api/agent-studio.md).
7//!
8//! Enable with `features = ["agent-studio"]`.
9// @generated by xtask/generate_models.py — do not edit by hand.
10// Source: https://github.com/GoHighLevel/highlevel-api-docs
11// Doc comments are HighLevel's own field descriptions, reflowed verbatim, so
12// they aren't held to rustdoc's markdown conventions.
13#![allow(
14    missing_docs,
15    clippy::doc_lazy_continuation,
16    clippy::doc_overindented_list_items
17)]
18
19use serde::{Deserialize, Serialize};
20
21/// `CreatePublicAgentDTO` from the GoHighLevel OpenAPI spec.
22#[derive(Debug, Clone, Default, Serialize, Deserialize)]
23pub struct CreatePublicAgentDTO {
24    /// Location ID
25    /// Required by the API.
26    #[serde(rename = "locationId")]
27    pub location_id: String,
28    /// Name of the agent
29    #[serde(default, skip_serializing_if = "Option::is_none")]
30    pub name: Option<String>,
31    /// Description of the agent
32    #[serde(default, skip_serializing_if = "Option::is_none")]
33    pub description: Option<String>,
34    /// Agency ID
35    #[serde(rename = "agencyId", default, skip_serializing_if = "Option::is_none")]
36    pub agency_id: Option<String>,
37    /// Author ID
38    #[serde(rename = "authorId", default, skip_serializing_if = "Option::is_none")]
39    pub author_id: Option<String>,
40    /// Author name
41    #[serde(
42        rename = "authorName",
43        default,
44        skip_serializing_if = "Option::is_none"
45    )]
46    pub author_name: Option<String>,
47    /// Author email
48    #[serde(
49        rename = "authorEmail",
50        default,
51        skip_serializing_if = "Option::is_none"
52    )]
53    pub author_email: Option<String>,
54    /// Status of the agent
55    /// Allowed values: `active`, `inactive`, `archived`.
56    /// Required by the API.
57    pub status: String,
58    /// Version data for the agent including nodes, edges, and configuration
59    /// Required by the API.
60    pub version: serde_json::Value,
61    /// Nodes array (deprecated, prefer using version.nodes)
62    #[serde(default, skip_serializing_if = "Vec::is_empty")]
63    pub nodes: Vec<String>,
64    /// Edges array (deprecated, prefer using version.edges)
65    #[serde(default, skip_serializing_if = "Vec::is_empty")]
66    pub edges: Vec<String>,
67}
68
69/// `CreatePublicAgentResponseDTO` from the GoHighLevel OpenAPI spec.
70#[derive(Debug, Clone, Default, Serialize, Deserialize)]
71pub struct CreatePublicAgentResponseDTO {
72    /// Success status
73    /// Required by the API.
74    pub success: bool,
75    /// Response message
76    /// Required by the API.
77    pub message: String,
78    /// Created agent data with metadata
79    /// Required by the API.
80    pub agent: serde_json::Value,
81    /// Created versions array (initial staging version)
82    /// Required by the API.
83    #[serde(default, skip_serializing_if = "Vec::is_empty")]
84    pub versions: Vec<serde_json::Value>,
85}
86
87/// `DeletePublicAgentResponseDTO` from the GoHighLevel OpenAPI spec.
88#[derive(Debug, Clone, Default, Serialize, Deserialize)]
89pub struct DeletePublicAgentResponseDTO {
90    /// Success status
91    /// Required by the API.
92    pub success: bool,
93    /// Response message
94    /// Required by the API.
95    pub message: String,
96    /// Deleted agent ID
97    #[serde(rename = "agentId", default, skip_serializing_if = "Option::is_none")]
98    pub agent_id: Option<String>,
99}
100
101/// `ExecutePublicAgentDTO` from the GoHighLevel OpenAPI spec.
102#[derive(Debug, Clone, Default, Serialize, Deserialize)]
103pub struct ExecutePublicAgentDTO {
104    /// Message to send to the agent
105    /// Required by the API.
106    pub message: String,
107    /// Unique session identifier that maintains conversational context across multiple
108    /// interactions within the same agent session. Omit this field for the first message in a
109    /// new session. Include the executionId returned from the previous response to maintain
110    /// context in subsequent messages.
111    #[serde(
112        rename = "executionId",
113        default,
114        skip_serializing_if = "Option::is_none"
115    )]
116    pub execution_id: Option<String>,
117    /// Input variables to pass to the agent. These should match the input variables defined in
118    /// the agent configuration.
119    #[serde(
120        rename = "inputVariables",
121        default,
122        skip_serializing_if = "Option::is_none"
123    )]
124    pub input_variables: Option<serde_json::Value>,
125    /// Published version ID to execute. If not provided, the latest published production
126    /// version will be used.
127    #[serde(rename = "versionId", default, skip_serializing_if = "Option::is_none")]
128    pub version_id: Option<String>,
129    /// Attachments for the message
130    #[serde(default, skip_serializing_if = "Vec::is_empty")]
131    pub attachments: Vec<PublicAttachmentSchema>,
132    /// Location ID
133    /// Required by the API.
134    #[serde(rename = "locationId")]
135    pub location_id: String,
136    /// Contact ID to associate with this execution. When provided, contact data will be
137    /// hydrated and made available to the agent.
138    #[serde(rename = "contactId", default, skip_serializing_if = "Option::is_none")]
139    pub contact_id: Option<String>,
140}
141
142/// `ExecutePublicAgentResponseDTO` from the GoHighLevel OpenAPI spec.
143#[derive(Debug, Clone, Default, Serialize, Deserialize)]
144pub struct ExecutePublicAgentResponseDTO {
145    /// Success status
146    /// Required by the API.
147    pub success: bool,
148    /// Unique session identifier that maintains conversational context across multiple
149    /// interactions within the same agent session. Use this ID in subsequent requests to
150    /// continue the conversation.
151    /// Required by the API.
152    #[serde(rename = "executionId")]
153    pub execution_id: String,
154    /// Unique identifier for a single interaction cycle, consisting of one user input and the
155    /// corresponding agent response. Each message exchange generates a new interactionId.
156    /// Required by the API.
157    #[serde(rename = "interactionId")]
158    pub interaction_id: String,
159    /// Agent response text
160    /// Required by the API.
161    pub response: String,
162    /// Response type
163    /// Required by the API.
164    #[serde(rename = "type")]
165    pub type_: String,
166    /// Expected input type for next interaction
167    /// Required by the API.
168    #[serde(rename = "nextExpectedInput")]
169    pub next_expected_input: String,
170    /// When end node is added in the graph, this will be true if the agent reached the end node
171    /// in the graph
172    /// Required by the API.
173    #[serde(rename = "goalCompletion")]
174    pub goal_completion: bool,
175    /// Execution status
176    /// Required by the API.
177    #[serde(rename = "executionStatus")]
178    pub execution_status: String,
179    /// Whether flow was switched
180    /// Required by the API.
181    #[serde(rename = "flowSwitch")]
182    pub flow_switch: bool,
183    /// Response attachments
184    /// Required by the API.
185    #[serde(default, skip_serializing_if = "Vec::is_empty")]
186    pub attachments: Vec<serde_json::Value>,
187    /// Generated outputs
188    /// Required by the API.
189    #[serde(
190        rename = "generativeOutputs",
191        default,
192        skip_serializing_if = "Vec::is_empty"
193    )]
194    pub generative_outputs: Vec<serde_json::Value>,
195}
196
197/// `GetAgentByIdResponseDTO` from the GoHighLevel OpenAPI spec.
198#[derive(Debug, Clone, Default, Serialize, Deserialize)]
199pub struct GetAgentByIdResponseDTO {
200    /// Success status
201    /// Required by the API.
202    pub success: bool,
203    /// Response message
204    /// Required by the API.
205    pub message: String,
206    /// Agent metadata with all active versions
207    /// Required by the API.
208    pub agent: serde_json::Value,
209    /// Request trace ID for debugging
210    #[serde(rename = "traceId", default, skip_serializing_if = "Option::is_none")]
211    pub trace_id: Option<String>,
212}
213
214/// `GetPublishedAgentsResponseDTO` from the GoHighLevel OpenAPI spec.
215#[derive(Debug, Clone, Default, Serialize, Deserialize)]
216pub struct GetPublishedAgentsResponseDTO {
217    /// Success status
218    /// Required by the API.
219    pub success: bool,
220    /// Response message
221    /// Required by the API.
222    pub message: String,
223    /// List of agents with metadata
224    /// Nested object; raw JSON (see the API docs for its fields).
225    /// Required by the API.
226    #[serde(default, skip_serializing_if = "Vec::is_empty")]
227    pub agents: Vec<serde_json::Value>,
228    /// Pagination metadata
229    /// Nested object; raw JSON (see the API docs for its fields).
230    /// Required by the API.
231    pub pagination: serde_json::Value,
232}
233
234/// `InternalServerErrorDTO` from the GoHighLevel OpenAPI spec.
235#[derive(Debug, Clone, Default, Serialize, Deserialize)]
236pub struct InternalServerErrorDTO {
237    #[serde(
238        rename = "statusCode",
239        default,
240        skip_serializing_if = "Option::is_none"
241    )]
242    pub status_code: Option<f64>,
243    #[serde(default, skip_serializing_if = "Option::is_none")]
244    pub message: Option<String>,
245}
246
247/// `PromoteAndPublishDTO` from the GoHighLevel OpenAPI spec.
248#[derive(Debug, Clone, Default, Serialize, Deserialize)]
249pub struct PromoteAndPublishDTO {
250    /// Location ID for authorization
251    /// Required by the API.
252    #[serde(rename = "locationId")]
253    pub location_id: String,
254    /// User ID performing the promotion action
255    #[serde(rename = "userId", default, skip_serializing_if = "Option::is_none")]
256    pub user_id: Option<String>,
257    /// User name performing the promotion action
258    #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")]
259    pub user_name: Option<String>,
260    /// User email performing the promotion action
261    #[serde(rename = "userEmail", default, skip_serializing_if = "Option::is_none")]
262    pub user_email: Option<String>,
263}
264
265/// `PromoteAndPublishResponseDTO` from the GoHighLevel OpenAPI spec.
266#[derive(Debug, Clone, Default, Serialize, Deserialize)]
267pub struct PromoteAndPublishResponseDTO {
268    /// Success status
269    /// Required by the API.
270    pub success: bool,
271    /// Response message
272    /// Required by the API.
273    pub message: String,
274    /// Result data with production and new draft version details
275    /// Required by the API.
276    pub data: serde_json::Value,
277}
278
279/// `PublicAttachmentSchema` from the GoHighLevel OpenAPI spec.
280#[derive(Debug, Clone, Default, Serialize, Deserialize)]
281pub struct PublicAttachmentSchema {
282    /// Type of attachment
283    /// Required by the API.
284    #[serde(rename = "type")]
285    pub type_: String,
286    /// URL of the image attachment
287    /// Required by the API.
288    #[serde(rename = "imageUrl")]
289    pub image_url: String,
290}
291
292/// `UpdatePublicAgentMetadataDTO` from the GoHighLevel OpenAPI spec.
293#[derive(Debug, Clone, Default, Serialize, Deserialize)]
294pub struct UpdatePublicAgentMetadataDTO {
295    /// Location ID for authorization (cannot be updated)
296    /// Required by the API.
297    #[serde(rename = "locationId")]
298    pub location_id: String,
299    /// Name of the agent
300    #[serde(default, skip_serializing_if = "Option::is_none")]
301    pub name: Option<String>,
302    /// Description of the agent
303    #[serde(default, skip_serializing_if = "Option::is_none")]
304    pub description: Option<String>,
305    /// Status of the agent
306    /// Allowed values: `active`, `inactive`, `archived`.
307    #[serde(default, skip_serializing_if = "Option::is_none")]
308    pub status: Option<String>,
309}
310
311/// `UpdatePublicAgentResponseDTO` from the GoHighLevel OpenAPI spec.
312#[derive(Debug, Clone, Default, Serialize, Deserialize)]
313pub struct UpdatePublicAgentResponseDTO {
314    /// Success status
315    /// Required by the API.
316    pub success: bool,
317    /// Response message
318    /// Required by the API.
319    pub message: String,
320    /// Updated agent or version data
321    /// Required by the API.
322    pub data: serde_json::Value,
323}
324
325/// `UpdatePublicAgentVersionDTO` from the GoHighLevel OpenAPI spec.
326#[derive(Debug, Clone, Default, Serialize, Deserialize)]
327pub struct UpdatePublicAgentVersionDTO {
328    /// Location ID for authorization
329    /// Required by the API.
330    #[serde(rename = "locationId")]
331    pub location_id: String,
332    /// Version name
333    #[serde(
334        rename = "versionName",
335        default,
336        skip_serializing_if = "Option::is_none"
337    )]
338    pub version_name: Option<String>,
339    /// Description of the version
340    #[serde(default, skip_serializing_if = "Option::is_none")]
341    pub description: Option<String>,
342    /// Complete array of nodes for the agent workflow. Provide all nodes including unchanged
343    /// ones.
344    #[serde(default, skip_serializing_if = "Vec::is_empty")]
345    pub nodes: Vec<serde_json::Value>,
346    /// Complete array of edges connecting the nodes. Provide all edges including unchanged
347    /// ones.
348    #[serde(default, skip_serializing_if = "Vec::is_empty")]
349    pub edges: Vec<serde_json::Value>,
350    /// Global variables accessible throughout the agent workflow
351    #[serde(
352        rename = "globalVariables",
353        default,
354        skip_serializing_if = "Vec::is_empty"
355    )]
356    pub global_variables: Vec<serde_json::Value>,
357    /// Input variables required from user at execution time
358    #[serde(
359        rename = "inputVariables",
360        default,
361        skip_serializing_if = "Vec::is_empty"
362    )]
363    pub input_variables: Vec<serde_json::Value>,
364    /// Runtime variables generated during agent execution
365    #[serde(
366        rename = "runtimeVariables",
367        default,
368        skip_serializing_if = "Vec::is_empty"
369    )]
370    pub runtime_variables: Vec<serde_json::Value>,
371    /// Global configuration including prompts and settings
372    #[serde(
373        rename = "globalConfig",
374        default,
375        skip_serializing_if = "Option::is_none"
376    )]
377    pub global_config: Option<serde_json::Value>,
378    /// User ID performing the update
379    #[serde(rename = "userId", default, skip_serializing_if = "Option::is_none")]
380    pub user_id: Option<String>,
381    /// User name performing the update
382    #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")]
383    pub user_name: Option<String>,
384}