-
Notifications
You must be signed in to change notification settings - Fork 6
/
number_builder.go
132 lines (118 loc) · 4.4 KB
/
number_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("_")
// SetSendDigits sets SendDigits for Number struct instance
func (numberReceiver *Number) SetSendDigits(senddigits string) *Number {
numberReceiver.SendDigits = senddigits
return numberReceiver
}
// SetURL sets URL for Number struct instance
func (numberReceiver *Number) SetURL(url string) *Number {
numberReceiver.URL = url
return numberReceiver
}
// SetMethod sets Method for Number struct instance
func (numberReceiver *Number) SetMethod(method string) *Number {
numberReceiver.Method = method
return numberReceiver
}
// SetStatusCallbackEvent sets StatusCallbackEvent for Number struct instance
func (numberReceiver *Number) SetStatusCallbackEvent(statuscallbackevent string) *Number {
numberReceiver.StatusCallbackEvent = statuscallbackevent
return numberReceiver
}
// SetStatusCallback sets StatusCallback for Number struct instance
func (numberReceiver *Number) SetStatusCallback(statuscallback string) *Number {
numberReceiver.StatusCallback = statuscallback
return numberReceiver
}
// SetStatusCallbackMethod sets StatusCallbackMethod for Number struct instance
func (numberReceiver *Number) SetStatusCallbackMethod(statuscallbackmethod string) *Number {
numberReceiver.StatusCallbackMethod = statuscallbackmethod
return numberReceiver
}
// SetNoun sets Noun for Number struct instance
func (numberReceiver *Number) SetNoun(noun string) *Number {
numberReceiver.Noun = noun
return numberReceiver
}
// Setter returns setter function for the field given
func (numberReceiver *Number) Setter(field string) (setter func(interface{}) (*Number, error)) {
switch field {
case "SendDigits":
setter = func(SendDigitsField interface{}) (*Number, error) {
if SendDigitsValue, ok := SendDigitsField.(string); ok {
return numberReceiver.SetSendDigits(SendDigitsValue), nil
}
return nil, errors.New("Invalid type Expected string ")
}
case "URL":
setter = func(URLField interface{}) (*Number, error) {
if URLValue, ok := URLField.(string); ok {
return numberReceiver.SetURL(URLValue), nil
}
return nil, errors.New("Invalid type Expected string ")
}
case "Method":
setter = func(MethodField interface{}) (*Number, error) {
if MethodValue, ok := MethodField.(string); ok {
return numberReceiver.SetMethod(MethodValue), nil
}
return nil, errors.New("Invalid type Expected string ")
}
case "StatusCallbackEvent":
setter = func(StatusCallbackEventField interface{}) (*Number, error) {
if StatusCallbackEventValue, ok := StatusCallbackEventField.(string); ok {
return numberReceiver.SetStatusCallbackEvent(StatusCallbackEventValue), nil
}
return nil, errors.New("Invalid type Expected string ")
}
case "StatusCallback":
setter = func(StatusCallbackField interface{}) (*Number, error) {
if StatusCallbackValue, ok := StatusCallbackField.(string); ok {
return numberReceiver.SetStatusCallback(StatusCallbackValue), nil
}
return nil, errors.New("Invalid type Expected string ")
}
case "StatusCallbackMethod":
setter = func(StatusCallbackMethodField interface{}) (*Number, error) {
if StatusCallbackMethodValue, ok := StatusCallbackMethodField.(string); ok {
return numberReceiver.SetStatusCallbackMethod(StatusCallbackMethodValue), nil
}
return nil, errors.New("Invalid type Expected string ")
}
case "Noun":
setter = func(NounField interface{}) (*Number, error) {
if NounValue, ok := NounField.(string); ok {
return numberReceiver.SetNoun(NounValue), nil
}
return nil, errors.New("Invalid type Expected string ")
}
}
return
}
// NewNumber return a new Number pointer
func NewNumber() *Number {
return new(Number)
}
// INumber The interface that satisfies all the methods for this struct
// INumber asserts implementation of setters for all the fields of Number
type INumber interface {
SetSendDigits(senddigits string) *Number
SetURL(url string) *Number
SetMethod(method string) *Number
SetStatusCallbackEvent(statuscallbackevent string) *Number
SetStatusCallback(statuscallback string) *Number
SetStatusCallbackMethod(statuscallbackmethod string) *Number
SetNoun(noun string) *Number
Setter(string) func(interface{}) (*Number, error)
}
// AddNumber appends the verb to response
func (r *Response) AddNumber(number INumber) *Response {
r.Response = append(r.Response, number)
return r
}