Created
February 12, 2019 14:21
-
-
Save PhilippeBoisney/0d1afac24ee958c5b5d69f6ff945ab92 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
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