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    /// This is the type of the message. \"speech-update\" is sent whenever assistant or user start or stop speaking.
17    #[serde(rename = "type")]
18    pub r#type: Type,
19    /// This is the status of the speech update.
20    #[serde(rename = "status")]
21    pub status: Status,
22    /// This is the role which the speech update is for.
23    #[serde(rename = "role")]
24    pub role: Role,
25    /// This is the turn number of the speech update (0-indexed).
26    #[serde(rename = "turn", skip_serializing_if = "Option::is_none")]
27    pub turn: Option<f64>,
28}
29
30impl ClientMessageSpeechUpdate {
31    pub fn new(r#type: Type, status: Status, role: Role) -> ClientMessageSpeechUpdate {
32        ClientMessageSpeechUpdate {
33            r#type,
34            status,
35            role,
36            turn: None,
37        }
38    }
39}
40/// This is the type of the message. \"speech-update\" is sent whenever assistant or user start or stop speaking.
41#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
42pub enum Type {
43    #[serde(rename = "speech-update")]
44    SpeechUpdate,
45}
46
47impl Default for Type {
48    fn default() -> Type {
49        Self::SpeechUpdate
50    }
51}
52/// This is the status of the speech update.
53#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
54pub enum Status {
55    #[serde(rename = "started")]
56    Started,
57    #[serde(rename = "stopped")]
58    Stopped,
59}
60
61impl Default for Status {
62    fn default() -> Status {
63        Self::Started
64    }
65}
66/// This is the role which the speech update is for.
67#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
68pub enum Role {
69    #[serde(rename = "assistant")]
70    Assistant,
71    #[serde(rename = "user")]
72    User,
73}
74
75impl Default for Role {
76    fn default() -> Role {
77        Self::Assistant
78    }
79}
80