Skip to content

Instantly share code, notes, and snippets.

@PhilippeBoisney
Created February 12, 2019 14:21
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 PhilippeBoisney/0d1afac24ee958c5b5d69f6ff945ab92 to your computer and use it in GitHub Desktop.
Save PhilippeBoisney/0d1afac24ee958c5b5d69f6ff945ab92 to your computer and use it in GitHub Desktop.
val networkModule = module {
factory<Interceptor> {
HttpLoggingInterceptor(HttpLoggingInterceptor.Logger { Log.d("API", it) })
.setLevel(HttpLoggingInterceptor.Level.HEADERS)
}
factory { OkHttpClient.Builder().addInterceptor(get()).build() }
single {
Retrofit.Builder()
.client(get())
.baseUrl("https://api.github.com/")
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(CoroutineCallAdapterFactory())
.build()
}
factory{ get<Retrofit>().create(UserService::class.java) }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment