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