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