Skip to content

Commit

Permalink
Merge pull request #81 from fireboltfrog/pullrequest
Browse files Browse the repository at this point in the history
added DailyByZip
  • Loading branch information
briandowns authored Apr 7, 2020
2 parents b4159c0 + dffbece commit 4fd20ce
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions forecast.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,14 @@ func (f *ForecastWeatherData) DailyByID(id, days int) error {

return f.ForecastWeatherJson.Decode(response.Body)
}

// DailyByZip will provide a forecast for the provided zip code.
func (f *ForecastWeatherData) DailyByZip(zip int, countryCode string, days int) error {
response, err := f.client.Get(fmt.Sprintf(f.baseURL, f.Key, fmt.Sprintf("zip=%d,%s", zip, countryCode), f.Unit, f.Lang, days))
if err != nil {
return err
}
defer response.Body.Close()

return f.ForecastWeatherJson.Decode(response.Body)
}

0 comments on commit 4fd20ce

Please # to comment.