Skip to content

Commit 5571aeb

Browse files
authored
Merge pull request lossycache#4 from hikarimn/patch-3
Added an explanation
2 parents df0d63b + 80fe91a commit 5571aeb

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

‎README.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,21 @@ var err error
3131
currentWeather, err = owm.CurrentWeatherFromCoordinates(lat, long)
3232
```
3333

34+
If fetching the weather from a city ID, pass the city ID as an argument to the CurrentWeatherFromCityID function
35+
```go
36+
var currentWeather *openweathermap.CurrentWeatherResponse
37+
var err error
38+
39+
currentWeather, err = owm.CurrentWeatherFromCityID(id)
40+
```
41+
42+
If fetching the weather from a zip code, pass the zip code as an argument to the CurrentWeatherFromZip function
43+
```go
44+
var currentWeather *openweathermap.CurrentWeatherResponse
45+
var err error
46+
47+
currentWeather, err = owm.CurrentWeatherFromZip(zip)
48+
```
3449

3550
This function returns a struct, (CurrentWeatherResonse) that matches the fields of the json response from the API
3651
```json

0 commit comments

Comments
 (0)