-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgather_builder.go
132 lines (118 loc) · 3.96 KB
/
gather_builder.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
// Autogenerated by buildergenerator
package goexoml
import (
"errors"
)
var _ = errors.New("_")
// SetAction sets Action for Gather struct instance
func (gatherReceiver *Gather) SetAction(action string) *Gather {
gatherReceiver.Action = action
return gatherReceiver
}
// SetMethod sets Method for Gather struct instance
func (gatherReceiver *Gather) SetMethod(method string) *Gather {
gatherReceiver.Method = method
return gatherReceiver
}
// SetTimeout sets Timeout for Gather struct instance
func (gatherReceiver *Gather) SetTimeout(timeout int) *Gather {
gatherReceiver.Timeout = timeout
return gatherReceiver
}
// SetFinishOnKey sets FinishOnKey for Gather struct instance
func (gatherReceiver *Gather) SetFinishOnKey(finishonkey string) *Gather {
gatherReceiver.FinishOnKey = finishonkey
return gatherReceiver
}
// SetNumDigits sets NumDigits for Gather struct instance
func (gatherReceiver *Gather) SetNumDigits(numdigits int) *Gather {
gatherReceiver.NumDigits = numdigits
return gatherReceiver
}
// SetSay sets Say for Gather struct instance
func (gatherReceiver *Gather) SetSay(say *Say) *Gather {
gatherReceiver.Say = say
return gatherReceiver
}
// SetPlay sets Play for Gather struct instance
func (gatherReceiver *Gather) SetPlay(play *Play) *Gather {
gatherReceiver.Play = play
return gatherReceiver
}
// Setter returns setter function for the field given
func (gatherReceiver *Gather) Setter(field string) (setter func(interface{}) (*Gather, error)) {
switch field {
case "Action":
setter = func(ActionField interface{}) (*Gather, error) {
if ActionValue, ok := ActionField.(string); ok {
return gatherReceiver.SetAction(ActionValue), nil
}
return nil, errors.New("Invalid type Expected string ")
}
case "Method":
setter = func(MethodField interface{}) (*Gather, error) {
if MethodValue, ok := MethodField.(string); ok {
return gatherReceiver.SetMethod(MethodValue), nil
}
return nil, errors.New("Invalid type Expected string ")
}
case "Timeout":
setter = func(TimeoutField interface{}) (*Gather, error) {
if TimeoutValue, ok := TimeoutField.(int); ok {
return gatherReceiver.SetTimeout(TimeoutValue), nil
}
return nil, errors.New("Invalid type Expected int ")
}
case "FinishOnKey":
setter = func(FinishOnKeyField interface{}) (*Gather, error) {
if FinishOnKeyValue, ok := FinishOnKeyField.(string); ok {
return gatherReceiver.SetFinishOnKey(FinishOnKeyValue), nil
}
return nil, errors.New("Invalid type Expected string ")
}
case "NumDigits":
setter = func(NumDigitsField interface{}) (*Gather, error) {
if NumDigitsValue, ok := NumDigitsField.(int); ok {
return gatherReceiver.SetNumDigits(NumDigitsValue), nil
}
return nil, errors.New("Invalid type Expected int ")
}
case "Say":
setter = func(SayField interface{}) (*Gather, error) {
if SayValue, ok := SayField.(*Say); ok {
return gatherReceiver.SetSay(SayValue), nil
}
return nil, errors.New("Invalid type Expected *Say ")
}
case "Play":
setter = func(PlayField interface{}) (*Gather, error) {
if PlayValue, ok := PlayField.(*Play); ok {
return gatherReceiver.SetPlay(PlayValue), nil
}
return nil, errors.New("Invalid type Expected *Play ")
}
}
return
}
// NewGather return a new Gather pointer
func NewGather() *Gather {
return new(Gather)
}
// IGather The interface that satisfies all the methods for this struct
// IGather asserts implementation of setters for all the fields of Gather
type IGather interface {
SetAction(action string) *Gather
SetMethod(method string) *Gather
SetTimeout(timeout int) *Gather
SetFinishOnKey(finishonkey string) *Gather
SetNumDigits(numdigits int) *Gather
SetSay(say *Say) *Gather
SetPlay(play *Play) *Gather
Setter(string) func(interface{}) (*Gather, error)
}
// AddGather appends the verb to response
func (r *Response) AddGather(gather IGather) *Response {
r.Response = append(r.Response, gather)
return r
}