vapi_client/models/
server_message_conversation_update.rs

1/*
2 * Vapi API
3 *
4 * API for building voice assistants
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12
13use crate::models;
14
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct ServerMessageConversationUpdate {
17    #[serde(rename = "phoneNumber", skip_serializing_if = "Option::is_none")]
18    pub phone_number: Option<models::ServerMessageAssistantRequestPhoneNumber>,
19    /// This is the type of the message. \"conversation-update\" is sent when an update is committed to the conversation history.
20    #[serde(rename = "type")]
21    pub r#type: Type,
22    /// This is the most up-to-date conversation history at the time the message is sent.
23    #[serde(rename = "messages", skip_serializing_if = "Option::is_none")]
24    pub messages: Option<Vec<models::ArtifactMessagesInner>>,
25    /// This is the most up-to-date conversation history at the time the message is sent, formatted for OpenAI.
26    #[serde(rename = "messagesOpenAIFormatted")]
27    pub messages_open_ai_formatted: Vec<models::OpenAiMessage>,
28    /// This is the ISO-8601 formatted timestamp of when the message was sent.
29    #[serde(rename = "timestamp", skip_serializing_if = "Option::is_none")]
30    pub timestamp: Option<f64>,
31    /// This is a live version of the `call.artifact`.  This matches what is stored on `call.artifact` after the call.
32    #[serde(rename = "artifact", skip_serializing_if = "Option::is_none")]
33    pub artifact: Option<models::Artifact>,
34    /// This is the assistant that is currently active. This is provided for convenience.  This matches one of the following: - `call.assistant`, - `call.assistantId`, - `call.squad[n].assistant`, - `call.squad[n].assistantId`, - `call.squadId->[n].assistant`, - `call.squadId->[n].assistantId`.
35    #[serde(rename = "assistant", skip_serializing_if = "Option::is_none")]
36    pub assistant: Option<models::CreateAssistantDto>,
37    /// This is the customer associated with the call.  This matches one of the following: - `call.customer`, - `call.customerId`.
38    #[serde(rename = "customer", skip_serializing_if = "Option::is_none")]
39    pub customer: Option<models::CreateCustomerDto>,
40    /// This is the call object.  This matches what was returned in POST /call.  Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.
41    #[serde(rename = "call", skip_serializing_if = "Option::is_none")]
42    pub call: Option<models::Call>,
43}
44
45impl ServerMessageConversationUpdate {
46    pub fn new(
47        r#type: Type,
48        messages_open_ai_formatted: Vec<models::OpenAiMessage>,
49    ) -> ServerMessageConversationUpdate {
50        ServerMessageConversationUpdate {
51            phone_number: None,
52            r#type,
53            messages: None,
54            messages_open_ai_formatted,
55            timestamp: None,
56            artifact: None,
57            assistant: None,
58            customer: None,
59            call: None,
60        }
61    }
62}
63/// This is the type of the message. \"conversation-update\" is sent when an update is committed to the conversation history.
64#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
65pub enum Type {
66    #[serde(rename = "conversation-update")]
67    ConversationUpdate,
68}
69
70impl Default for Type {
71    fn default() -> Type {
72        Self::ConversationUpdate
73    }
74}