-
Notifications
You must be signed in to change notification settings - Fork 1
/
subtype.go
31 lines (27 loc) · 885 Bytes
/
subtype.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
package myradio
// ShowSeasonSubtype gives information about an available show subtype
type ShowSeasonSubtype struct {
SubtypeID string `json:"id"`
Name string `json:"name"`
Class string `json:"class"`
Description string `json:"description"`
}
// GetAllShowSubtypes returns an array of all ShowSeasonSubtypes
func (s *Session) GetAllShowSubtypes() (subtypes []ShowSeasonSubtype, err error) {
err = s.get("/showSubtype/all").Into(&subtypes)
return
}
// GetShowSubtypeByClass returns a ShowSeasonSubtype based on a given class
// Can return nil pointer if no subtype found for given class
func (s *Session) GetShowSubtypeByClass(class string) (subtype *ShowSeasonSubtype, err error) {
subtypes, err := s.GetAllShowSubtypes()
if err != nil {
return
}
for _, subtype := range subtypes {
if subtype.Class == class {
return &subtype, err
}
}
return
}