twilio_agnostic/twiml/
say.rs

1use super::{format_xml_string, Action};
2
3pub enum Voice {
4    Man,
5    Woman,
6    Alice,
7}
8
9pub struct Say {
10    pub txt: String,
11    pub voice: Voice,
12    pub language: String,
13}
14
15impl Action for Say {
16    fn as_twiml(&self) -> String {
17        let voice_str = match self.voice {
18            Voice::Man => "man",
19            Voice::Woman => "woman",
20            Voice::Alice => "alice",
21        };
22        format_xml_string(
23            "Say",
24            &vec![("voice", voice_str), ("language", &self.language)],
25            &self.txt,
26        )
27    }
28}