Skip to content

Instantly share code, notes, and snippets.

@Arunshaik2001
Created October 8, 2022 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arunshaik2001/4385ef719882e3cc56d01ad015be89e3 to your computer and use it in GitHub Desktop.
Save Arunshaik2001/4385ef719882e3cc56d01ad015be89e3 to your computer and use it in GitHub Desktop.
interface WeatherApi {
companion object {
const val BASE_URL = "https://api.openweathermap.org/"
val apiInstance = Retrofit.Builder()
.baseUrl(BASE_URL)
.client(OkHttpClient.Builder().addInterceptor(HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BASIC)).build())
.addConverterFactory(GsonConverterFactory.create())
.build()
.create(WeatherApi::class.java)
}
@GET("/data/2.5/weather")
suspend fun getWeatherDetails(@Query("lat") lat: Double,@Query("lon") long: Double,@Query("appid") appid: String): WeatherDTO
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment