-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into markspolakovs-podcast-with-show
- Loading branch information
Showing
1 changed file
with
22 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,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"` | ||
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 | ||
} |