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