-
Notifications
You must be signed in to change notification settings - Fork 6
/
record_builder.go
160 lines (144 loc) · 5.14 KB
/
record_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 Record struct instance
func (recordReceiver *Record) SetAction(action string) *Record {
recordReceiver.Action = action
return recordReceiver
}
// SetMethod sets Method for Record struct instance
func (recordReceiver *Record) SetMethod(method string) *Record {
recordReceiver.Method = method
return recordReceiver
}
// SetTimeout sets Timeout for Record struct instance
func (recordReceiver *Record) SetTimeout(timeout int) *Record {
recordReceiver.Timeout = timeout
return recordReceiver
}
// SetFinishOnKey sets FinishOnKey for Record struct instance
func (recordReceiver *Record) SetFinishOnKey(finishonkey string) *Record {
recordReceiver.FinishOnKey = finishonkey
return recordReceiver
}
// SetMaxLength sets MaxLength for Record struct instance
func (recordReceiver *Record) SetMaxLength(maxlength int) *Record {
recordReceiver.MaxLength = maxlength
return recordReceiver
}
// SetTranscribe sets Transcribe for Record struct instance
func (recordReceiver *Record) SetTranscribe(transcribe bool) *Record {
recordReceiver.Transcribe = transcribe
return recordReceiver
}
// SetTranscribeCallback sets TranscribeCallback for Record struct instance
func (recordReceiver *Record) SetTranscribeCallback(transcribecallback string) *Record {
recordReceiver.TranscribeCallback = transcribecallback
return recordReceiver
}
// SetPlayBeep sets PlayBeep for Record struct instance
func (recordReceiver *Record) SetPlayBeep(playbeep bool) *Record {
recordReceiver.PlayBeep = playbeep
return recordReceiver
}
// SetTrim sets Trim for Record struct instance
func (recordReceiver *Record) SetTrim(trim string) *Record {
recordReceiver.Trim = trim
return recordReceiver
}
// Setter returns setter function for the field given
func (recordReceiver *Record) Setter(field string) (setter func(interface{}) (*Record, error)) {
switch field {
case "Action":
setter = func(ActionField interface{}) (*Record, error) {
if ActionValue, ok := ActionField.(string); ok {
return recordReceiver.SetAction(ActionValue), nil
}
return nil, errors.New("Invalid type Expected string ")
}
case "Method":
setter = func(MethodField interface{}) (*Record, error) {
if MethodValue, ok := MethodField.(string); ok {
return recordReceiver.SetMethod(MethodValue), nil
}
return nil, errors.New("Invalid type Expected string ")
}
case "Timeout":
setter = func(TimeoutField interface{}) (*Record, error) {
if TimeoutValue, ok := TimeoutField.(int); ok {
return recordReceiver.SetTimeout(TimeoutValue), nil
}
return nil, errors.New("Invalid type Expected int ")
}
case "FinishOnKey":
setter = func(FinishOnKeyField interface{}) (*Record, error) {
if FinishOnKeyValue, ok := FinishOnKeyField.(string); ok {
return recordReceiver.SetFinishOnKey(FinishOnKeyValue), nil
}
return nil, errors.New("Invalid type Expected string ")
}
case "MaxLength":
setter = func(MaxLengthField interface{}) (*Record, error) {
if MaxLengthValue, ok := MaxLengthField.(int); ok {
return recordReceiver.SetMaxLength(MaxLengthValue), nil
}
return nil, errors.New("Invalid type Expected int ")
}
case "Transcribe":
setter = func(TranscribeField interface{}) (*Record, error) {
if TranscribeValue, ok := TranscribeField.(bool); ok {
return recordReceiver.SetTranscribe(TranscribeValue), nil
}
return nil, errors.New("Invalid type Expected bool ")
}
case "TranscribeCallback":
setter = func(TranscribeCallbackField interface{}) (*Record, error) {
if TranscribeCallbackValue, ok := TranscribeCallbackField.(string); ok {
return recordReceiver.SetTranscribeCallback(TranscribeCallbackValue), nil
}
return nil, errors.New("Invalid type Expected string ")
}
case "PlayBeep":
setter = func(PlayBeepField interface{}) (*Record, error) {
if PlayBeepValue, ok := PlayBeepField.(bool); ok {
return recordReceiver.SetPlayBeep(PlayBeepValue), nil
}
return nil, errors.New("Invalid type Expected bool ")
}
case "Trim":
setter = func(TrimField interface{}) (*Record, error) {
if TrimValue, ok := TrimField.(string); ok {
return recordReceiver.SetTrim(TrimValue), nil
}
return nil, errors.New("Invalid type Expected string ")
}
}
return
}
// NewRecord return a new Record pointer
func NewRecord() *Record {
return new(Record)
}
// IRecord The interface that satisfies all the methods for this struct
// IRecord asserts implementation of setters for all the fields of Record
type IRecord interface {
SetAction(action string) *Record
SetMethod(method string) *Record
SetTimeout(timeout int) *Record
SetFinishOnKey(finishonkey string) *Record
SetMaxLength(maxlength int) *Record
SetTranscribe(transcribe bool) *Record
SetTranscribeCallback(transcribecallback string) *Record
SetPlayBeep(playbeep bool) *Record
SetTrim(trim string) *Record
Setter(string) func(interface{}) (*Record, error)
}
// AddRecord appends the verb to response
func (r *Response) AddRecord(record IRecord) *Response {
r.Response = append(r.Response, record)
return r
}