-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdial_builder.go
160 lines (144 loc) · 4.84 KB
/
dial_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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
// 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 Dial struct instance
func (dialReceiver *Dial) SetAction(action string) *Dial {
dialReceiver.Action = action
return dialReceiver
}
// SetMethod sets Method for Dial struct instance
func (dialReceiver *Dial) SetMethod(method string) *Dial {
dialReceiver.Method = method
return dialReceiver
}
// SetTimeout sets Timeout for Dial struct instance
func (dialReceiver *Dial) SetTimeout(timeout int) *Dial {
dialReceiver.Timeout = timeout
return dialReceiver
}
// SetHangupOnStar sets HangupOnStar for Dial struct instance
func (dialReceiver *Dial) SetHangupOnStar(hanguponstar bool) *Dial {
dialReceiver.HangupOnStar = hanguponstar
return dialReceiver
}
// SetTimeLimit sets TimeLimit for Dial struct instance
func (dialReceiver *Dial) SetTimeLimit(timelimit int) *Dial {
dialReceiver.TimeLimit = timelimit
return dialReceiver
}
// SetCallerID sets CallerID for Dial struct instance
func (dialReceiver *Dial) SetCallerID(callerid string) *Dial {
dialReceiver.CallerID = callerid
return dialReceiver
}
// SetRecord sets Record for Dial struct instance
func (dialReceiver *Dial) SetRecord(record bool) *Dial {
dialReceiver.Record = record
return dialReceiver
}
// SetPlainNumber sets PlainNumber for Dial struct instance
func (dialReceiver *Dial) SetPlainNumber(plainnumber string) *Dial {
dialReceiver.PlainNumber = plainnumber
return dialReceiver
}
// SetNumber sets Number for Dial struct instance
func (dialReceiver *Dial) SetNumber(number *Number) *Dial {
dialReceiver.Number = number
return dialReceiver
}
// Setter returns setter function for the field given
func (dialReceiver *Dial) Setter(field string) (setter func(interface{}) (*Dial, error)) {
switch field {
case "Action":
setter = func(ActionField interface{}) (*Dial, error) {
if ActionValue, ok := ActionField.(string); ok {
return dialReceiver.SetAction(ActionValue), nil
}
return nil, errors.New("Invalid type Expected string ")
}
case "Method":
setter = func(MethodField interface{}) (*Dial, error) {
if MethodValue, ok := MethodField.(string); ok {
return dialReceiver.SetMethod(MethodValue), nil
}
return nil, errors.New("Invalid type Expected string ")
}
case "Timeout":
setter = func(TimeoutField interface{}) (*Dial, error) {
if TimeoutValue, ok := TimeoutField.(int); ok {
return dialReceiver.SetTimeout(TimeoutValue), nil
}
return nil, errors.New("Invalid type Expected int ")
}
case "HangupOnStar":
setter = func(HangupOnStarField interface{}) (*Dial, error) {
if HangupOnStarValue, ok := HangupOnStarField.(bool); ok {
return dialReceiver.SetHangupOnStar(HangupOnStarValue), nil
}
return nil, errors.New("Invalid type Expected bool ")
}
case "TimeLimit":
setter = func(TimeLimitField interface{}) (*Dial, error) {
if TimeLimitValue, ok := TimeLimitField.(int); ok {
return dialReceiver.SetTimeLimit(TimeLimitValue), nil
}
return nil, errors.New("Invalid type Expected int ")
}
case "CallerID":
setter = func(CallerIDField interface{}) (*Dial, error) {
if CallerIDValue, ok := CallerIDField.(string); ok {
return dialReceiver.SetCallerID(CallerIDValue), nil
}
return nil, errors.New("Invalid type Expected string ")
}
case "Record":
setter = func(RecordField interface{}) (*Dial, error) {
if RecordValue, ok := RecordField.(bool); ok {
return dialReceiver.SetRecord(RecordValue), nil
}
return nil, errors.New("Invalid type Expected bool ")
}
case "PlainNumber":
setter = func(PlainNumberField interface{}) (*Dial, error) {
if PlainNumberValue, ok := PlainNumberField.(string); ok {
return dialReceiver.SetPlainNumber(PlainNumberValue), nil
}
return nil, errors.New("Invalid type Expected string ")
}
case "Number":
setter = func(NumberField interface{}) (*Dial, error) {
if NumberValue, ok := NumberField.(*Number); ok {
return dialReceiver.SetNumber(NumberValue), nil
}
return nil, errors.New("Invalid type Expected *Number ")
}
}
return
}
// NewDial return a new Dial pointer
func NewDial() *Dial {
return new(Dial)
}
// IDial The interface that satisfies all the methods for this struct
// IDial asserts implementation of setters for all the fields of Dial
type IDial interface {
SetAction(action string) *Dial
SetMethod(method string) *Dial
SetTimeout(timeout int) *Dial
SetHangupOnStar(hanguponstar bool) *Dial
SetTimeLimit(timelimit int) *Dial
SetCallerID(callerid string) *Dial
SetRecord(record bool) *Dial
SetPlainNumber(plainnumber string) *Dial
SetNumber(number *Number) *Dial
Setter(string) func(interface{}) (*Dial, error)
}
// AddDial appends the verb to response
func (r *Response) AddDial(dial IDial) *Response {
r.Response = append(r.Response, dial)
return r
}