Skip to content

Commit

Permalink
Merge pull request #48 from UniversityRadioYork/markspolakovs-subtypes
Browse files Browse the repository at this point in the history
Moving show subtypes into MyRadio, part 4 - API in myradio-go
  • Loading branch information
Skwunk committed Nov 20, 2019
2 parents e1b02be + 4db8b5b commit 8060aca
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
7 changes: 4 additions & 3 deletions season.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ type Season struct {
RequestedTime string `json:"requested_time"`
FirstTimeRaw string `json:"first_time"`
FirstTime time.Time
NumEpisodes Link `json:"num_episodes"`
AllocateLink Link `json:"allocatelink"`
RejectLink Link `json:"rejectlink"`
NumEpisodes Link `json:"num_episodes"`
AllocateLink Link `json:"allocatelink"`
RejectLink Link `json:"rejectlink"`
Subtype ShowSeasonSubtype `json:"subtype"`
}

// isScheduled returns whether the Season has been scheduled.
Expand Down
23 changes: 12 additions & 11 deletions show.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ type Credit struct {
// A MyRadio show contains seasons, each containing timeslots.
// @TODO: Refactor this to something better named
type ShowMeta struct {
ShowID int `json:"show_id"`
Title string `json:"title"`
CreditsString string `json:"credits_string"`
Credits []Credit `json:"credits"`
Description string `json:"description"`
ShowTypeID int `json:"show_type_id"`
Season Link `json:"seasons"`
EditLink Link `json:"editlink"`
ApplyLink Link `json:"applylink"`
MicroSiteLink Link `json:"micrositelink"`
Photo string `json:"photo"`
ShowID int `json:"show_id"`
Title string `json:"title"`
CreditsString string `json:"credits_string"`
Credits []Credit `json:"credits"`
Description string `json:"description"`
ShowTypeID int `json:"show_type_id"`
Season Link `json:"seasons"`
EditLink Link `json:"editlink"`
ApplyLink Link `json:"applylink"`
MicroSiteLink Link `json:"micrositelink"`
Photo string `json:"photo"`
Subtype ShowSeasonSubtype `json:"subtype"`
}

// Link represents a MyRadio action link.
Expand Down
12 changes: 12 additions & 0 deletions subtype.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package myradio

type ShowSeasonSubtype struct {
SubtypeID string `json:"id"`
Name string `json:"name"`
Class string `json:"class"`
}

func (s *Session) GetAllShowSubtypes() (subtypes []ShowSeasonSubtype, err error) {
err = s.get("/showSubtype/all").Into(&subtypes)
return
}

0 comments on commit 8060aca

Please sign in to comment.