Skip to content

Commit

Permalink
Update WeatherApiClient.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
krossovochkin authored Dec 19, 2024
1 parent adaf41d commit 9ca0941
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import io.ktor.client.HttpClient
import io.ktor.client.call.body
import io.ktor.client.request.get

private const val BASE_URL = "https://api.openweathermap.org/data/2.5"
private const val BASE_URL = "https://api.openweathermap.org/data"
private const val UNITS = "metric"

class WeatherApiClient(
Expand All @@ -16,7 +16,7 @@ class WeatherApiClient(

override suspend fun getCityList(query: String): CityListDto {
return client
.get("$BASE_URL/find?q=$query&appid=$apiKey&units=$UNITS")
.get("$BASE_URL/2.5/find?q=$query&appid=$apiKey&units=$UNITS")
.body()
}

Expand All @@ -25,7 +25,7 @@ class WeatherApiClient(
longitude: Double
): WeatherDetailsDto {
return client
.get("$BASE_URL/onecall?lat=$latitude&lon=$longitude&appid=$apiKey&units=$UNITS")
.get("$BASE_URL/3.0/onecall?lat=$latitude&lon=$longitude&appid=$apiKey&units=$UNITS")
.body()
}
}

0 comments on commit 9ca0941

Please sign in to comment.