Skip to content

Instantly share code, notes, and snippets.

@utsmannn
Created June 28, 2020 04:17
Show Gist options
  • Save utsmannn/107d7c694c5b1e9f6bf857007f3a9b1a to your computer and use it in GitHub Desktop.
Save utsmannn/107d7c694c5b1e9f6bf857007f3a9b1a to your computer and use it in GitHub Desktop.
interface RetrofitInstance {
@GET("/v1/revgeocode")
suspend fun getLocation(
@Query("at") at: String,
@Query("apiKey") apiKey: String = Constant.apiKey
): Places
companion object {
fun create(): RetrofitInstance {
val logging = HttpLoggingInterceptor()
logging.level = HttpLoggingInterceptor.Level.BODY
val client = OkHttpClient.Builder()
.addInterceptor(logging)
.build()
val retrofit = Retrofit.Builder()
.baseUrl(Constant.baseUrl)
.addConverterFactory(GsonConverterFactory.create())
.client(client)
.build()
return retrofit.create(RetrofitInstance::class.java)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment