vapi_client/models/
server_message_speech_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 ServerMessageSpeechUpdate {
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. \"speech-update\" is sent whenever assistant or user start or stop speaking.
19    #[serde(rename = "type")]
20    pub r#type: TypeTrue,
21    /// This is the status of the speech update.
22    #[serde(rename = "status")]
23    pub status: StatusTrue,
24    /// This is the role which the speech update is for.
25    #[serde(rename = "role")]
26    pub role: RoleTrue,
27    /// This is the turn number of the speech update (0-indexed).
28    #[serde(rename = "turn", skip_serializing_if = "Option::is_none")]
29    pub turn: Option<f64>,
30    /// This is the timestamp of the message.
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 the message is associated with.
37    #[serde(rename = "assistant", skip_serializing_if = "Option::is_none")]
38    pub assistant: Option<models::CreateAssistantDto>,
39    /// This is the customer that the message is associated with.
40    #[serde(rename = "customer", skip_serializing_if = "Option::is_none")]
41    pub customer: Option<models::CreateCustomerDto>,
42    /// This is the call that the message is associated with.
43    #[serde(rename = "call", skip_serializing_if = "Option::is_none")]
44    pub call: Option<models::Call>,
45    /// This is the chat object.
46    #[serde(rename = "chat", skip_serializing_if = "Option::is_none")]
47    pub chat: Option<models::Chat>,
48}
49
50impl ServerMessageSpeechUpdate {
51    pub fn new(r#type: TypeTrue, status: StatusTrue, role: RoleTrue) -> ServerMessageSpeechUpdate {
52        ServerMessageSpeechUpdate {
53            phone_number: None,
54            r#type,
55            status,
56            role,
57            turn: None,
58            timestamp: None,
59            artifact: None,
60            assistant: None,
61            customer: None,
62            call: None,
63            chat: None,
64        }
65    }
66}
67/// This is the type of the message. \"speech-update\" is sent whenever assistant or user start or stop speaking.
68#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
69pub enum TypeTrue {
70    #[serde(rename = "speech-update")]
71    SpeechUpdate,
72}
73
74impl Default for TypeTrue {
75    fn default() -> TypeTrue {
76        Self::SpeechUpdate
77    }
78}
79/// This is the status of the speech update.
80#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
81pub enum StatusTrue {
82    #[serde(rename = "started")]
83    Started,
84    #[serde(rename = "stopped")]
85    Stopped,
86}
87
88impl Default for StatusTrue {
89    fn default() -> StatusTrue {
90        Self::Started
91    }
92}
93/// This is the role which the speech update is for.
94#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
95pub enum RoleTrue {
96    #[serde(rename = "assistant")]
97    Assistant,
98    #[serde(rename = "user")]
99    User,
100}
101
102impl Default for RoleTrue {
103    fn default() -> RoleTrue {
104        Self::Assistant
105    }
106}