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 */
1011use crate::models;
12use serde::{Deserialize, Serialize};
1314#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct ServerMessageSpeechUpdate {
16#[serde(rename = "phoneNumber", skip_serializing_if = "Option::is_none")]
17pub 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")]
20pub r#type: TypeTrue,
21/// This is the status of the speech update.
22#[serde(rename = "status")]
23pub status: StatusTrue,
24/// This is the role which the speech update is for.
25#[serde(rename = "role")]
26pub role: RoleTrue,
27/// This is the turn number of the speech update (0-indexed).
28#[serde(rename = "turn", skip_serializing_if = "Option::is_none")]
29pub turn: Option<f64>,
30/// This is the timestamp of the message.
31#[serde(rename = "timestamp", skip_serializing_if = "Option::is_none")]
32pub 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")]
35pub 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")]
38pub 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")]
41pub 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")]
44pub call: Option<models::Call>,
45/// This is the chat object.
46#[serde(rename = "chat", skip_serializing_if = "Option::is_none")]
47pub chat: Option<models::Chat>,
48}
4950impl ServerMessageSpeechUpdate {
51pub 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")]
71SpeechUpdate,
72}
7374impl Default for TypeTrue {
75fn default() -> TypeTrue {
76Self::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")]
83Started,
84#[serde(rename = "stopped")]
85Stopped,
86}
8788impl Default for StatusTrue {
89fn default() -> StatusTrue {
90Self::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")]
97Assistant,
98#[serde(rename = "user")]
99User,
100}
101102impl Default for RoleTrue {
103fn default() -> RoleTrue {
104Self::Assistant
105 }
106}