Skip to content

Instantly share code, notes, and snippets.

@apkelly
Last active February 1, 2019 01:12
Show Gist options
  • Save apkelly/9f093bcf50713ea690d49c41eb2bb676 to your computer and use it in GitHub Desktop.
Save apkelly/9f093bcf50713ea690d49c41eb2bb676 to your computer and use it in GitHub Desktop.
CloudAutoMLViewModel.kt
private fun getRESTService(): CloudAutoMLService {
val gsonFactory = GsonConverterFactory
.create(GsonBuilder().create())
val networkClient = OkHttpClient.Builder()
.addInterceptor(HttpLoggingInterceptor().apply {
level = HttpLoggingInterceptor.Level.BODY
})
.build()
return Retrofit.Builder()
.baseUrl("https://automl.googleapis.com/")
.addCallAdapterFactory(CoroutineCallAdapterFactory())
.addConverterFactory(gsonFactory)
.client(networkClient)
.build()
.create(CloudAutoMLService::class.java)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment