vapi-client 0.4.2

Unofficial crate for Vapi - Voice AI for developers.
Documentation
/*
 * Vapi API
 *
 * Voice AI for developers.
 *
 * The version of the OpenAPI document: 1.0
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ClientMessageSpeechUpdate {
    #[serde(rename = "phoneNumber", skip_serializing_if = "Option::is_none")]
    pub phone_number: Option<models::ClientMessageWorkflowNodeStartedPhoneNumber>,
    /// This is the type of the message. \"speech-update\" is sent whenever assistant or user start or stop speaking.
    #[serde(rename = "type")]
    pub r#type: TypeTrue,
    /// This is the status of the speech update.
    #[serde(rename = "status")]
    pub status: StatusTrue,
    /// This is the role which the speech update is for.
    #[serde(rename = "role")]
    pub role: RoleTrue,
    /// This is the turn number of the speech update (0-indexed).
    #[serde(rename = "turn", skip_serializing_if = "Option::is_none")]
    pub turn: Option<f64>,
    /// This is the timestamp of the message.
    #[serde(rename = "timestamp", skip_serializing_if = "Option::is_none")]
    pub timestamp: Option<f64>,
    /// This is the call that the message is associated with.
    #[serde(rename = "call", skip_serializing_if = "Option::is_none")]
    pub call: Option<models::Call>,
    /// This is the customer that the message is associated with.
    #[serde(rename = "customer", skip_serializing_if = "Option::is_none")]
    pub customer: Option<models::CreateCustomerDto>,
    /// This is the assistant that the message is associated with.
    #[serde(rename = "assistant", skip_serializing_if = "Option::is_none")]
    pub assistant: Option<models::CreateAssistantDto>,
}

impl ClientMessageSpeechUpdate {
    pub fn new(r#type: TypeTrue, status: StatusTrue, role: RoleTrue) -> ClientMessageSpeechUpdate {
        ClientMessageSpeechUpdate {
            phone_number: None,
            r#type,
            status,
            role,
            turn: None,
            timestamp: None,
            call: None,
            customer: None,
            assistant: None,
        }
    }
}
/// This is the type of the message. \"speech-update\" is sent whenever assistant or user start or stop speaking.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum TypeTrue {
    #[serde(rename = "speech-update")]
    SpeechUpdate,
}

impl Default for TypeTrue {
    fn default() -> TypeTrue {
        Self::SpeechUpdate
    }
}
/// This is the status of the speech update.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum StatusTrue {
    #[serde(rename = "started")]
    Started,
    #[serde(rename = "stopped")]
    Stopped,
}

impl Default for StatusTrue {
    fn default() -> StatusTrue {
        Self::Started
    }
}
/// This is the role which the speech update is for.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum RoleTrue {
    #[serde(rename = "assistant")]
    Assistant,
    #[serde(rename = "user")]
    User,
}

impl Default for RoleTrue {
    fn default() -> RoleTrue {
        Self::Assistant
    }
}