vapi_client/models/
user_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};
12
13use crate::models;
14
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct UserMessage {
17    /// The role of the user in the conversation.
18    #[serde(rename = "role")]
19    pub role: String,
20    /// The message content from the user.
21    #[serde(rename = "message")]
22    pub message: String,
23    /// The timestamp when the message was sent.
24    #[serde(rename = "time")]
25    pub time: f64,
26    /// The timestamp when the message ended.
27    #[serde(rename = "endTime")]
28    pub end_time: f64,
29    /// The number of seconds from the start of the conversation.
30    #[serde(rename = "secondsFromStart")]
31    pub seconds_from_start: f64,
32    /// The duration of the message in seconds.
33    #[serde(rename = "duration", skip_serializing_if = "Option::is_none")]
34    pub duration: Option<f64>,
35}
36
37impl UserMessage {
38    pub fn new(
39        role: String,
40        message: String,
41        time: f64,
42        end_time: f64,
43        seconds_from_start: f64,
44    ) -> UserMessage {
45        UserMessage {
46            role,
47            message,
48            time,
49            end_time,
50            seconds_from_start,
51            duration: None,
52        }
53    }
54}