vapi_client/models/
client_message_transcript.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 ClientMessageTranscript {
17    /// This is the type of the message. \"transcript\" is sent as transcriber outputs partial or final transcript.
18    #[serde(rename = "type")]
19    pub r#type: Type,
20    /// This is the role for which the transcript is for.
21    #[serde(rename = "role")]
22    pub role: Role,
23    /// This is the type of the transcript.
24    #[serde(rename = "transcriptType")]
25    pub transcript_type: TranscriptType,
26    /// This is the transcript content.
27    #[serde(rename = "transcript")]
28    pub transcript: String,
29}
30
31impl ClientMessageTranscript {
32    pub fn new(
33        r#type: Type,
34        role: Role,
35        transcript_type: TranscriptType,
36        transcript: String,
37    ) -> ClientMessageTranscript {
38        ClientMessageTranscript {
39            r#type,
40            role,
41            transcript_type,
42            transcript,
43        }
44    }
45}
46/// This is the type of the message. \"transcript\" is sent as transcriber outputs partial or final transcript.
47#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
48pub enum Type {
49    #[serde(rename = "transcript")]
50    Transcript,
51    #[serde(rename = "transcript[transcriptType=\"final\"]")]
52    TranscriptLeftSquareBracketTranscriptTypeEqualDoubleQuoteFinalDoubleQuoteRightSquareBracket,
53}
54
55impl Default for Type {
56    fn default() -> Type {
57        Self::Transcript
58    }
59}
60/// This is the role for which the transcript is for.
61#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
62pub enum Role {
63    #[serde(rename = "assistant")]
64    Assistant,
65    #[serde(rename = "user")]
66    User,
67}
68
69impl Default for Role {
70    fn default() -> Role {
71        Self::Assistant
72    }
73}
74/// This is the type of the transcript.
75#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
76pub enum TranscriptType {
77    #[serde(rename = "partial")]
78    Partial,
79    #[serde(rename = "final")]
80    Final,
81}
82
83impl Default for TranscriptType {
84    fn default() -> TranscriptType {
85        Self::Partial
86    }
87}