/
prompt.go
49 lines (39 loc) · 977 Bytes
/
prompt.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package verbs
import (
"encoding/xml"
)
type PromptAttributes struct {
Attempt *int `xml:"attempt,attr,omitempty"`
CardType *string `xml:"cardType,attr,omitempty"`
ErrorType *string `xml:"errorType,attr,omitempty"`
For *string `xml:"for,attr,omitempty"`
}
type Prompt struct {
XMLName xml.Name `xml:"Prompt"`
*PromptAttributes
Children []interface{}
}
func (p *Prompt) Pause() {
p.Children = append(p.Children, &Pause{})
}
func (p *Prompt) PauseWithAttributes(attributes PauseAttributes) {
p.Children = append(p.Children, &Pause{
PauseAttributes: &attributes,
})
}
func (p *Prompt) Play(url *string) {
p.Children = append(p.Children, &Play{
Text: url,
})
}
func (p *Prompt) Say(message string) {
p.Children = append(p.Children, &Say{
Text: message,
})
}
func (p *Prompt) SayWithAttributes(attributes SayAttributes, message string) {
p.Children = append(p.Children, &Say{
Text: message,
SayAttributes: &attributes,
})
}