add retrofit call weatherapi
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
ab0f8a0462
commit
2b44820d67
@ -0,0 +1,19 @@
|
|||||||
|
package com.example.shakecraft.data
|
||||||
|
|
||||||
|
data class WeatherResponse(
|
||||||
|
val weather: List<Weather>,
|
||||||
|
val info: Info
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Weather(
|
||||||
|
val id: Int,
|
||||||
|
val main: String,
|
||||||
|
val description: String,
|
||||||
|
val icon: String
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Info(
|
||||||
|
val temp: Double,
|
||||||
|
val feelsLike: Double,
|
||||||
|
val humidity: Int
|
||||||
|
)
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.example.shakecraft.services
|
||||||
|
import com.example.shakecraft.data.WeatherResponse
|
||||||
|
import retrofit2.http.GET
|
||||||
|
import retrofit2.http.Query
|
||||||
|
|
||||||
|
interface OpenWeatherMapService {
|
||||||
|
@GET("weather")
|
||||||
|
suspend fun getCurrentWeather(
|
||||||
|
@Query("q") cityName: String,
|
||||||
|
@Query("appid") apiKey: String
|
||||||
|
): WeatherResponse
|
||||||
|
}
|
Loading…
Reference in new issue