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::ServerMessageAssistantRequestPhoneNumber>,
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: Type,
21    /// This is the timestamp of when the message was sent in milliseconds since Unix Epoch.
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 is currently active. This is provided for convenience.  This matches one of the following: - `call.assistant`, - `call.assistantId`, - `call.squad[n].assistant`, - `call.squad[n].assistantId`, - `call.squadId->[n].assistant`, - `call.squadId->[n].assistantId`.
28    #[serde(rename = "assistant", skip_serializing_if = "Option::is_none")]
29    pub assistant: Option<models::CreateAssistantDto>,
30    /// This is the customer associated with the call.  This matches one of the following: - `call.customer`, - `call.customerId`.
31    #[serde(rename = "customer", skip_serializing_if = "Option::is_none")]
32    pub customer: Option<models::CreateCustomerDto>,
33    /// This is the call object.  This matches what was returned in POST /call.  Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.
34    #[serde(rename = "call", skip_serializing_if = "Option::is_none")]
35    pub call: Option<models::Call>,
36    /// This is the role for which the transcript is for.
37    #[serde(rename = "role")]
38    pub role: Role,
39    /// This is the type of the transcript.
40    #[serde(rename = "transcriptType")]
41    pub transcript_type: TranscriptType,
42    /// This is the transcript content.
43    #[serde(rename = "transcript")]
44    pub transcript: String,
45}
46
47impl ServerMessageTranscript {
48    pub fn new(r#type: Type, role: Role, transcript_type: TranscriptType, transcript: String) -> ServerMessageTranscript {
49        ServerMessageTranscript {
50            phone_number: None,
51            r#type,
52            timestamp: None,
53            artifact: None,
54            assistant: None,
55            customer: None,
56            call: None,
57            role,
58            transcript_type,
59            transcript,
60        }
61    }
62}
63/// This is the type of the message. \"transcript\" is sent as transcriber outputs partial or final transcript.
64#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
65pub enum Type {
66    #[serde(rename = "transcript")]
67    Transcript,
68    #[serde(rename = "transcript[transcriptType=\"final\"]")]
69    TranscriptLeftSquareBracketTranscriptTypeEqualDoubleQuoteFinalDoubleQuoteRightSquareBracket,
70}
71
72impl Default for Type {
73    fn default() -> Type {
74        Self::Transcript
75    }
76}
77/// This is the role for which the transcript is for.
78#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
79pub enum Role {
80    #[serde(rename = "assistant")]
81    Assistant,
82    #[serde(rename = "user")]
83    User,
84}
85
86impl Default for Role {
87    fn default() -> Role {
88        Self::Assistant
89    }
90}
91/// This is the type of the transcript.
92#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
93pub enum TranscriptType {
94    #[serde(rename = "partial")]
95    Partial,
96    #[serde(rename = "final")]
97    Final,
98}
99
100impl Default for TranscriptType {
101    fn default() -> TranscriptType {
102        Self::Partial
103    }
104}
105