Skip to content

Commit 262b96b

Browse files
committed
docs: quick example changed to current weather one
1 parent 249d843 commit 262b96b

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,20 @@ Here's a quick example:
2929
```kotlin
3030
import com.openmeteo.api.OpenMeteo
3131

32-
fun main() {
33-
34-
val openMeteo = OpenMeteo(City.Amsterdam)
35-
36-
val response = openMeteo(
37-
ForecastHourly.Rain,
38-
ForecastHourly.Weathercode,
39-
AirQualityHourly.Ozone,
40-
MarineDaily.WaveHeightMax,
41-
).getOrThrow()
42-
43-
// ... do stuff with response.hourlyValues and .dailyValues
44-
45-
}
32+
OpenMeteo("Amsterdam")
33+
.currentWeather(TemperatureUnit.Fahrenheit)
34+
.getOrNull()?.run {
35+
36+
println("+-- $city")
37+
println("| Coordinates: [ $latitude, $longitude ]")
38+
currentWeather?.run {
39+
println("| Timestamp: $time")
40+
println("| Temperature: $temperature°F")
41+
println("| Message: $weatherCode")
42+
println("+")
43+
}
44+
45+
}
4646
```
4747

4848
<!-- The library includes some examples in the [tests](lib/src/test/kotlin/com/openmeteo/api). -->

0 commit comments

Comments
 (0)