Skip to content

Commit 4bd7b6a

Browse files
committed
feat: OpenMeteo current weather method
This simply calls forecast without hourly and daily params.
1 parent 1ab0634 commit 4bd7b6a

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

lib/src/main/kotlin/com/openmeteo/api/OpenMeteo.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,20 @@ class OpenMeteo(
225225
)
226226
)
227227

228+
fun currentWeather(
229+
temperatureUnit: TemperatureUnit? = null,
230+
windSpeedUnit: WindSpeedUnit? = null,
231+
precipitationUnit: PrecipitationUnit? = null,
232+
timeZone: TimeZone? = null,
233+
latitude: Float = this.latitude,
234+
longitude: Float = this.longitude,
235+
) = invoke(
236+
Forecast.Query(
237+
latitude, longitude,null, null,true,
238+
temperatureUnit, windSpeedUnit, precipitationUnit, timeZone
239+
)
240+
)
241+
228242
private inline fun <reified T> separate(iterable: Iterable<Any>?) =
229243
iterable?.filterIsInstance<T>()?.ifEmpty { null }
230244

0 commit comments

Comments
 (0)