-
Notifications
You must be signed in to change notification settings - Fork 2
Examples
Davide Bassi edited this page Sep 11, 2023
·
5 revisions
import com.openmeteo.api.common.Response
import com.openmeteo.api.common.time.Timezone
import com.openmeteo.api.common.units.TemperatureUnit
@OptIn(Response.ExperimentalGluedUnitTimeStepValues::class)
fun main() {
val om = OpenMeteo("Trieste", "it")
val forecast = om.forecast {
daily = Forecast.Daily {
listOf(temperature2mMin, temperature2mMax)
}
temperatureUnit = TemperatureUnit.Fahrenheit
timezone = Timezone.auto
}.getOrThrow()
Forecast.Daily.run {
forecast.daily.getValue(temperature2mMax).run {
println("# $temperature2mMax ($unit)")
values.forEach{ (t, v) -> println("> $t | $v") }
}
}
}