vapi_client/models/
bot_message.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 BotMessage {
16    /// The role of the bot in the conversation.
17    #[serde(rename = "role")]
18    pub role: String,
19    /// The message content from the bot.
20    #[serde(rename = "message")]
21    pub message: String,
22    /// The timestamp when the message was sent.
23    #[serde(rename = "time")]
24    pub time: f64,
25    /// The timestamp when the message ended.
26    #[serde(rename = "endTime")]
27    pub end_time: f64,
28    /// The number of seconds from the start of the conversation.
29    #[serde(rename = "secondsFromStart")]
30    pub seconds_from_start: f64,
31    /// The source of the message.
32    #[serde(rename = "source", skip_serializing_if = "Option::is_none")]
33    pub source: Option<String>,
34    /// The duration of the message in seconds.
35    #[serde(rename = "duration", skip_serializing_if = "Option::is_none")]
36    pub duration: Option<f64>,
37}
38
39impl BotMessage {
40    pub fn new(role: String, message: String, time: f64, end_time: f64, seconds_from_start: f64) -> BotMessage {
41        BotMessage {
42            role,
43            message,
44            time,
45            end_time,
46            seconds_from_start,
47            source: None,
48            duration: None,
49        }
50    }
51}
52