-
Notifications
You must be signed in to change notification settings - Fork 1
/
menu.go
199 lines (174 loc) · 4.35 KB
/
menu.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
package brewerydb
// MenuService provides access to the BreweryDB Menu API.
// Use Client.Menu.
type MenuService struct {
c *Client
}
// Styles provides a listing of all Beer Styles.
func (ms *MenuService) Styles() ([]Style, error) {
req, err := ms.c.NewRequest("GET", "/menu/styles", nil)
if err != nil {
return nil, err
}
res := struct {
Status string
Data []Style
Message string
}{}
err = ms.c.Do(req, &res)
return res.Data, err
}
// Categories provides a listing of all Beer Categories.
func (ms *MenuService) Categories() ([]Category, error) {
req, err := ms.c.NewRequest("GET", "/menu/categories", nil)
if err != nil {
return nil, err
}
res := struct {
Status string
Data []Category
Message string
}{}
err = ms.c.Do(req, &res)
return res.Data, err
}
// Glassware provides a listing of all Beer Glasses.
func (ms *MenuService) Glassware() ([]Glass, error) {
req, err := ms.c.NewRequest("GET", "/menu/glassware", nil)
if err != nil {
return nil, err
}
res := struct {
Status string
Data []Glass
Message string
}{}
err = ms.c.Do(req, &res)
return res.Data, err
}
// SRM provides a listing of all SRMs.
func (ms *MenuService) SRM() ([]SRM, error) {
req, err := ms.c.NewRequest("GET", "/menu/srm", nil)
if err != nil {
return nil, err
}
res := struct {
Status string
Data []SRM
Message string
}{}
err = ms.c.Do(req, &res)
return res.Data, err
}
// BeerAvailability provides a listing of all possible Availability states.
func (ms *MenuService) BeerAvailability() ([]Availability, error) {
req, err := ms.c.NewRequest("GET", "/menu/beer-availability", nil)
if err != nil {
return nil, err
}
resp := struct {
Status string
Data []Availability
Message string
}{}
err = ms.c.Do(req, &resp)
return resp.Data, err
}
// Fluidsize provides a listing of all fluidsizes.
func (ms *MenuService) Fluidsize() ([]Fluidsize, error) {
req, err := ms.c.NewRequest("GET", "/menu/fluidsize", nil)
if err != nil {
return nil, err
}
res := struct {
Status string
Data []Fluidsize
Message string
}{}
err = ms.c.Do(req, &res)
return res.Data, err
}
// BeerTemperature provides a mapping of BeerTemperatures to their respective descriptions.
func (ms *MenuService) BeerTemperature() (map[BeerTemperature]string, error) {
req, err := ms.c.NewRequest("GET", "/menu/beer-temperature", nil)
if err != nil {
return nil, err
}
res := struct {
Status string
Data map[BeerTemperature]string
Message string
}{}
err = ms.c.Do(req, &res)
return res.Data, err
}
// Countries provides a listing of all Countries on Earth.
func (ms *MenuService) Countries() ([]Country, error) {
req, err := ms.c.NewRequest("GET", "/menu/countries", nil)
if err != nil {
return nil, err
}
res := struct {
Status string
Data []Country
Message string
}{}
err = ms.c.Do(req, &res)
return res.Data, err
}
// Ingredients provides a listing of all Ingredients.
func (ms *MenuService) Ingredients() ([]Ingredient, error) {
req, err := ms.c.NewRequest("GET", "/menu/ingredients", nil)
if err != nil {
return nil, err
}
res := struct {
Status string
Data []Ingredient
Message string
}{}
err = ms.c.Do(req, &res)
return res.Data, err
}
// LocationTypes provides a mapping of LocationTypes to their respective descriptions.
func (ms *MenuService) LocationTypes() (map[LocationType]string, error) {
req, err := ms.c.NewRequest("GET", "/menu/location-types", nil)
if err != nil {
return nil, err
}
res := struct {
Status string
Data map[LocationType]string
Message string
}{}
err = ms.c.Do(req, &res)
return res.Data, err
}
// FluidsizeVolume provides a mapping of Volumes to their respective descriptions.
func (ms *MenuService) FluidsizeVolume() (map[Volume]string, error) {
req, err := ms.c.NewRequest("GET", "/menu/fluidsize-volume", nil)
if err != nil {
return nil, err
}
res := struct {
Status string
Data map[Volume]string
Message string
}{}
err = ms.c.Do(req, &res)
return res.Data, err
}
// EventTypes provides a mapping of EventTypes to their respective descriptions.
func (ms *MenuService) EventTypes() (map[EventType]string, error) {
req, err := ms.c.NewRequest("GET", "/menu/event-types", nil)
if err != nil {
return nil, err
}
res := struct {
Status string
Data map[EventType]string
Message string
}{}
err = ms.c.Do(req, &res)
return res.Data, err
}