Last active
June 11, 2019 18:09
-
-
Save ovicko/5b4d1da92ff03e55c6188375a1e33322 to your computer and use it in GitHub Desktop.
RetrofitHelper
This file contains 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
public class RetrofitHelper { | |
private Retrofit.Builder retrofit; | |
public RetrofitHelper() { | |
retrofit = new Retrofit.Builder() | |
.baseUrl(RetrofitApi.BASE_URL) | |
.addConverterFactory(GsonConverterFactory.create()) | |
.client(new OkHttpClient() | |
.newBuilder() | |
.addNetworkInterceptor( | |
new HttpLoggingInterceptor() | |
.setLevel(HttpLoggingInterceptor.Level.BODY)).build()); | |
} | |
public <T> T getService(Class<T> tService) { | |
return retrofit.build().create(tService); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment