Update Go API client

This commit is contained in:
Christine Dodrill 2015-08-17 14:36:24 -07:00
parent b5d36da2b6
commit 045f69d53a
2 changed files with 15 additions and 0 deletions

View File

@ -61,6 +61,12 @@ func Newest() (*Episode, error) {
return getEpisode("/newest") return getEpisode("/newest")
} }
// LastAired returns information on the most recently aried episode
// or an error.
func LastAired() (*Episode, error) {
return getEpisode("/last_aired")
}
// Random returns information on a random episode. // Random returns information on a random episode.
func Random() (*Episode, error) { func Random() (*Episode, error) {
return getEpisode("/random") return getEpisode("/random")

View File

@ -11,6 +11,15 @@ func TestNewestEpisode(t *testing.T) {
t.Logf("%#v", ep) t.Logf("%#v", ep)
} }
func TestLastAiredEpisode(t *testing.T) {
ep, err := LastAired()
if err != nil {
t.Fatal(err)
}
t.Logf("%#v", ep)
}
func TestRandomEpisode(t *testing.T) { func TestRandomEpisode(t *testing.T) {
ep, err := Random() ep, err := Random()
if err != nil { if err != nil {