Skip to main content

ghl_models/v3/
conversations.rs

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