Skip to main content

ghl_models/v3/
conversations.rs

1//! `conversations` data models for GoHighLevel API V3 (44 types).
2//!
3//! Generated from HighLevel's official OpenAPI spec for the
4//! **Conversations** module. Every endpoint that uses these types, with its
5//! parameters, required scopes and enum values, is documented in the
6//! [`conversations` API reference](https://github.com/Shahroz/ghl-rs/blob/main/docs/api/conversations.md).
7//!
8//! Enable with `features = ["conversations"]`.
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/// `AddMessageAttachmentsDto` from the GoHighLevel OpenAPI spec.
22#[derive(Debug, Clone, Default, Serialize, Deserialize)]
23pub struct AddMessageAttachmentsDto {
24    /// Array of attachment URLs to set on the message (replaces existing). Maximum 5 URLs.
25    /// Required by the API.
26    #[serde(default, skip_serializing_if = "Vec::is_empty")]
27    pub attachments: Vec<String>,
28}
29
30/// `CallDataDTO` from the GoHighLevel OpenAPI spec.
31#[derive(Debug, Clone, Default, Serialize, Deserialize)]
32pub struct CallDataDTO {
33    /// Phone number of the receiver
34    #[serde(default, skip_serializing_if = "Option::is_none")]
35    pub to: Option<String>,
36    /// Phone number of the dialer
37    #[serde(rename = "from", default, skip_serializing_if = "Option::is_none")]
38    pub from_: Option<String>,
39    /// Call status
40    /// Allowed values: `pending`, `completed`, `answered`, `busy`, `no-answer`, `failed`,
41    /// `canceled`, `voicemail`.
42    #[serde(default, skip_serializing_if = "Option::is_none")]
43    pub status: Option<String>,
44}
45
46/// `CancelScheduledResponseDto` from the GoHighLevel OpenAPI spec.
47#[derive(Debug, Clone, Default, Serialize, Deserialize)]
48pub struct CancelScheduledResponseDto {
49    /// HTTP Status code of the request
50    /// Required by the API.
51    /// (Optional here so responses that omit it still parse.)
52    #[serde(default, skip_serializing_if = "Option::is_none")]
53    pub status: Option<f64>,
54    /// Error message of the request
55    /// Required by the API.
56    /// (Optional here so responses that omit it still parse.)
57    #[serde(default, skip_serializing_if = "Option::is_none")]
58    pub message: Option<String>,
59}
60
61/// `CompleteFileUploadDto` from the GoHighLevel OpenAPI spec.
62#[derive(Debug, Clone, Default, Serialize, Deserialize)]
63pub struct CompleteFileUploadDto {
64    /// Upload ID from request response
65    /// Required by the API.
66    #[serde(rename = "uploadId")]
67    pub upload_id: String,
68    /// File path from request response
69    /// Required by the API.
70    #[serde(rename = "filePath")]
71    pub file_path: String,
72    /// Location ID
73    /// Required by the API.
74    #[serde(rename = "locationId")]
75    pub location_id: String,
76    /// Conversation ID
77    /// Required by the API.
78    #[serde(rename = "conversationId")]
79    pub conversation_id: String,
80    /// Original filename (for response mapping)
81    /// Required by the API.
82    pub filename: String,
83}
84
85/// `CompleteFileUploadResponseDto` from the GoHighLevel OpenAPI spec.
86#[derive(Debug, Clone, Default, Serialize, Deserialize)]
87pub struct CompleteFileUploadResponseDto {
88    /// Map of filename to public URL
89    /// Required by the API.
90    /// (Optional here so responses that omit it still parse.)
91    #[serde(
92        rename = "uploadedFiles",
93        default,
94        skip_serializing_if = "Option::is_none"
95    )]
96    pub uploaded_files: Option<serde_json::Value>,
97    /// File metadata
98    /// Required by the API.
99    /// (Optional here so responses that omit it still parse.)
100    #[serde(default, skip_serializing_if = "Option::is_none")]
101    pub metadata: Option<serde_json::Value>,
102}
103
104/// `ConversationCreateResponseDto` from the GoHighLevel OpenAPI spec.
105#[derive(Debug, Clone, Default, Serialize, Deserialize)]
106pub struct ConversationCreateResponseDto {
107    /// Unique identifier for the conversation
108    /// Required by the API.
109    /// (Optional here so responses that omit it still parse.)
110    #[serde(default, skip_serializing_if = "Option::is_none")]
111    pub id: Option<String>,
112    /// Date when the conversation was last updated
113    /// Required by the API.
114    /// (Optional here so responses that omit it still parse.)
115    #[serde(
116        rename = "dateUpdated",
117        default,
118        skip_serializing_if = "Option::is_none"
119    )]
120    pub date_updated: Option<String>,
121    /// Date when the conversation was created
122    /// Required by the API.
123    /// (Optional here so responses that omit it still parse.)
124    #[serde(rename = "dateAdded", default, skip_serializing_if = "Option::is_none")]
125    pub date_added: Option<String>,
126    /// Flag indicating if this conversation has been deleted
127    /// Required by the API.
128    /// (Optional here so responses that omit it still parse.)
129    #[serde(default, skip_serializing_if = "Option::is_none")]
130    pub deleted: Option<bool>,
131    /// Unique identifier of the contact associated with this conversation
132    /// Required by the API.
133    /// (Optional here so responses that omit it still parse.)
134    #[serde(rename = "contactId", default, skip_serializing_if = "Option::is_none")]
135    pub contact_id: Option<String>,
136    /// Unique identifier of the business location where this conversation takes place
137    /// Required by the API.
138    /// (Optional here so responses that omit it still parse.)
139    #[serde(
140        rename = "locationId",
141        default,
142        skip_serializing_if = "Option::is_none"
143    )]
144    pub location_id: Option<String>,
145    /// Date of the last message in the conversation
146    /// Required by the API.
147    /// (Optional here so responses that omit it still parse.)
148    #[serde(
149        rename = "lastMessageDate",
150        default,
151        skip_serializing_if = "Option::is_none"
152    )]
153    pub last_message_date: Option<String>,
154    /// Unique identifier of the team member assigned to this conversation
155    #[serde(
156        rename = "assignedTo",
157        default,
158        skip_serializing_if = "Option::is_none"
159    )]
160    pub assigned_to: Option<String>,
161}
162
163/// `ConversationDto` from the GoHighLevel OpenAPI spec.
164#[derive(Debug, Clone, Default, Serialize, Deserialize)]
165pub struct ConversationDto {
166    /// Contact ID as string
167    #[serde(default, skip_serializing_if = "Option::is_none")]
168    pub id: Option<String>,
169    /// Location ID as string
170    /// Required by the API.
171    /// (Optional here so responses that omit it still parse.)
172    #[serde(
173        rename = "locationId",
174        default,
175        skip_serializing_if = "Option::is_none"
176    )]
177    pub location_id: Option<String>,
178    /// Contact ID as string
179    /// Required by the API.
180    /// (Optional here so responses that omit it still parse.)
181    #[serde(rename = "contactId", default, skip_serializing_if = "Option::is_none")]
182    pub contact_id: Option<String>,
183    /// Assigned User ID as string
184    #[serde(
185        rename = "assignedTo",
186        default,
187        skip_serializing_if = "Option::is_none"
188    )]
189    pub assigned_to: Option<String>,
190    /// User ID as string
191    #[serde(rename = "userId", default, skip_serializing_if = "Option::is_none")]
192    pub user_id: Option<String>,
193    /// Last message body as string
194    #[serde(
195        rename = "lastMessageBody",
196        default,
197        skip_serializing_if = "Option::is_none"
198    )]
199    pub last_message_body: Option<String>,
200    /// Last message date as UTC
201    #[serde(
202        rename = "lastMessageDate",
203        default,
204        skip_serializing_if = "Option::is_none"
205    )]
206    pub last_message_date: Option<String>,
207    /// Type of the last message sent/received in the conversation.
208    /// Allowed values: `TYPE_CALL`, `TYPE_SMS`, `TYPE_RCS`, `TYPE_EMAIL`,
209    /// `TYPE_SMS_REVIEW_REQUEST`, `TYPE_WEBCHAT`, `TYPE_SMS_NO_SHOW_REQUEST`,
210    /// `TYPE_CAMPAIGN_SMS`, `TYPE_CAMPAIGN_CALL`, `TYPE_CAMPAIGN_EMAIL`,
211    /// `TYPE_CAMPAIGN_VOICEMAIL`, `TYPE_FACEBOOK`.
212    #[serde(
213        rename = "lastMessageType",
214        default,
215        skip_serializing_if = "Option::is_none"
216    )]
217    pub last_message_type: Option<String>,
218    /// Count of unread messages in the conversation
219    #[serde(
220        rename = "unreadCount",
221        default,
222        skip_serializing_if = "Option::is_none"
223    )]
224    pub unread_count: Option<f64>,
225    /// Inbox status of the conversation.
226    #[serde(default, skip_serializing_if = "Option::is_none")]
227    pub inbox: Option<bool>,
228    /// Starred status of the conversation.
229    #[serde(default, skip_serializing_if = "Option::is_none")]
230    pub starred: Option<bool>,
231    /// Deleted status of the conversation.
232    /// Required by the API.
233    /// (Optional here so responses that omit it still parse.)
234    #[serde(default, skip_serializing_if = "Option::is_none")]
235    pub deleted: Option<bool>,
236}
237
238/// `ConversationSchema` from the GoHighLevel OpenAPI spec.
239#[derive(Debug, Clone, Default, Serialize, Deserialize)]
240pub struct ConversationSchema {
241    /// Conversation Id
242    /// Required by the API.
243    /// (Optional here so responses that omit it still parse.)
244    #[serde(default, skip_serializing_if = "Option::is_none")]
245    pub id: Option<String>,
246    /// Contact Id
247    /// Required by the API.
248    /// (Optional here so responses that omit it still parse.)
249    #[serde(rename = "contactId", default, skip_serializing_if = "Option::is_none")]
250    pub contact_id: Option<String>,
251    /// Location Id
252    /// Required by the API.
253    /// (Optional here so responses that omit it still parse.)
254    #[serde(
255        rename = "locationId",
256        default,
257        skip_serializing_if = "Option::is_none"
258    )]
259    pub location_id: Option<String>,
260    /// Content of the most recent message in the conversation
261    /// Required by the API.
262    /// (Optional here so responses that omit it still parse.)
263    #[serde(
264        rename = "lastMessageBody",
265        default,
266        skip_serializing_if = "Option::is_none"
267    )]
268    pub last_message_body: Option<String>,
269    /// Channel/type of the most recent message (SMS, Email, Call, etc)
270    /// Allowed values: `TYPE_CALL`, `TYPE_SMS`, `TYPE_RCS`, `TYPE_EMAIL`,
271    /// `TYPE_SMS_REVIEW_REQUEST`, `TYPE_WEBCHAT`, `TYPE_SMS_NO_SHOW_REQUEST`,
272    /// `TYPE_CAMPAIGN_SMS`, `TYPE_CAMPAIGN_CALL`, `TYPE_CAMPAIGN_EMAIL`,
273    /// `TYPE_CAMPAIGN_VOICEMAIL`, `TYPE_FACEBOOK`.
274    /// Required by the API.
275    /// (Optional here so responses that omit it still parse.)
276    #[serde(
277        rename = "lastMessageType",
278        default,
279        skip_serializing_if = "Option::is_none"
280    )]
281    pub last_message_type: Option<String>,
282    /// Primary channel/type of the conversation (Phone, Email, etc)
283    /// Allowed values: `TYPE_PHONE`, `TYPE_EMAIL`, `TYPE_FB_MESSENGER`, `TYPE_REVIEW`,
284    /// `TYPE_GROUP_SMS`.
285    /// Required by the API.
286    /// (Optional here so responses that omit it still parse.)
287    #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
288    pub type_: Option<String>,
289    /// Number of unread messages in this conversation
290    /// Required by the API.
291    /// (Optional here so responses that omit it still parse.)
292    #[serde(
293        rename = "unreadCount",
294        default,
295        skip_serializing_if = "Option::is_none"
296    )]
297    pub unread_count: Option<f64>,
298    /// Complete name of the contact (first and last name)
299    /// Required by the API.
300    /// (Optional here so responses that omit it still parse.)
301    #[serde(rename = "fullName", default, skip_serializing_if = "Option::is_none")]
302    pub full_name: Option<String>,
303    /// Alternative display name for the contact - used when full name is not available
304    /// Required by the API.
305    /// (Optional here so responses that omit it still parse.)
306    #[serde(
307        rename = "contactName",
308        default,
309        skip_serializing_if = "Option::is_none"
310    )]
311    pub contact_name: Option<String>,
312    /// Primary email address of the contact
313    /// Required by the API.
314    /// (Optional here so responses that omit it still parse.)
315    #[serde(default, skip_serializing_if = "Option::is_none")]
316    pub email: Option<String>,
317    /// Primary phone number of the contact
318    /// Required by the API.
319    /// (Optional here so responses that omit it still parse.)
320    #[serde(default, skip_serializing_if = "Option::is_none")]
321    pub phone: Option<String>,
322}
323
324/// `CreateConversationDto` from the GoHighLevel OpenAPI spec.
325#[derive(Debug, Clone, Default, Serialize, Deserialize)]
326pub struct CreateConversationDto {
327    /// Location ID as string
328    /// Required by the API.
329    #[serde(rename = "locationId")]
330    pub location_id: String,
331    /// Contact ID as string
332    /// Required by the API.
333    #[serde(rename = "contactId")]
334    pub contact_id: String,
335}
336
337/// `CreateConversationSuccessResponse` from the GoHighLevel OpenAPI spec.
338#[derive(Debug, Clone, Default, Serialize, Deserialize)]
339pub struct CreateConversationSuccessResponse {
340    /// Indicates whether the API request was successful.
341    /// Required by the API.
342    /// (Optional here so responses that omit it still parse.)
343    #[serde(default, skip_serializing_if = "Option::is_none")]
344    pub success: Option<bool>,
345    /// Conversation data of the provided conversation ID.
346    /// Required by the API.
347    /// (Optional here so responses that omit it still parse.)
348    #[serde(default, skip_serializing_if = "Option::is_none")]
349    pub conversation: Option<ConversationCreateResponseDto>,
350}
351
352/// `CreateLiveChatMessageFeedbackResponse` from the GoHighLevel OpenAPI spec.
353#[derive(Debug, Clone, Default, Serialize, Deserialize)]
354pub struct CreateLiveChatMessageFeedbackResponse {
355    /// Whether the live chat feedback was recorded successfully
356    /// Required by the API.
357    /// (Optional here so responses that omit it still parse.)
358    #[serde(default, skip_serializing_if = "Option::is_none")]
359    pub success: Option<bool>,
360}
361
362/// `DeleteConversationSuccessfulResponse` from the GoHighLevel OpenAPI spec.
363#[derive(Debug, Clone, Default, Serialize, Deserialize)]
364pub struct DeleteConversationSuccessfulResponse {
365    /// Boolean value as the API response.
366    /// Required by the API.
367    /// (Optional here so responses that omit it still parse.)
368    #[serde(default, skip_serializing_if = "Option::is_none")]
369    pub success: Option<bool>,
370}
371
372/// Aggregate delivery event counters for the email message. Values are merged into existing
373/// stored counters (additive update, not replacement). A value of `0` is treated as a no-op
374/// and will not reset the stored counter. Only include fields you want to update.
375/// Provider-specific counters such as `permanent_fail`, `temporary_fail`, and
376/// `esp_isp_block` may be sent using those snake_case keys.
377#[derive(Debug, Clone, Default, Serialize, Deserialize)]
378pub struct EmailEventsDto {
379    /// Number of successful deliveries — the recipient mail server accepted the message.
380    /// Automatically inferred (set to 1) when `opened`, `clicked`, `complained`,
381    /// `unsubscribed`, or `replied` events are reported.
382    #[serde(default, skip_serializing_if = "Option::is_none")]
383    pub delivered: Option<i64>,
384    /// Number of unique open events (typically tracked via a tracking pixel). Automatically
385    /// inferred (set to 1) when `clicked`, `complained`, `unsubscribed`, or `replied` events
386    /// are reported, provided open tracking is enabled on the email.
387    #[serde(default, skip_serializing_if = "Option::is_none")]
388    pub opened: Option<i64>,
389    /// Number of link click events within the email body. Triggers automatic inference of both
390    /// `opened` and `delivered`.
391    #[serde(default, skip_serializing_if = "Option::is_none")]
392    pub clicked: Option<i64>,
393    /// Number of reply events. Triggers automatic inference of both `opened` (if open tracking
394    /// is enabled) and `delivered`.
395    #[serde(default, skip_serializing_if = "Option::is_none")]
396    pub replied: Option<i64>,
397    /// Total number of delivery failures (includes both permanent and temporary). For more
398    /// granular failure tracking, use `permanent_fail` and `temporary_fail` instead.
399    #[serde(default, skip_serializing_if = "Option::is_none")]
400    pub failed: Option<i64>,
401    /// Number of messages accepted by the receiving mail server for delivery. Automatically
402    /// inferred (set to 1) when `delivered`, `permanent_fail`, or `temporary_fail` events are
403    /// reported.
404    #[serde(default, skip_serializing_if = "Option::is_none")]
405    pub accepted: Option<i64>,
406    /// Number of messages rejected outright by the receiving mail server (before acceptance).
407    #[serde(default, skip_serializing_if = "Option::is_none")]
408    pub rejected: Option<i64>,
409    /// Number of unsubscribe events triggered by the recipient. Triggers automatic inference of
410    /// `opened` and `delivered`.
411    #[serde(default, skip_serializing_if = "Option::is_none")]
412    pub unsubscribed: Option<i64>,
413    /// Number of spam complaint events (e.g., recipient marked the email as spam). Triggers
414    /// automatic inference of `opened` and `delivered`.
415    #[serde(default, skip_serializing_if = "Option::is_none")]
416    pub complained: Option<i64>,
417    /// Number of messages stored by the email service provider (ESP-specific event).
418    #[serde(default, skip_serializing_if = "Option::is_none")]
419    pub stored: Option<i64>,
420}
421
422/// `ErrorDto` from the GoHighLevel OpenAPI spec.
423#[derive(Debug, Clone, Default, Serialize, Deserialize)]
424pub struct ErrorDto {
425    /// Error Code
426    /// Required by the API.
427    pub code: String,
428    /// Error Type
429    /// Required by the API.
430    #[serde(rename = "type")]
431    pub type_: String,
432    /// Error Message
433    /// Required by the API.
434    pub message: String,
435}
436
437/// `ExportMessagesResponseDto` from the GoHighLevel OpenAPI spec.
438#[derive(Debug, Clone, Default, Serialize, Deserialize)]
439pub struct ExportMessagesResponseDto {
440    /// Array of messages
441    /// Required by the API.
442    /// (Optional here so responses that omit it still parse.)
443    #[serde(default, skip_serializing_if = "Vec::is_empty")]
444    pub messages: Vec<GetMessageResponseDto>,
445    /// Cursor for fetching next page. Null if no more results.
446    #[serde(
447        rename = "nextCursor",
448        default,
449        skip_serializing_if = "Option::is_none"
450    )]
451    pub next_cursor: Option<String>,
452    /// Total number of messages matching the query
453    /// Required by the API.
454    /// (Optional here so responses that omit it still parse.)
455    #[serde(default, skip_serializing_if = "Option::is_none")]
456    pub total: Option<f64>,
457}
458
459/// `ForwardConfigDto` from the GoHighLevel OpenAPI spec.
460#[derive(Debug, Clone, Default, Serialize, Deserialize)]
461pub struct ForwardConfigDto {
462    /// Specify if this is a forwarded email
463    /// Required by the API.
464    #[serde(rename = "isForwarded")]
465    pub is_forwarded: bool,
466    /// Specify if forwarding the whole thread or just a single email
467    #[serde(
468        rename = "forwardWholeThread",
469        default,
470        skip_serializing_if = "Option::is_none"
471    )]
472    pub forward_whole_thread: Option<bool>,
473    /// Message ID of the email thread being forwarded (source) - REQUIRED for forwarding
474    #[serde(rename = "messageId", default, skip_serializing_if = "Option::is_none")]
475    pub message_id: Option<String>,
476    /// Email Message ID of the specific email being forwarded (source) - Required for single
477    /// email forward, ignored for thread forward
478    #[serde(
479        rename = "emailMessageId",
480        default,
481        skip_serializing_if = "Option::is_none"
482    )]
483    pub email_message_id: Option<String>,
484    /// Contact ID where the forwarded email originated from (source) - Auto-populated if not
485    /// provided
486    #[serde(
487        rename = "sourceContactId",
488        default,
489        skip_serializing_if = "Option::is_none"
490    )]
491    pub source_contact_id: Option<String>,
492    /// Conversation ID where the forwarded email originated from (source) - Auto-populated if
493    /// not provided
494    #[serde(
495        rename = "sourceConversationId",
496        default,
497        skip_serializing_if = "Option::is_none"
498    )]
499    pub source_conversation_id: Option<String>,
500    /// Email address to forward to (destination)
501    #[serde(rename = "toEmail", default, skip_serializing_if = "Option::is_none")]
502    pub to_email: Option<String>,
503    /// Contact ID of recipient when forwarding (destination)
504    #[serde(
505        rename = "recipientContactId",
506        default,
507        skip_serializing_if = "Option::is_none"
508    )]
509    pub recipient_contact_id: Option<String>,
510    /// Conversation ID of recipient when forwarding (destination)
511    #[serde(
512        rename = "recipientConversationId",
513        default,
514        skip_serializing_if = "Option::is_none"
515    )]
516    pub recipient_conversation_id: Option<String>,
517}
518
519/// `ForwardResponseDto` from the GoHighLevel OpenAPI spec.
520#[derive(Debug, Clone, Default, Serialize, Deserialize)]
521pub struct ForwardResponseDto {
522    /// Whether the entire thread was forwarded
523    #[serde(
524        rename = "forwardWholeThread",
525        default,
526        skip_serializing_if = "Option::is_none"
527    )]
528    pub forward_whole_thread: Option<bool>,
529    /// Message ID of the forwarded message (source)
530    #[serde(rename = "messageId", default, skip_serializing_if = "Option::is_none")]
531    pub message_id: Option<String>,
532    /// Email Message ID of the forwarded email (source)
533    #[serde(
534        rename = "emailMessageId",
535        default,
536        skip_serializing_if = "Option::is_none"
537    )]
538    pub email_message_id: Option<String>,
539    /// Contact ID where the forwarded email originated from (source)
540    #[serde(
541        rename = "sourceContactId",
542        default,
543        skip_serializing_if = "Option::is_none"
544    )]
545    pub source_contact_id: Option<String>,
546    /// Conversation ID where the forwarded email originated from (source)
547    #[serde(
548        rename = "sourceConversationId",
549        default,
550        skip_serializing_if = "Option::is_none"
551    )]
552    pub source_conversation_id: Option<String>,
553    /// Email address the message was forwarded to (destination)
554    #[serde(
555        rename = "forwardToEmail",
556        default,
557        skip_serializing_if = "Option::is_none"
558    )]
559    pub forward_to_email: Option<String>,
560    /// Contact ID of the recipient of the forwarded email (destination)
561    #[serde(
562        rename = "recipientContactId",
563        default,
564        skip_serializing_if = "Option::is_none"
565    )]
566    pub recipient_contact_id: Option<String>,
567    /// Conversation ID of the recipient of the forwarded email (destination)
568    #[serde(
569        rename = "recipientConversationId",
570        default,
571        skip_serializing_if = "Option::is_none"
572    )]
573    pub recipient_conversation_id: Option<String>,
574}
575
576/// `GetConversationByIdResponse` from the GoHighLevel OpenAPI spec.
577#[derive(Debug, Clone, Default, Serialize, Deserialize)]
578pub struct GetConversationByIdResponse {
579    /// Unique identifier of the contact associated with this conversation
580    /// Required by the API.
581    /// (Optional here so responses that omit it still parse.)
582    #[serde(rename = "contactId", default, skip_serializing_if = "Option::is_none")]
583    pub contact_id: Option<String>,
584    /// Unique identifier of the business location where this conversation takes place
585    /// Required by the API.
586    /// (Optional here so responses that omit it still parse.)
587    #[serde(
588        rename = "locationId",
589        default,
590        skip_serializing_if = "Option::is_none"
591    )]
592    pub location_id: Option<String>,
593    /// Flag indicating if this conversation has been moved to trash/deleted
594    /// Required by the API.
595    /// (Optional here so responses that omit it still parse.)
596    #[serde(default, skip_serializing_if = "Option::is_none")]
597    pub deleted: Option<bool>,
598    /// Flag indicating if this conversation is currently in the main inbox view
599    /// Required by the API.
600    /// (Optional here so responses that omit it still parse.)
601    #[serde(default, skip_serializing_if = "Option::is_none")]
602    pub inbox: Option<bool>,
603    /// Communication channel type for this conversation: 1 (Phone), 2 (Email), 3 (Facebook
604    /// Messenger), 4 (Review), 5 (Group SMS), 6 (Internal Chat - coming soon)
605    /// Required by the API.
606    /// (Optional here so responses that omit it still parse.)
607    #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
608    pub type_: Option<f64>,
609    /// Number of messages in this conversation that have not been read by the user
610    /// Required by the API.
611    /// (Optional here so responses that omit it still parse.)
612    #[serde(
613        rename = "unreadCount",
614        default,
615        skip_serializing_if = "Option::is_none"
616    )]
617    pub unread_count: Option<f64>,
618    /// Unique identifier of the team member currently responsible for handling this
619    /// conversation
620    #[serde(
621        rename = "assignedTo",
622        default,
623        skip_serializing_if = "Option::is_none"
624    )]
625    pub assigned_to: Option<String>,
626    /// Unique identifier for this specific conversation thread
627    /// Required by the API.
628    /// (Optional here so responses that omit it still parse.)
629    #[serde(default, skip_serializing_if = "Option::is_none")]
630    pub id: Option<String>,
631    /// Flag indicating if this conversation has been marked as important/starred by the user
632    #[serde(default, skip_serializing_if = "Option::is_none")]
633    pub starred: Option<bool>,
634}
635
636/// `GetConversationSuccessfulResponse` from the GoHighLevel OpenAPI spec.
637#[derive(Debug, Clone, Default, Serialize, Deserialize)]
638pub struct GetConversationSuccessfulResponse {
639    /// Boolean value as the API response.
640    /// Required by the API.
641    /// (Optional here so responses that omit it still parse.)
642    #[serde(default, skip_serializing_if = "Option::is_none")]
643    pub success: Option<bool>,
644    /// Conversation data of the provided conversation ID.
645    /// Required by the API.
646    /// (Optional here so responses that omit it still parse.)
647    #[serde(default, skip_serializing_if = "Option::is_none")]
648    pub conversation: Option<ConversationDto>,
649}
650
651/// `GetEmailMessageResponseDto` from the GoHighLevel OpenAPI spec.
652#[derive(Debug, Clone, Default, Serialize, Deserialize)]
653pub struct GetEmailMessageResponseDto {
654    /// Unique identifier for the email message
655    /// Required by the API.
656    /// (Optional here so responses that omit it still parse.)
657    #[serde(default, skip_serializing_if = "Option::is_none")]
658    pub id: Option<String>,
659    /// External Id
660    #[serde(rename = "altId", default, skip_serializing_if = "Option::is_none")]
661    pub alt_id: Option<String>,
662    /// Message Id or thread Id
663    /// Required by the API.
664    /// (Optional here so responses that omit it still parse.)
665    #[serde(rename = "threadId", default, skip_serializing_if = "Option::is_none")]
666    pub thread_id: Option<String>,
667    /// Location ID associated with the email message
668    /// Required by the API.
669    /// (Optional here so responses that omit it still parse.)
670    #[serde(
671        rename = "locationId",
672        default,
673        skip_serializing_if = "Option::is_none"
674    )]
675    pub location_id: Option<String>,
676    /// Contact ID associated with the email message
677    /// Required by the API.
678    /// (Optional here so responses that omit it still parse.)
679    #[serde(rename = "contactId", default, skip_serializing_if = "Option::is_none")]
680    pub contact_id: Option<String>,
681    /// Conversation ID associated with the email message
682    /// Required by the API.
683    /// (Optional here so responses that omit it still parse.)
684    #[serde(
685        rename = "conversationId",
686        default,
687        skip_serializing_if = "Option::is_none"
688    )]
689    pub conversation_id: Option<String>,
690    /// Timestamp when the email message was created
691    /// Required by the API.
692    /// (Optional here so responses that omit it still parse.)
693    #[serde(rename = "dateAdded", default, skip_serializing_if = "Option::is_none")]
694    pub date_added: Option<String>,
695    /// Subject line of the email message
696    #[serde(default, skip_serializing_if = "Option::is_none")]
697    pub subject: Option<String>,
698    /// Body content of the email message
699    /// Required by the API.
700    /// (Optional here so responses that omit it still parse.)
701    #[serde(default, skip_serializing_if = "Option::is_none")]
702    pub body: Option<String>,
703    /// Direction of the email message
704    /// Allowed values: `inbound`, `outbound`.
705    /// Required by the API.
706    /// (Optional here so responses that omit it still parse.)
707    #[serde(default, skip_serializing_if = "Option::is_none")]
708    pub direction: Option<String>,
709    /// Delivery status of the email message
710    /// Allowed values: `pending`, `scheduled`, `sent`, `delivered`, `read`, `undelivered`,
711    /// `connected`, `failed`, `opened`.
712    #[serde(default, skip_serializing_if = "Option::is_none")]
713    pub status: Option<String>,
714    /// Content type of the email body
715    /// Required by the API.
716    /// (Optional here so responses that omit it still parse.)
717    #[serde(
718        rename = "contentType",
719        default,
720        skip_serializing_if = "Option::is_none"
721    )]
722    pub content_type: Option<String>,
723    /// An array of attachment URLs.
724    #[serde(default, skip_serializing_if = "Vec::is_empty")]
725    pub attachments: Vec<String>,
726    /// Email provider used to send or receive the message
727    #[serde(default, skip_serializing_if = "Option::is_none")]
728    pub provider: Option<String>,
729    /// Name and Email Id of the sender
730    /// Required by the API.
731    /// (Optional here so responses that omit it still parse.)
732    #[serde(rename = "from", default, skip_serializing_if = "Option::is_none")]
733    pub from_: Option<String>,
734    /// List of email Ids of the receivers
735    /// Required by the API.
736    /// (Optional here so responses that omit it still parse.)
737    #[serde(default, skip_serializing_if = "Vec::is_empty")]
738    pub to: Vec<String>,
739    /// List of email Ids of the people in the cc field
740    #[serde(default, skip_serializing_if = "Vec::is_empty")]
741    pub cc: Vec<String>,
742    /// List of email Ids of the people in the bcc field
743    #[serde(default, skip_serializing_if = "Vec::is_empty")]
744    pub bcc: Vec<String>,
745    /// In case of reply, email message Id of the reply to email
746    #[serde(
747        rename = "replyToMessageId",
748        default,
749        skip_serializing_if = "Option::is_none"
750    )]
751    pub reply_to_message_id: Option<String>,
752    /// Email source
753    /// Allowed values: `workflow`, `bulk_actions`, `campaign`, `api`, `app`.
754    #[serde(default, skip_serializing_if = "Option::is_none")]
755    pub source: Option<String>,
756    /// Conversation provider ID
757    #[serde(
758        rename = "conversationProviderId",
759        default,
760        skip_serializing_if = "Option::is_none"
761    )]
762    pub conversation_provider_id: Option<String>,
763}
764
765/// `GetMessageResponseDto` from the GoHighLevel OpenAPI spec.
766#[derive(Debug, Clone, Default, Serialize, Deserialize)]
767pub struct GetMessageResponseDto {
768    /// Unique identifier for the message
769    /// Required by the API.
770    /// (Optional here so responses that omit it still parse.)
771    #[serde(default, skip_serializing_if = "Option::is_none")]
772    pub id: Option<String>,
773    /// Numeric message type code
774    /// Required by the API.
775    /// (Optional here so responses that omit it still parse.)
776    #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
777    pub type_: Option<f64>,
778    /// Type of the message as a string
779    /// Allowed values: `TYPE_CALL`, `TYPE_SMS`, `TYPE_RCS`, `TYPE_EMAIL`,
780    /// `TYPE_SMS_REVIEW_REQUEST`, `TYPE_WEBCHAT`, `TYPE_SMS_NO_SHOW_REQUEST`,
781    /// `TYPE_CAMPAIGN_SMS`, `TYPE_CAMPAIGN_CALL`, `TYPE_CAMPAIGN_EMAIL`,
782    /// `TYPE_CAMPAIGN_VOICEMAIL`, `TYPE_FACEBOOK`.
783    /// Required by the API.
784    /// (Optional here so responses that omit it still parse.)
785    #[serde(
786        rename = "messageType",
787        default,
788        skip_serializing_if = "Option::is_none"
789    )]
790    pub message_type: Option<String>,
791    /// Location ID associated with the message
792    /// Required by the API.
793    /// (Optional here so responses that omit it still parse.)
794    #[serde(
795        rename = "locationId",
796        default,
797        skip_serializing_if = "Option::is_none"
798    )]
799    pub location_id: Option<String>,
800    /// Contact ID associated with the message
801    /// Required by the API.
802    /// (Optional here so responses that omit it still parse.)
803    #[serde(rename = "contactId", default, skip_serializing_if = "Option::is_none")]
804    pub contact_id: Option<String>,
805    /// Conversation ID associated with the message
806    /// Required by the API.
807    /// (Optional here so responses that omit it still parse.)
808    #[serde(
809        rename = "conversationId",
810        default,
811        skip_serializing_if = "Option::is_none"
812    )]
813    pub conversation_id: Option<String>,
814    /// Timestamp when the message was created
815    /// Required by the API.
816    /// (Optional here so responses that omit it still parse.)
817    #[serde(rename = "dateAdded", default, skip_serializing_if = "Option::is_none")]
818    pub date_added: Option<String>,
819    /// Body content of the message
820    #[serde(default, skip_serializing_if = "Option::is_none")]
821    pub body: Option<String>,
822    /// Direction of the message
823    /// Allowed values: `inbound`, `outbound`.
824    /// Required by the API.
825    /// (Optional here so responses that omit it still parse.)
826    #[serde(default, skip_serializing_if = "Option::is_none")]
827    pub direction: Option<String>,
828    /// Delivery status of the message
829    /// Allowed values: `connected`, `delivered`, `failed`, `opened`, `pending`, `read`,
830    /// `scheduled`, `sent`, `undelivered`, `clicked`, `opt_out`, `queued`.
831    #[serde(default, skip_serializing_if = "Option::is_none")]
832    pub status: Option<String>,
833    /// Content type of the message body
834    /// Required by the API.
835    /// (Optional here so responses that omit it still parse.)
836    #[serde(
837        rename = "contentType",
838        default,
839        skip_serializing_if = "Option::is_none"
840    )]
841    pub content_type: Option<String>,
842    /// An array of attachment URLs. Attachments will be empty for Call and Voicemails, type 1
843    /// and 10. Please use get call recording API to fetch call recording and voicemails.
844    #[serde(default, skip_serializing_if = "Vec::is_empty")]
845    pub attachments: Vec<String>,
846    /// Additional metadata associated with the message
847    #[serde(default, skip_serializing_if = "Option::is_none")]
848    pub meta: Option<MessageMeta>,
849    /// Message source
850    /// Allowed values: `workflow`, `bulk_actions`, `campaign`, `api`, `app`.
851    #[serde(default, skip_serializing_if = "Option::is_none")]
852    pub source: Option<String>,
853    /// User Id
854    #[serde(rename = "userId", default, skip_serializing_if = "Option::is_none")]
855    pub user_id: Option<String>,
856    /// Conversation Provider Id
857    #[serde(
858        rename = "conversationProviderId",
859        default,
860        skip_serializing_if = "Option::is_none"
861    )]
862    pub conversation_provider_id: Option<String>,
863    /// Chat Widget Id
864    #[serde(
865        rename = "chatWidgetId",
866        default,
867        skip_serializing_if = "Option::is_none"
868    )]
869    pub chat_widget_id: Option<String>,
870}
871
872/// `GetMessageTranscriptionResponseDto` from the GoHighLevel OpenAPI spec.
873#[derive(Debug, Clone, Default, Serialize, Deserialize)]
874pub struct GetMessageTranscriptionResponseDto {
875    /// Media channel describes the user interaction channel
876    /// Required by the API.
877    /// (Optional here so responses that omit it still parse.)
878    #[serde(
879        rename = "mediaChannel",
880        default,
881        skip_serializing_if = "Option::is_none"
882    )]
883    pub media_channel: Option<f64>,
884    /// Index of the sentence in the transcription
885    /// Required by the API.
886    /// (Optional here so responses that omit it still parse.)
887    #[serde(
888        rename = "sentenceIndex",
889        default,
890        skip_serializing_if = "Option::is_none"
891    )]
892    pub sentence_index: Option<f64>,
893    /// Start time of the sentence in milliseconds
894    /// Required by the API.
895    /// (Optional here so responses that omit it still parse.)
896    #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")]
897    pub start_time: Option<f64>,
898    /// End time of the sentence in milliseconds
899    /// Required by the API.
900    /// (Optional here so responses that omit it still parse.)
901    #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")]
902    pub end_time: Option<f64>,
903    /// Transcript of the sentence
904    /// Required by the API.
905    /// (Optional here so responses that omit it still parse.)
906    #[serde(default, skip_serializing_if = "Option::is_none")]
907    pub transcript: Option<String>,
908    /// Confidence of the transcription
909    /// Required by the API.
910    /// (Optional here so responses that omit it still parse.)
911    #[serde(default, skip_serializing_if = "Option::is_none")]
912    pub confidence: Option<f64>,
913}
914
915/// `GetMessagesByConversationResponseDto` from the GoHighLevel OpenAPI spec.
916#[derive(Debug, Clone, Default, Serialize, Deserialize)]
917pub struct GetMessagesByConversationResponseDto {
918    /// Id of the last message in the messages array
919    /// Required by the API.
920    /// (Optional here so responses that omit it still parse.)
921    #[serde(
922        rename = "lastMessageId",
923        default,
924        skip_serializing_if = "Option::is_none"
925    )]
926    pub last_message_id: Option<String>,
927    /// Next page value true indicates only 20 message is in the response. Rest of the messages
928    /// are in the next page. Please use the lastMessageId value in the query to get the next
929    /// page messages
930    /// Required by the API.
931    /// (Optional here so responses that omit it still parse.)
932    #[serde(rename = "nextPage", default, skip_serializing_if = "Option::is_none")]
933    pub next_page: Option<bool>,
934    /// Array of messages
935    /// Required by the API.
936    /// (Optional here so responses that omit it still parse.)
937    #[serde(default, skip_serializing_if = "Vec::is_empty")]
938    pub messages: Vec<GetMessageResponseDto>,
939}
940
941/// `InitiateFileUploadDto` from the GoHighLevel OpenAPI spec.
942#[derive(Debug, Clone, Default, Serialize, Deserialize)]
943pub struct InitiateFileUploadDto {
944    /// Location ID
945    /// Required by the API.
946    #[serde(rename = "locationId")]
947    pub location_id: String,
948    /// Conversation ID
949    /// Required by the API.
950    #[serde(rename = "conversationId")]
951    pub conversation_id: String,
952    /// Original filename with extension
953    /// Required by the API.
954    pub filename: String,
955    /// MIME type of the file
956    /// Required by the API.
957    #[serde(rename = "contentType")]
958    pub content_type: String,
959    /// File size in bytes (optional, for pre-validation)
960    #[serde(rename = "fileSize", default, skip_serializing_if = "Option::is_none")]
961    pub file_size: Option<f64>,
962    /// Channel type for size limits (WHATSAPP for 100MB limit, others for 5MB)
963    /// Required by the API.
964    pub channel: String,
965}
966
967/// `InitiateFileUploadResponseDto` from the GoHighLevel OpenAPI spec.
968#[derive(Debug, Clone, Default, Serialize, Deserialize)]
969pub struct InitiateFileUploadResponseDto {
970    /// Signed URL for direct upload to GCS. Use PUT request with file content.
971    /// Required by the API.
972    /// (Optional here so responses that omit it still parse.)
973    #[serde(rename = "uploadUrl", default, skip_serializing_if = "Option::is_none")]
974    pub upload_url: Option<String>,
975    /// Unique upload ID for tracking and completing the upload
976    /// Required by the API.
977    /// (Optional here so responses that omit it still parse.)
978    #[serde(rename = "uploadId", default, skip_serializing_if = "Option::is_none")]
979    pub upload_id: Option<String>,
980    /// File path in GCS bucket (needed for confirmation endpoint)
981    /// Required by the API.
982    /// (Optional here so responses that omit it still parse.)
983    #[serde(rename = "filePath", default, skip_serializing_if = "Option::is_none")]
984    pub file_path: Option<String>,
985    /// URL expiration timestamp (Unix milliseconds)
986    /// Required by the API.
987    /// (Optional here so responses that omit it still parse.)
988    #[serde(rename = "expiresAt", default, skip_serializing_if = "Option::is_none")]
989    pub expires_at: Option<f64>,
990    /// Maximum allowed file size in bytes
991    /// Required by the API.
992    /// (Optional here so responses that omit it still parse.)
993    #[serde(
994        rename = "maxFileSize",
995        default,
996        skip_serializing_if = "Option::is_none"
997    )]
998    pub max_file_size: Option<f64>,
999}
1000
1001/// `MessageMeta` from the GoHighLevel OpenAPI spec.
1002#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1003pub struct MessageMeta {
1004    /// Call duration in seconds
1005    #[serde(
1006        rename = "callDuration",
1007        default,
1008        skip_serializing_if = "Option::is_none"
1009    )]
1010    pub call_duration: Option<String>,
1011    /// Call status - can be pending, completed, answered, busy, no-answer, failed, canceled, or
1012    /// voicemail
1013    /// Allowed values: `pending`, `completed`, `answered`, `busy`, `no-answer`, `failed`,
1014    /// `canceled`, `voicemail`.
1015    #[serde(
1016        rename = "callStatus",
1017        default,
1018        skip_serializing_if = "Option::is_none"
1019    )]
1020    pub call_status: Option<String>,
1021    /// meta will contain email, for message type 3 (email). messageIds is list of all email
1022    /// message ids under the message thread
1023    #[serde(default, skip_serializing_if = "Option::is_none")]
1024    pub email: Option<serde_json::Value>,
1025}
1026
1027/// `ProcessMessageBodyDto` from the GoHighLevel OpenAPI spec.
1028#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1029pub struct ProcessMessageBodyDto {
1030    /// Message Type
1031    /// Allowed values: `SMS`, `RCS`, `Email`, `WhatsApp`, `GMB`, `IG`, `FB`, `Custom`,
1032    /// `WebChat`, `Live_Chat`, `Call`, `IVR_Call`.
1033    /// Required by the API.
1034    #[serde(rename = "type")]
1035    pub type_: String,
1036    /// Array of attachments
1037    #[serde(default, skip_serializing_if = "Vec::is_empty")]
1038    pub attachments: Vec<String>,
1039    /// Message Body
1040    #[serde(default, skip_serializing_if = "Option::is_none")]
1041    pub message: Option<String>,
1042    /// Conversation Id
1043    /// Required by the API.
1044    #[serde(rename = "conversationId")]
1045    pub conversation_id: String,
1046    /// Contact Id
1047    /// Required by the API.
1048    #[serde(rename = "contactId")]
1049    pub contact_id: String,
1050    /// Conversation Provider Id
1051    /// Required by the API.
1052    #[serde(rename = "conversationProviderId")]
1053    pub conversation_provider_id: String,
1054    /// HTML Body of Email
1055    #[serde(default, skip_serializing_if = "Option::is_none")]
1056    pub html: Option<String>,
1057    /// Subject of the Email
1058    #[serde(default, skip_serializing_if = "Option::is_none")]
1059    pub subject: Option<String>,
1060    /// Email address to send from. This field is associated with the contact record and cannot
1061    /// be dynamically changed.
1062    #[serde(rename = "emailFrom", default, skip_serializing_if = "Option::is_none")]
1063    pub email_from: Option<String>,
1064    /// Recipient email address. This field is associated with the contact record and cannot be
1065    /// dynamically changed.
1066    #[serde(rename = "emailTo", default, skip_serializing_if = "Option::is_none")]
1067    pub email_to: Option<String>,
1068    /// List of email address to CC
1069    #[serde(rename = "emailCc", default, skip_serializing_if = "Vec::is_empty")]
1070    pub email_cc: Vec<String>,
1071    /// List of email address to BCC
1072    #[serde(rename = "emailBcc", default, skip_serializing_if = "Vec::is_empty")]
1073    pub email_bcc: Vec<String>,
1074    /// Send the email message id for which this email should be threaded. This is for replying
1075    /// to a specific email
1076    #[serde(
1077        rename = "emailMessageId",
1078        default,
1079        skip_serializing_if = "Option::is_none"
1080    )]
1081    pub email_message_id: Option<String>,
1082    /// external mail provider's message id
1083    #[serde(rename = "altId", default, skip_serializing_if = "Option::is_none")]
1084    pub alt_id: Option<String>,
1085    /// Message direction, if required can be set manually, default is outbound
1086    #[serde(default, skip_serializing_if = "Option::is_none")]
1087    pub direction: Option<serde_json::Value>,
1088    /// Date of the inbound message
1089    /// Format: date-time (ISO-8601 string).
1090    #[serde(default, skip_serializing_if = "Option::is_none")]
1091    pub date: Option<String>,
1092    /// Phone call dialer and receiver information
1093    #[serde(default, skip_serializing_if = "Option::is_none")]
1094    pub call: Option<CallDataDTO>,
1095}
1096
1097/// `ProcessMessageResponseDto` from the GoHighLevel OpenAPI spec.
1098#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1099pub struct ProcessMessageResponseDto {
1100    /// Whether the message processing succeeded
1101    /// Required by the API.
1102    /// (Optional here so responses that omit it still parse.)
1103    #[serde(default, skip_serializing_if = "Option::is_none")]
1104    pub success: Option<bool>,
1105    /// Conversation ID.
1106    /// Required by the API.
1107    /// (Optional here so responses that omit it still parse.)
1108    #[serde(
1109        rename = "conversationId",
1110        default,
1111        skip_serializing_if = "Option::is_none"
1112    )]
1113    pub conversation_id: Option<String>,
1114    /// This is the main Message ID
1115    /// Required by the API.
1116    /// (Optional here so responses that omit it still parse.)
1117    #[serde(rename = "messageId", default, skip_serializing_if = "Option::is_none")]
1118    pub message_id: Option<String>,
1119    /// Result message returned after processing
1120    /// Required by the API.
1121    /// (Optional here so responses that omit it still parse.)
1122    #[serde(default, skip_serializing_if = "Option::is_none")]
1123    pub message: Option<String>,
1124    /// Contact ID associated with the processed message
1125    #[serde(rename = "contactId", default, skip_serializing_if = "Option::is_none")]
1126    pub contact_id: Option<String>,
1127    /// Timestamp when the processed message was created
1128    /// Format: date-time (ISO-8601 string).
1129    #[serde(rename = "dateAdded", default, skip_serializing_if = "Option::is_none")]
1130    pub date_added: Option<String>,
1131    /// Email message ID created for email conversations
1132    #[serde(
1133        rename = "emailMessageId",
1134        default,
1135        skip_serializing_if = "Option::is_none"
1136    )]
1137    pub email_message_id: Option<String>,
1138}
1139
1140/// `ProcessOutboundMessageBodyDto` from the GoHighLevel OpenAPI spec.
1141#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1142pub struct ProcessOutboundMessageBodyDto {
1143    /// Message Type
1144    /// Allowed values: `Call`.
1145    /// Required by the API.
1146    #[serde(rename = "type")]
1147    pub type_: String,
1148    /// Array of attachments
1149    #[serde(default, skip_serializing_if = "Vec::is_empty")]
1150    pub attachments: Vec<String>,
1151    /// Conversation Id
1152    /// Required by the API.
1153    #[serde(rename = "conversationId")]
1154    pub conversation_id: String,
1155    /// Conversation Provider Id
1156    /// Required by the API.
1157    #[serde(rename = "conversationProviderId")]
1158    pub conversation_provider_id: String,
1159    /// external mail provider's message id
1160    #[serde(rename = "altId", default, skip_serializing_if = "Option::is_none")]
1161    pub alt_id: Option<String>,
1162    /// Date of the outbound message
1163    /// Format: date-time (ISO-8601 string).
1164    #[serde(default, skip_serializing_if = "Option::is_none")]
1165    pub date: Option<String>,
1166    /// Phone call dialer and receiver information
1167    #[serde(default, skip_serializing_if = "Option::is_none")]
1168    pub call: Option<CallDataDTO>,
1169}
1170
1171/// `SendConversationResponseDto` from the GoHighLevel OpenAPI spec.
1172#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1173pub struct SendConversationResponseDto {
1174    /// The list of all conversations found for the given query
1175    /// Required by the API.
1176    /// (Optional here so responses that omit it still parse.)
1177    #[serde(default, skip_serializing_if = "Vec::is_empty")]
1178    pub conversations: Vec<ConversationSchema>,
1179    /// Total Number of results found for the given query
1180    /// Required by the API.
1181    /// (Optional here so responses that omit it still parse.)
1182    #[serde(default, skip_serializing_if = "Option::is_none")]
1183    pub total: Option<f64>,
1184}
1185
1186/// `SendMessageBodyDto` from the GoHighLevel OpenAPI spec.
1187#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1188pub struct SendMessageBodyDto {
1189    /// Type of message being sent
1190    /// Allowed values: `SMS`, `RCS`, `Email`, `WhatsApp`, `IG`, `FB`, `Custom`, `Live_Chat`,
1191    /// `TIKTOK`.
1192    /// Required by the API.
1193    #[serde(rename = "type")]
1194    pub type_: String,
1195    /// Type of message being sent
1196    /// Required by the API.
1197    #[serde(rename = "subType")]
1198    pub sub_type: serde_json::Value,
1199    /// ID of the contact receiving the message
1200    /// Required by the API.
1201    #[serde(rename = "contactId")]
1202    pub contact_id: String,
1203    /// ID of the associated appointment
1204    #[serde(
1205        rename = "appointmentId",
1206        default,
1207        skip_serializing_if = "Option::is_none"
1208    )]
1209    pub appointment_id: Option<String>,
1210    /// Array of attachment URLs
1211    #[serde(default, skip_serializing_if = "Vec::is_empty")]
1212    pub attachments: Vec<String>,
1213    /// Email address to send from
1214    #[serde(rename = "emailFrom", default, skip_serializing_if = "Option::is_none")]
1215    pub email_from: Option<String>,
1216    /// Array of CC email addresses
1217    #[serde(rename = "emailCc", default, skip_serializing_if = "Vec::is_empty")]
1218    pub email_cc: Vec<String>,
1219    /// Array of BCC email addresses
1220    #[serde(rename = "emailBcc", default, skip_serializing_if = "Vec::is_empty")]
1221    pub email_bcc: Vec<String>,
1222    /// HTML content of the message
1223    #[serde(default, skip_serializing_if = "Option::is_none")]
1224    pub html: Option<String>,
1225    /// Text content of the message
1226    #[serde(default, skip_serializing_if = "Option::is_none")]
1227    pub message: Option<String>,
1228    /// Subject line for email messages
1229    #[serde(default, skip_serializing_if = "Option::is_none")]
1230    pub subject: Option<String>,
1231    /// ID of message being replied to
1232    #[serde(
1233        rename = "replyMessageId",
1234        default,
1235        skip_serializing_if = "Option::is_none"
1236    )]
1237    pub reply_message_id: Option<String>,
1238    /// ID of message template
1239    #[serde(
1240        rename = "templateId",
1241        default,
1242        skip_serializing_if = "Option::is_none"
1243    )]
1244    pub template_id: Option<String>,
1245    /// ID of message thread. For email messages, this is the message ID that contains multiple
1246    /// email messages in the thread
1247    #[serde(rename = "threadId", default, skip_serializing_if = "Option::is_none")]
1248    pub thread_id: Option<String>,
1249    /// UTC Timestamp (in seconds) at which the message should be scheduled
1250    #[serde(
1251        rename = "scheduledTimestamp",
1252        default,
1253        skip_serializing_if = "Option::is_none"
1254    )]
1255    pub scheduled_timestamp: Option<f64>,
1256    /// ID of conversation provider
1257    #[serde(
1258        rename = "conversationProviderId",
1259        default,
1260        skip_serializing_if = "Option::is_none"
1261    )]
1262    pub conversation_provider_id: Option<String>,
1263    /// Email address to send to, if different from contact's primary email. This should be a
1264    /// valid email address associated with the contact.
1265    #[serde(rename = "emailTo", default, skip_serializing_if = "Option::is_none")]
1266    pub email_to: Option<String>,
1267    /// Custom subtype ID for email unsubscription preferences. Only applies to email messages.
1268    #[serde(
1269        rename = "customSubtypeId",
1270        default,
1271        skip_serializing_if = "Option::is_none"
1272    )]
1273    pub custom_subtype_id: Option<String>,
1274    /// Mode for email replies
1275    /// Allowed values: `reply`, `reply_all`.
1276    #[serde(
1277        rename = "emailReplyMode",
1278        default,
1279        skip_serializing_if = "Option::is_none"
1280    )]
1281    pub email_reply_mode: Option<String>,
1282    /// Phone number used as the sender number for outbound messages
1283    #[serde(
1284        rename = "fromNumber",
1285        default,
1286        skip_serializing_if = "Option::is_none"
1287    )]
1288    pub from_number: Option<String>,
1289    /// Recipient phone number for outbound messages
1290    #[serde(rename = "toNumber", default, skip_serializing_if = "Option::is_none")]
1291    pub to_number: Option<String>,
1292    /// Forwarding configuration for emails
1293    #[serde(default, skip_serializing_if = "Option::is_none")]
1294    pub forward: Option<ForwardConfigDto>,
1295    /// Message status
1296    /// Allowed values: `delivered`, `failed`, `pending`, `read`.
1297    /// Required by the API.
1298    pub status: String,
1299    /// Whether the scheduled email uses native AI for the email scheduling
1300    #[serde(
1301        rename = "usesNativeSchedulingAi",
1302        default,
1303        skip_serializing_if = "Option::is_none"
1304    )]
1305    pub uses_native_scheduling_ai: Option<bool>,
1306    /// Optimization period in hours (24h, 48h, or 72h)
1307    /// Allowed values: `24h`, `48h`, `72h`.
1308    #[serde(
1309        rename = "optimizationPeriod",
1310        default,
1311        skip_serializing_if = "Option::is_none"
1312    )]
1313    pub optimization_period: Option<String>,
1314}
1315
1316/// `SendMessageResponseDto` from the GoHighLevel OpenAPI spec.
1317#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1318pub struct SendMessageResponseDto {
1319    /// Conversation ID.
1320    /// Required by the API.
1321    /// (Optional here so responses that omit it still parse.)
1322    #[serde(
1323        rename = "conversationId",
1324        default,
1325        skip_serializing_if = "Option::is_none"
1326    )]
1327    pub conversation_id: Option<String>,
1328    /// This contains the email message ID (only for Email type). Use this ID to send inbound
1329    /// replies through this API to create a threaded email.
1330    #[serde(
1331        rename = "emailMessageId",
1332        default,
1333        skip_serializing_if = "Option::is_none"
1334    )]
1335    pub email_message_id: Option<String>,
1336    /// This is the main Message ID
1337    /// Required by the API.
1338    /// (Optional here so responses that omit it still parse.)
1339    #[serde(rename = "messageId", default, skip_serializing_if = "Option::is_none")]
1340    pub message_id: Option<String>,
1341    /// When sending via the GMB channel, we will be returning list of `messageIds` instead of
1342    /// single `messageId`.
1343    #[serde(rename = "messageIds", default, skip_serializing_if = "Vec::is_empty")]
1344    pub message_ids: Vec<String>,
1345    /// Additional response message when sending a workflow message
1346    #[serde(default, skip_serializing_if = "Option::is_none")]
1347    pub msg: Option<String>,
1348    /// Optional metadata for forwarded email
1349    #[serde(
1350        rename = "forwardData",
1351        default,
1352        skip_serializing_if = "Option::is_none"
1353    )]
1354    pub forward_data: Option<ForwardResponseDto>,
1355    /// Message status
1356    /// Allowed values: `delivered`, `failed`, `pending`, `read`.
1357    /// Required by the API.
1358    /// (Optional here so responses that omit it still parse.)
1359    #[serde(default, skip_serializing_if = "Option::is_none")]
1360    pub status: Option<String>,
1361}
1362
1363/// `SendReviewReplyDto` from the GoHighLevel OpenAPI spec.
1364#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1365pub struct SendReviewReplyDto {
1366    /// Conversation ID (must have reviewId)
1367    /// Required by the API.
1368    #[serde(rename = "conversationId")]
1369    pub conversation_id: String,
1370    /// Location ID
1371    /// Required by the API.
1372    #[serde(rename = "locationId")]
1373    pub location_id: String,
1374    /// Review reply message text
1375    /// Required by the API.
1376    pub message: String,
1377}
1378
1379/// `StartAfterArrayNumberSchema` from the GoHighLevel OpenAPI spec.
1380#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1381pub struct StartAfterArrayNumberSchema {
1382    /// Search to begin after the specified date - should contain the sort value of the last
1383    /// document
1384    #[serde(
1385        rename = "startAfterDate",
1386        default,
1387        skip_serializing_if = "Vec::is_empty"
1388    )]
1389    pub start_after_date: Vec<String>,
1390}
1391
1392/// `StartAfterNumberSchema` from the GoHighLevel OpenAPI spec.
1393#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1394pub struct StartAfterNumberSchema {
1395    /// Search to begin after the specified date - should contain the sort value of the last
1396    /// document
1397    #[serde(
1398        rename = "startAfterDate",
1399        default,
1400        skip_serializing_if = "Option::is_none"
1401    )]
1402    pub start_after_date: Option<f64>,
1403}
1404
1405/// `UpdateConversationDto` from the GoHighLevel OpenAPI spec.
1406#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1407pub struct UpdateConversationDto {
1408    /// Location ID as string
1409    /// Required by the API.
1410    #[serde(rename = "locationId")]
1411    pub location_id: String,
1412    /// Count of unread messages in the conversation
1413    #[serde(
1414        rename = "unreadCount",
1415        default,
1416        skip_serializing_if = "Option::is_none"
1417    )]
1418    pub unread_count: Option<f64>,
1419    /// Starred status of the conversation.
1420    #[serde(default, skip_serializing_if = "Option::is_none")]
1421    pub starred: Option<bool>,
1422    /// Live chat feedback value for the conversation
1423    /// Allowed values: `positive`, `negative`.
1424    #[serde(default, skip_serializing_if = "Option::is_none")]
1425    pub feedback: Option<String>,
1426}
1427
1428/// Request body to update the delivery status of an email message. `status` is required.
1429/// `events` and `recipients` are optional and may be included together with `status`. - Use
1430/// `events` to report aggregate delivery metrics (delivered count, open count, etc.). - Use
1431/// `recipients` to track per-recipient delivery outcomes for multi-recipient emails. - Use
1432/// `status` to set the overall message status. Multiple calls are additive — event counters
1433/// are merged, recipient statuses are upserted, and the message status is overwritten.
1434#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1435pub struct UpdateEmailMessageStatusDto {
1436    /// Aggregate delivery event counters. Counters are merged into existing values. The API
1437    /// automatically infers related events (e.g., reporting `clicked` will also set `opened`
1438    /// and `delivered` if not already present). See the endpoint description for the full
1439    /// inference rules.
1440    #[serde(default, skip_serializing_if = "Option::is_none")]
1441    pub events: Option<EmailEventsDto>,
1442    /// Per-recipient delivery statuses. Each entry maps a recipient email address to a delivery
1443    /// status. Entries are upserted — if a recipient already has a status, it will be
1444    /// overwritten with the new value.
1445    #[serde(default, skip_serializing_if = "Vec::is_empty")]
1446    pub recipients: Vec<UpdateRecipientMessageStatusDto>,
1447    /// The overall status of the email message. Required on every request. For emails with
1448    /// multiple recipients, consider using the `recipients` array for granular tracking and
1449    /// this field for the aggregate status.
1450    /// Allowed values: `pending`, `scheduled`, `sent`, `delivered`, `read`, `undelivered`,
1451    /// `connected`, `failed`, `opened`, `clicked`.
1452    /// Required by the API.
1453    pub status: String,
1454}
1455
1456/// Response returned after successfully updating the email message status.
1457#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1458pub struct UpdateEmailMessageStatusResponseDto {
1459    /// Whether the status update was persisted successfully.
1460    /// Required by the API.
1461    /// (Optional here so responses that omit it still parse.)
1462    #[serde(default, skip_serializing_if = "Option::is_none")]
1463    pub success: Option<bool>,
1464    /// Human-readable result message.
1465    /// Required by the API.
1466    /// (Optional here so responses that omit it still parse.)
1467    #[serde(default, skip_serializing_if = "Option::is_none")]
1468    pub message: Option<String>,
1469}
1470
1471/// `UpdateMessageStatusDto` from the GoHighLevel OpenAPI spec.
1472#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1473pub struct UpdateMessageStatusDto {
1474    /// Message status
1475    /// Allowed values: `delivered`, `failed`, `pending`, `read`.
1476    /// Required by the API.
1477    pub status: String,
1478    /// Error object from the conversation provider
1479    #[serde(default, skip_serializing_if = "Option::is_none")]
1480    pub error: Option<ErrorDto>,
1481    /// Email message Id
1482    #[serde(
1483        rename = "emailMessageId",
1484        default,
1485        skip_serializing_if = "Option::is_none"
1486    )]
1487    pub email_message_id: Option<String>,
1488    /// Email delivery status for additional email recipients.
1489    #[serde(default, skip_serializing_if = "Vec::is_empty")]
1490    pub recipients: Vec<String>,
1491}
1492
1493/// Delivery status for an individual recipient of a multi-recipient email. Each entry is
1494/// keyed by the recipient's email address and tracks their specific delivery outcome
1495/// independently from the aggregate event counters.
1496#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1497pub struct UpdateRecipientMessageStatusDto {
1498    /// The recipient's email address. This is used as the key to store and update the
1499    /// per-recipient status. Must match one of the original recipients of the email.
1500    /// Required by the API.
1501    #[serde(rename = "emailId")]
1502    pub email_id: String,
1503    /// The delivery status for this specific recipient. Common values for status updates:
1504    /// `delivered` (successfully delivered), `failed` (delivery failed — provide `failReason`),
1505    /// `opened` (recipient opened the email), `clicked` (recipient clicked a link).
1506    /// Allowed values: `pending`, `scheduled`, `sent`, `delivered`, `read`, `undelivered`,
1507    /// `connected`, `failed`, `opened`, `clicked`.
1508    /// Required by the API.
1509    pub status: String,
1510    /// Human-readable reason for the delivery failure. Only applicable when `status` is
1511    /// `failed`. Examples: "Mailbox not found", "Quota exceeded", "Blocked by recipient
1512    /// server".
1513    #[serde(
1514        rename = "failReason",
1515        default,
1516        skip_serializing_if = "Option::is_none"
1517    )]
1518    pub fail_reason: Option<String>,
1519}
1520
1521/// `UploadFilesDto` from the GoHighLevel OpenAPI spec.
1522#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1523pub struct UploadFilesDto {
1524    /// Conversation Id
1525    /// Required by the API.
1526    #[serde(rename = "conversationId")]
1527    pub conversation_id: String,
1528    /// Contact Id
1529    /// Required by the API.
1530    #[serde(rename = "contactId")]
1531    pub contact_id: String,
1532    /// Location ID associated with the upload request
1533    /// Required by the API.
1534    #[serde(rename = "locationId")]
1535    pub location_id: String,
1536    /// Array of attachment URLs to upload for the conversation
1537    /// Required by the API.
1538    #[serde(
1539        rename = "attachmentUrls",
1540        default,
1541        skip_serializing_if = "Vec::is_empty"
1542    )]
1543    pub attachment_urls: Vec<String>,
1544    /// Twilio chat service SID for group SMS uploads
1545    #[serde(
1546        rename = "chatServiceSid",
1547        default,
1548        skip_serializing_if = "Option::is_none"
1549    )]
1550    pub chat_service_sid: Option<String>,
1551    /// Flag to indicate group SMS upload flow. When true, only 1 file upload is allowed per
1552    /// request.
1553    #[serde(
1554        rename = "isGroupSms",
1555        default,
1556        skip_serializing_if = "Option::is_none"
1557    )]
1558    pub is_group_sms: Option<String>,
1559}
1560
1561/// `UploadFilesErrorResponseDto` from the GoHighLevel OpenAPI spec.
1562#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1563pub struct UploadFilesErrorResponseDto {
1564    /// HTTP Status code of the request
1565    /// Allowed values: `400`, `413`, `415`.
1566    /// Required by the API.
1567    /// (Optional here so responses that omit it still parse.)
1568    #[serde(default, skip_serializing_if = "Option::is_none")]
1569    pub status: Option<String>,
1570    /// Error message of the request
1571    /// Required by the API.
1572    /// (Optional here so responses that omit it still parse.)
1573    #[serde(default, skip_serializing_if = "Option::is_none")]
1574    pub message: Option<String>,
1575}
1576
1577/// `UploadFilesResponseDto` from the GoHighLevel OpenAPI spec.
1578#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1579pub struct UploadFilesResponseDto {
1580    /// Map of uploaded file names to their accessible URLs
1581    /// Required by the API.
1582    /// (Optional here so responses that omit it still parse.)
1583    #[serde(
1584        rename = "uploadedFiles",
1585        default,
1586        skip_serializing_if = "Option::is_none"
1587    )]
1588    pub uploaded_files: Option<serde_json::Value>,
1589    /// Twilio media SIDs for group SMS (when isGroupSms=true)
1590    #[serde(
1591        rename = "twilioMediaSids",
1592        default,
1593        skip_serializing_if = "Vec::is_empty"
1594    )]
1595    pub twilio_media_sids: Vec<String>,
1596}
1597
1598/// `UserTypingBody` from the GoHighLevel OpenAPI spec.
1599#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1600pub struct UserTypingBody {
1601    /// Location Id
1602    /// Required by the API.
1603    #[serde(rename = "locationId")]
1604    pub location_id: String,
1605    /// Typing status
1606    /// Required by the API.
1607    #[serde(rename = "isTyping")]
1608    pub is_typing: String,
1609    /// Unique ID assigned to each live chat visitor.
1610    /// Required by the API.
1611    #[serde(rename = "visitorId")]
1612    pub visitor_id: String,
1613    /// Conversation Id
1614    /// Required by the API.
1615    #[serde(rename = "conversationId")]
1616    pub conversation_id: String,
1617}