vapi_client/models/
client_message_conversation_update.rs

1/*
2 * Vapi API
3 *
4 * Voice AI for developers.
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct ClientMessageConversationUpdate {
16    #[serde(rename = "phoneNumber", skip_serializing_if = "Option::is_none")]
17    pub phone_number: Option<models::ClientMessageWorkflowNodeStartedPhoneNumber>,
18    /// This is the type of the message. \"conversation-update\" is sent when an update is committed to the conversation history.
19    #[serde(rename = "type")]
20    pub r#type: TypeTrue,
21    /// This is the most up-to-date conversation history at the time the message is sent.
22    #[serde(rename = "messages", skip_serializing_if = "Option::is_none")]
23    pub messages: Option<Vec<models::ArtifactMessagesInner>>,
24    /// This is the most up-to-date conversation history at the time the message is sent, formatted for OpenAI.
25    #[serde(rename = "messagesOpenAIFormatted")]
26    pub messages_open_ai_formatted: Vec<models::OpenAiMessage>,
27    /// This is the timestamp of the message.
28    #[serde(rename = "timestamp", skip_serializing_if = "Option::is_none")]
29    pub timestamp: Option<f64>,
30    /// This is the call that the message is associated with.
31    #[serde(rename = "call", skip_serializing_if = "Option::is_none")]
32    pub call: Option<models::Call>,
33    /// This is the customer that the message is associated with.
34    #[serde(rename = "customer", skip_serializing_if = "Option::is_none")]
35    pub customer: Option<models::CreateCustomerDto>,
36    /// This is the assistant that the message is associated with.
37    #[serde(rename = "assistant", skip_serializing_if = "Option::is_none")]
38    pub assistant: Option<models::CreateAssistantDto>,
39}
40
41impl ClientMessageConversationUpdate {
42    pub fn new(
43        r#type: TypeTrue,
44        messages_open_ai_formatted: Vec<models::OpenAiMessage>,
45    ) -> ClientMessageConversationUpdate {
46        ClientMessageConversationUpdate {
47            phone_number: None,
48            r#type,
49            messages: None,
50            messages_open_ai_formatted,
51            timestamp: None,
52            call: None,
53            customer: None,
54            assistant: None,
55        }
56    }
57}
58/// This is the type of the message. \"conversation-update\" is sent when an update is committed to the conversation history.
59#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
60pub enum TypeTrue {
61    #[serde(rename = "conversation-update")]
62    ConversationUpdate,
63}
64
65impl Default for TypeTrue {
66    fn default() -> TypeTrue {
67        Self::ConversationUpdate
68    }
69}