ghl-models 0.5.2

Rust data models (DTOs) for the GoHighLevel (HighLevel) API v2 and v3, generated from the official OpenAPI specifications
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
//! `agent-studio` data models for GoHighLevel API V2 (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.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub success: Option<bool>,
    /// Response 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>,
    /// Created agent data with metadata
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub agent: Option<serde_json::Value>,
    /// Created versions array (initial staging version)
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[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.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub success: Option<bool>,
    /// Response 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>,
    /// 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.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub success: Option<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.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "executionId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub execution_id: Option<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.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "interactionId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub interaction_id: Option<String>,
    /// Agent response text
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub response: Option<String>,
    /// Response type
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
    pub type_: Option<String>,
    /// Expected input type for next interaction
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "nextExpectedInput",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub next_expected_input: Option<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.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "goalCompletion",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub goal_completion: Option<bool>,
    /// Execution status
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "executionStatus",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub execution_status: Option<String>,
    /// Whether flow was switched
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "flowSwitch",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub flow_switch: Option<bool>,
    /// Response attachments
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub attachments: Vec<serde_json::Value>,
    /// Generated outputs
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[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.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub success: Option<bool>,
    /// Response 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>,
    /// Agent metadata with all active versions
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub agent: Option<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.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub success: Option<bool>,
    /// Response 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>,
    /// List of agents with metadata
    /// Nested object; raw JSON (see the API docs for its fields).
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[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.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub pagination: Option<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.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub success: Option<bool>,
    /// Response 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>,
    /// Result data with production and new draft version details
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub data: Option<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.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub success: Option<bool>,
    /// Response 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>,
    /// Updated agent or version data
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub data: Option<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>,
}