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