Created
June 28, 2020 04:17
-
-
Save utsmannn/107d7c694c5b1e9f6bf857007f3a9b1a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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