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};
12use utoipa::ToSchema;
13
14
15use crate::models;
16
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, ToSchema)]
18pub struct ServerMessageConversationUpdate {
19    #[serde(rename = "phoneNumber", skip_serializing_if = "Option::is_none")]
20    pub phone_number: Option<models::ServerMessageAssistantRequestPhoneNumber>,
21    /// This is the type of the message. \"conversation-update\" is sent when an update is committed to the conversation history.
22    #[serde(rename = "type")]
23    pub r#type: Type,
24    /// This is the most up-to-date conversation history at the time the message is sent.
25    #[serde(rename = "messages", skip_serializing_if = "Option::is_none")]
26    pub messages: Option<Vec<models::ArtifactMessagesInner>>,
27    /// This is the most up-to-date conversation history at the time the message is sent, formatted for OpenAI.
28    #[serde(rename = "messagesOpenAIFormatted")]
29    pub messages_open_ai_formatted: Vec<models::OpenAiMessage>,
30    /// This is the ISO-8601 formatted timestamp of when the message was sent.
31    #[serde(rename = "timestamp", skip_serializing_if = "Option::is_none")]
32    pub timestamp: Option<f64>,
33    /// This is a live version of the `call.artifact`.  This matches what is stored on `call.artifact` after the call.
34    #[serde(rename = "artifact", skip_serializing_if = "Option::is_none")]
35    pub artifact: Option<models::Artifact>,
36    /// 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`.
37    #[serde(rename = "assistant", skip_serializing_if = "Option::is_none")]
38    pub assistant: Option<models::CreateAssistantDto>,
39    /// This is the customer associated with the call.  This matches one of the following: - `call.customer`, - `call.customerId`.
40    #[serde(rename = "customer", skip_serializing_if = "Option::is_none")]
41    pub customer: Option<models::CreateCustomerDto>,
42    /// 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.
43    #[serde(rename = "call", skip_serializing_if = "Option::is_none")]
44    pub call: Option<models::Call>,
45}
46
47impl ServerMessageConversationUpdate {
48    pub fn new(
49        r#type: Type,
50        messages_open_ai_formatted: Vec<models::OpenAiMessage>,
51    ) -> ServerMessageConversationUpdate {
52        ServerMessageConversationUpdate {
53            phone_number: None,
54            r#type,
55            messages: None,
56            messages_open_ai_formatted,
57            timestamp: None,
58            artifact: None,
59            assistant: None,
60            customer: None,
61            call: None,
62        }
63    }
64}
65/// This is the type of the message. \"conversation-update\" is sent when an update is committed to the conversation history.
66#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
67pub enum Type {
68    #[serde(rename = "conversation-update")]
69    ConversationUpdate,
70}
71
72impl Default for Type {
73    fn default() -> Type {
74        Self::ConversationUpdate
75    }
76}