Skip to content

Commit 80fe91a

Browse files
authored
Added an explanation
for the two new funcs using a city ID and a zip code
1 parent 4d81eb7 commit 80fe91a

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)