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