vapi_client/models/
server_message_transcript.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 ServerMessageTranscript {
16    #[serde(rename = "phoneNumber", skip_serializing_if = "Option::is_none")]
17    pub phone_number: Option<models::ClientMessageWorkflowNodeStartedPhoneNumber>,
18    /// This is the type of the message. \"transcript\" is sent as transcriber outputs partial or final transcript.
19    #[serde(rename = "type")]
20    pub r#type: TypeTrue,
21    /// This is the timestamp of the message.
22    #[serde(rename = "timestamp", skip_serializing_if = "Option::is_none")]
23    pub timestamp: Option<f64>,
24    /// This is a live version of the `call.artifact`.  This matches what is stored on `call.artifact` after the call.
25    #[serde(rename = "artifact", skip_serializing_if = "Option::is_none")]
26    pub artifact: Option<models::Artifact>,
27    /// This is the assistant that the message is associated with.
28    #[serde(rename = "assistant", skip_serializing_if = "Option::is_none")]
29    pub assistant: Option<models::CreateAssistantDto>,
30    /// This is the customer that the message is associated with.
31    #[serde(rename = "customer", skip_serializing_if = "Option::is_none")]
32    pub customer: Option<models::CreateCustomerDto>,
33    /// This is the call that the message is associated with.
34    #[serde(rename = "call", skip_serializing_if = "Option::is_none")]
35    pub call: Option<models::Call>,
36    /// This is the chat object.
37    #[serde(rename = "chat", skip_serializing_if = "Option::is_none")]
38    pub chat: Option<models::Chat>,
39    /// This is the role for which the transcript is for.
40    #[serde(rename = "role")]
41    pub role: RoleTrue,
42    /// This is the type of the transcript.
43    #[serde(rename = "transcriptType")]
44    pub transcript_type: TranscriptTypeTrue,
45    /// This is the transcript content.
46    #[serde(rename = "transcript")]
47    pub transcript: String,
48}
49
50impl ServerMessageTranscript {
51    pub fn new(
52        r#type: TypeTrue,
53        role: RoleTrue,
54        transcript_type: TranscriptTypeTrue,
55        transcript: String,
56    ) -> ServerMessageTranscript {
57        ServerMessageTranscript {
58            phone_number: None,
59            r#type,
60            timestamp: None,
61            artifact: None,
62            assistant: None,
63            customer: None,
64            call: None,
65            chat: None,
66            role,
67            transcript_type,
68            transcript,
69        }
70    }
71}
72/// This is the type of the message. \"transcript\" is sent as transcriber outputs partial or final transcript.
73#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
74pub enum TypeTrue {
75    #[serde(rename = "transcript")]
76    Transcript,
77    #[serde(rename = "transcript[transcriptType=\"final\"]")]
78    TranscriptLeftSquareBracketTranscriptTypeEqualDoubleQuoteFinalDoubleQuoteRightSquareBracket,
79}
80
81impl Default for TypeTrue {
82    fn default() -> TypeTrue {
83        Self::Transcript
84    }
85}
86/// This is the role for which the transcript is for.
87#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
88pub enum RoleTrue {
89    #[serde(rename = "assistant")]
90    Assistant,
91    #[serde(rename = "user")]
92    User,
93}
94
95impl Default for RoleTrue {
96    fn default() -> RoleTrue {
97        Self::Assistant
98    }
99}
100/// This is the type of the transcript.
101#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
102pub enum TranscriptTypeTrue {
103    #[serde(rename = "partial")]
104    Partial,
105    #[serde(rename = "final")]
106    Final,
107}
108
109impl Default for TranscriptTypeTrue {
110    fn default() -> TranscriptTypeTrue {
111        Self::Partial
112    }
113}