How I can DRY Android retrofit calls?
I have several repository classes in my code.
For example, this is UserRepository:
public class UserRepository {
public static String TAG = "UserRepository";
ApiService mApiService;
SharedPreferences mPrefs;
Context mContext;
RemoteDataSource<User> mRemoteDataSource;
public UserRepository() {
mApiService = new RetrofitClient().getApiService();
mContext = App.getAppContext();
mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
mRemoteDataSource = new RemoteDataSource<>();
}
public RemoteDataSource getRemoteDataSource() {
mRemoteDataSource.setIsLoading();
Call<ApiResponse> userCall = mApiService.getUserInfo(mPrefs.getString(User.TOKEN_NAME, null));
userCall.enqueue(new Callback<ApiResponse>() {
@Override
public void onResponse(Call<ApiResponse> call, Response<ApiResponse> response) {
mRemoteDataSource.setIsLoaded();
mRemoteDataSource.setData(response.body().getUser());
mRemoteDataSource.setStatus(response.body().getStatus());
mRemoteDataSource.setMessage(response.body().getMessage());
}
@Override
public void onFailure(Call<ApiResponse> call, Throwable t) {
Log.e(TAG, t.getMessage());
mRemoteDataSource.setFailed(t.getMessage());
}
});
return mRemoteDataSource;
}
}
And this is BonusRepository:
public class BonusRepository {
public static String TAG = "BonusRepository";
ApiService mApiService;
SharedPreferences mPrefs;
Context mContext;
LiveData<Bonus> mBonus;
String mId;
RemoteDataSource<Bonus> mRemoteDataSource;
public BonusRepository(String id) {
mId = id;
mApiService = new RetrofitClient().getApiService();
mContext = App.getAppContext();
mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
mRemoteDataSource = new RemoteDataSource<>();
}
public RemoteDataSource getRemoteDataSource() {
mRemoteDataSource.setIsLoading();
Call<ApiResponse> bonusCall = mApiService.getBonus(mPrefs.getString(User.TOKEN_NAME, null), mId);
bonusCall.enqueue(new Callback<ApiResponse>() {
@Override
public void onResponse(Call<ApiResponse> call, Response<ApiResponse> response) {
mRemoteDataSource.setIsLoaded();
mRemoteDataSource.setData(response.body().getBonus());
mRemoteDataSource.setStatus(response.body().getStatus());
mRemoteDataSource.setMessage(response.body().getMessage());
}
@Override
public void onFailure(Call<ApiResponse> call, Throwable t) {
Log.e(TAG, t.getMessage());
mRemoteDataSource.setFailed(t.getMessage());
}
});
return mRemoteDataSource;
}
}
getRemoteDataSource
methods in both classes are equal, except
Call<ApiResponse> userCall = mApiService.getUserInfo(mPrefs.getString(User.TOKEN_NAME, null));
and mRemoteDataSource.setData(response.body().getUser());
in UserRepository
differs with:
Call<ApiResponse> bonusCall = ApiService.getBonus(mPrefs.getString(User.TOKEN_NAME, null), mId);
and mRemoteDataSource.setData(response.body().getBonus());
in BonusRepository.
In other repositories I have similar duplicate code.
I want to remove this duplications, but doesn't find any good solution.
What is the best way to DRY my code?
java android retrofit2 dry
add a comment |
I have several repository classes in my code.
For example, this is UserRepository:
public class UserRepository {
public static String TAG = "UserRepository";
ApiService mApiService;
SharedPreferences mPrefs;
Context mContext;
RemoteDataSource<User> mRemoteDataSource;
public UserRepository() {
mApiService = new RetrofitClient().getApiService();
mContext = App.getAppContext();
mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
mRemoteDataSource = new RemoteDataSource<>();
}
public RemoteDataSource getRemoteDataSource() {
mRemoteDataSource.setIsLoading();
Call<ApiResponse> userCall = mApiService.getUserInfo(mPrefs.getString(User.TOKEN_NAME, null));
userCall.enqueue(new Callback<ApiResponse>() {
@Override
public void onResponse(Call<ApiResponse> call, Response<ApiResponse> response) {
mRemoteDataSource.setIsLoaded();
mRemoteDataSource.setData(response.body().getUser());
mRemoteDataSource.setStatus(response.body().getStatus());
mRemoteDataSource.setMessage(response.body().getMessage());
}
@Override
public void onFailure(Call<ApiResponse> call, Throwable t) {
Log.e(TAG, t.getMessage());
mRemoteDataSource.setFailed(t.getMessage());
}
});
return mRemoteDataSource;
}
}
And this is BonusRepository:
public class BonusRepository {
public static String TAG = "BonusRepository";
ApiService mApiService;
SharedPreferences mPrefs;
Context mContext;
LiveData<Bonus> mBonus;
String mId;
RemoteDataSource<Bonus> mRemoteDataSource;
public BonusRepository(String id) {
mId = id;
mApiService = new RetrofitClient().getApiService();
mContext = App.getAppContext();
mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
mRemoteDataSource = new RemoteDataSource<>();
}
public RemoteDataSource getRemoteDataSource() {
mRemoteDataSource.setIsLoading();
Call<ApiResponse> bonusCall = mApiService.getBonus(mPrefs.getString(User.TOKEN_NAME, null), mId);
bonusCall.enqueue(new Callback<ApiResponse>() {
@Override
public void onResponse(Call<ApiResponse> call, Response<ApiResponse> response) {
mRemoteDataSource.setIsLoaded();
mRemoteDataSource.setData(response.body().getBonus());
mRemoteDataSource.setStatus(response.body().getStatus());
mRemoteDataSource.setMessage(response.body().getMessage());
}
@Override
public void onFailure(Call<ApiResponse> call, Throwable t) {
Log.e(TAG, t.getMessage());
mRemoteDataSource.setFailed(t.getMessage());
}
});
return mRemoteDataSource;
}
}
getRemoteDataSource
methods in both classes are equal, except
Call<ApiResponse> userCall = mApiService.getUserInfo(mPrefs.getString(User.TOKEN_NAME, null));
and mRemoteDataSource.setData(response.body().getUser());
in UserRepository
differs with:
Call<ApiResponse> bonusCall = ApiService.getBonus(mPrefs.getString(User.TOKEN_NAME, null), mId);
and mRemoteDataSource.setData(response.body().getBonus());
in BonusRepository.
In other repositories I have similar duplicate code.
I want to remove this duplications, but doesn't find any good solution.
What is the best way to DRY my code?
java android retrofit2 dry
add a comment |
I have several repository classes in my code.
For example, this is UserRepository:
public class UserRepository {
public static String TAG = "UserRepository";
ApiService mApiService;
SharedPreferences mPrefs;
Context mContext;
RemoteDataSource<User> mRemoteDataSource;
public UserRepository() {
mApiService = new RetrofitClient().getApiService();
mContext = App.getAppContext();
mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
mRemoteDataSource = new RemoteDataSource<>();
}
public RemoteDataSource getRemoteDataSource() {
mRemoteDataSource.setIsLoading();
Call<ApiResponse> userCall = mApiService.getUserInfo(mPrefs.getString(User.TOKEN_NAME, null));
userCall.enqueue(new Callback<ApiResponse>() {
@Override
public void onResponse(Call<ApiResponse> call, Response<ApiResponse> response) {
mRemoteDataSource.setIsLoaded();
mRemoteDataSource.setData(response.body().getUser());
mRemoteDataSource.setStatus(response.body().getStatus());
mRemoteDataSource.setMessage(response.body().getMessage());
}
@Override
public void onFailure(Call<ApiResponse> call, Throwable t) {
Log.e(TAG, t.getMessage());
mRemoteDataSource.setFailed(t.getMessage());
}
});
return mRemoteDataSource;
}
}
And this is BonusRepository:
public class BonusRepository {
public static String TAG = "BonusRepository";
ApiService mApiService;
SharedPreferences mPrefs;
Context mContext;
LiveData<Bonus> mBonus;
String mId;
RemoteDataSource<Bonus> mRemoteDataSource;
public BonusRepository(String id) {
mId = id;
mApiService = new RetrofitClient().getApiService();
mContext = App.getAppContext();
mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
mRemoteDataSource = new RemoteDataSource<>();
}
public RemoteDataSource getRemoteDataSource() {
mRemoteDataSource.setIsLoading();
Call<ApiResponse> bonusCall = mApiService.getBonus(mPrefs.getString(User.TOKEN_NAME, null), mId);
bonusCall.enqueue(new Callback<ApiResponse>() {
@Override
public void onResponse(Call<ApiResponse> call, Response<ApiResponse> response) {
mRemoteDataSource.setIsLoaded();
mRemoteDataSource.setData(response.body().getBonus());
mRemoteDataSource.setStatus(response.body().getStatus());
mRemoteDataSource.setMessage(response.body().getMessage());
}
@Override
public void onFailure(Call<ApiResponse> call, Throwable t) {
Log.e(TAG, t.getMessage());
mRemoteDataSource.setFailed(t.getMessage());
}
});
return mRemoteDataSource;
}
}
getRemoteDataSource
methods in both classes are equal, except
Call<ApiResponse> userCall = mApiService.getUserInfo(mPrefs.getString(User.TOKEN_NAME, null));
and mRemoteDataSource.setData(response.body().getUser());
in UserRepository
differs with:
Call<ApiResponse> bonusCall = ApiService.getBonus(mPrefs.getString(User.TOKEN_NAME, null), mId);
and mRemoteDataSource.setData(response.body().getBonus());
in BonusRepository.
In other repositories I have similar duplicate code.
I want to remove this duplications, but doesn't find any good solution.
What is the best way to DRY my code?
java android retrofit2 dry
I have several repository classes in my code.
For example, this is UserRepository:
public class UserRepository {
public static String TAG = "UserRepository";
ApiService mApiService;
SharedPreferences mPrefs;
Context mContext;
RemoteDataSource<User> mRemoteDataSource;
public UserRepository() {
mApiService = new RetrofitClient().getApiService();
mContext = App.getAppContext();
mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
mRemoteDataSource = new RemoteDataSource<>();
}
public RemoteDataSource getRemoteDataSource() {
mRemoteDataSource.setIsLoading();
Call<ApiResponse> userCall = mApiService.getUserInfo(mPrefs.getString(User.TOKEN_NAME, null));
userCall.enqueue(new Callback<ApiResponse>() {
@Override
public void onResponse(Call<ApiResponse> call, Response<ApiResponse> response) {
mRemoteDataSource.setIsLoaded();
mRemoteDataSource.setData(response.body().getUser());
mRemoteDataSource.setStatus(response.body().getStatus());
mRemoteDataSource.setMessage(response.body().getMessage());
}
@Override
public void onFailure(Call<ApiResponse> call, Throwable t) {
Log.e(TAG, t.getMessage());
mRemoteDataSource.setFailed(t.getMessage());
}
});
return mRemoteDataSource;
}
}
And this is BonusRepository:
public class BonusRepository {
public static String TAG = "BonusRepository";
ApiService mApiService;
SharedPreferences mPrefs;
Context mContext;
LiveData<Bonus> mBonus;
String mId;
RemoteDataSource<Bonus> mRemoteDataSource;
public BonusRepository(String id) {
mId = id;
mApiService = new RetrofitClient().getApiService();
mContext = App.getAppContext();
mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
mRemoteDataSource = new RemoteDataSource<>();
}
public RemoteDataSource getRemoteDataSource() {
mRemoteDataSource.setIsLoading();
Call<ApiResponse> bonusCall = mApiService.getBonus(mPrefs.getString(User.TOKEN_NAME, null), mId);
bonusCall.enqueue(new Callback<ApiResponse>() {
@Override
public void onResponse(Call<ApiResponse> call, Response<ApiResponse> response) {
mRemoteDataSource.setIsLoaded();
mRemoteDataSource.setData(response.body().getBonus());
mRemoteDataSource.setStatus(response.body().getStatus());
mRemoteDataSource.setMessage(response.body().getMessage());
}
@Override
public void onFailure(Call<ApiResponse> call, Throwable t) {
Log.e(TAG, t.getMessage());
mRemoteDataSource.setFailed(t.getMessage());
}
});
return mRemoteDataSource;
}
}
getRemoteDataSource
methods in both classes are equal, except
Call<ApiResponse> userCall = mApiService.getUserInfo(mPrefs.getString(User.TOKEN_NAME, null));
and mRemoteDataSource.setData(response.body().getUser());
in UserRepository
differs with:
Call<ApiResponse> bonusCall = ApiService.getBonus(mPrefs.getString(User.TOKEN_NAME, null), mId);
and mRemoteDataSource.setData(response.body().getBonus());
in BonusRepository.
In other repositories I have similar duplicate code.
I want to remove this duplications, but doesn't find any good solution.
What is the best way to DRY my code?
java android retrofit2 dry
java android retrofit2 dry
edited Nov 12 '18 at 12:31
Bsquare
2,59731031
2,59731031
asked Nov 12 '18 at 8:11
igor_rb
898624
898624
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Create an abstract class parent to all your repositories' ones, and implement the getRemoteDataSource() method, calling a new abstract method, which will be the only specific one, in each specific implementation.
For instance:
public class AbstractRepository {
protected abstract Call<ApiResponse> performCall();
public RemoteDataSource getRemoteDataSource() {
mRemoteDataSource.setIsLoading();
Call<ApiResponse> userCall = performCall();
userCall.enqueue(new Callback<ApiResponse>() {
@Override
public void onResponse(Call<ApiResponse> call, Response<ApiResponse> response) {
mRemoteDataSource.setIsLoaded();
mRemoteDataSource.setData(response.body().getUser());
mRemoteDataSource.setStatus(response.body().getStatus());
mRemoteDataSource.setMessage(response.body().getMessage());
}
@Override
public void onFailure(Call<ApiResponse> call, Throwable t) {
Log.e(TAG, t.getMessage());
mRemoteDataSource.setFailed(t.getMessage());
}
});
return mRemoteDataSource;
}
}
And then you can perform something like:
public class UserRepository extends AbstractRepository {
public static String TAG = "UserRepository";
ApiService mApiService;
SharedPreferences mPrefs;
Context mContext;
RemoteDataSource<User> mRemoteDataSource;
public UserRepository() {
mApiService = new RetrofitClient().getApiService();
mContext = App.getAppContext();
mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
mRemoteDataSource = new RemoteDataSource<>();
}
protected Call<ApiResponse> performCall() {
return mApiService.getUserInfo(mPrefs.getString(User.TOKEN_NAME, null));
}
}
I let you adapt to your needs, but this is the best solution.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53258088%2fhow-i-can-dry-android-retrofit-calls%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Create an abstract class parent to all your repositories' ones, and implement the getRemoteDataSource() method, calling a new abstract method, which will be the only specific one, in each specific implementation.
For instance:
public class AbstractRepository {
protected abstract Call<ApiResponse> performCall();
public RemoteDataSource getRemoteDataSource() {
mRemoteDataSource.setIsLoading();
Call<ApiResponse> userCall = performCall();
userCall.enqueue(new Callback<ApiResponse>() {
@Override
public void onResponse(Call<ApiResponse> call, Response<ApiResponse> response) {
mRemoteDataSource.setIsLoaded();
mRemoteDataSource.setData(response.body().getUser());
mRemoteDataSource.setStatus(response.body().getStatus());
mRemoteDataSource.setMessage(response.body().getMessage());
}
@Override
public void onFailure(Call<ApiResponse> call, Throwable t) {
Log.e(TAG, t.getMessage());
mRemoteDataSource.setFailed(t.getMessage());
}
});
return mRemoteDataSource;
}
}
And then you can perform something like:
public class UserRepository extends AbstractRepository {
public static String TAG = "UserRepository";
ApiService mApiService;
SharedPreferences mPrefs;
Context mContext;
RemoteDataSource<User> mRemoteDataSource;
public UserRepository() {
mApiService = new RetrofitClient().getApiService();
mContext = App.getAppContext();
mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
mRemoteDataSource = new RemoteDataSource<>();
}
protected Call<ApiResponse> performCall() {
return mApiService.getUserInfo(mPrefs.getString(User.TOKEN_NAME, null));
}
}
I let you adapt to your needs, but this is the best solution.
add a comment |
Create an abstract class parent to all your repositories' ones, and implement the getRemoteDataSource() method, calling a new abstract method, which will be the only specific one, in each specific implementation.
For instance:
public class AbstractRepository {
protected abstract Call<ApiResponse> performCall();
public RemoteDataSource getRemoteDataSource() {
mRemoteDataSource.setIsLoading();
Call<ApiResponse> userCall = performCall();
userCall.enqueue(new Callback<ApiResponse>() {
@Override
public void onResponse(Call<ApiResponse> call, Response<ApiResponse> response) {
mRemoteDataSource.setIsLoaded();
mRemoteDataSource.setData(response.body().getUser());
mRemoteDataSource.setStatus(response.body().getStatus());
mRemoteDataSource.setMessage(response.body().getMessage());
}
@Override
public void onFailure(Call<ApiResponse> call, Throwable t) {
Log.e(TAG, t.getMessage());
mRemoteDataSource.setFailed(t.getMessage());
}
});
return mRemoteDataSource;
}
}
And then you can perform something like:
public class UserRepository extends AbstractRepository {
public static String TAG = "UserRepository";
ApiService mApiService;
SharedPreferences mPrefs;
Context mContext;
RemoteDataSource<User> mRemoteDataSource;
public UserRepository() {
mApiService = new RetrofitClient().getApiService();
mContext = App.getAppContext();
mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
mRemoteDataSource = new RemoteDataSource<>();
}
protected Call<ApiResponse> performCall() {
return mApiService.getUserInfo(mPrefs.getString(User.TOKEN_NAME, null));
}
}
I let you adapt to your needs, but this is the best solution.
add a comment |
Create an abstract class parent to all your repositories' ones, and implement the getRemoteDataSource() method, calling a new abstract method, which will be the only specific one, in each specific implementation.
For instance:
public class AbstractRepository {
protected abstract Call<ApiResponse> performCall();
public RemoteDataSource getRemoteDataSource() {
mRemoteDataSource.setIsLoading();
Call<ApiResponse> userCall = performCall();
userCall.enqueue(new Callback<ApiResponse>() {
@Override
public void onResponse(Call<ApiResponse> call, Response<ApiResponse> response) {
mRemoteDataSource.setIsLoaded();
mRemoteDataSource.setData(response.body().getUser());
mRemoteDataSource.setStatus(response.body().getStatus());
mRemoteDataSource.setMessage(response.body().getMessage());
}
@Override
public void onFailure(Call<ApiResponse> call, Throwable t) {
Log.e(TAG, t.getMessage());
mRemoteDataSource.setFailed(t.getMessage());
}
});
return mRemoteDataSource;
}
}
And then you can perform something like:
public class UserRepository extends AbstractRepository {
public static String TAG = "UserRepository";
ApiService mApiService;
SharedPreferences mPrefs;
Context mContext;
RemoteDataSource<User> mRemoteDataSource;
public UserRepository() {
mApiService = new RetrofitClient().getApiService();
mContext = App.getAppContext();
mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
mRemoteDataSource = new RemoteDataSource<>();
}
protected Call<ApiResponse> performCall() {
return mApiService.getUserInfo(mPrefs.getString(User.TOKEN_NAME, null));
}
}
I let you adapt to your needs, but this is the best solution.
Create an abstract class parent to all your repositories' ones, and implement the getRemoteDataSource() method, calling a new abstract method, which will be the only specific one, in each specific implementation.
For instance:
public class AbstractRepository {
protected abstract Call<ApiResponse> performCall();
public RemoteDataSource getRemoteDataSource() {
mRemoteDataSource.setIsLoading();
Call<ApiResponse> userCall = performCall();
userCall.enqueue(new Callback<ApiResponse>() {
@Override
public void onResponse(Call<ApiResponse> call, Response<ApiResponse> response) {
mRemoteDataSource.setIsLoaded();
mRemoteDataSource.setData(response.body().getUser());
mRemoteDataSource.setStatus(response.body().getStatus());
mRemoteDataSource.setMessage(response.body().getMessage());
}
@Override
public void onFailure(Call<ApiResponse> call, Throwable t) {
Log.e(TAG, t.getMessage());
mRemoteDataSource.setFailed(t.getMessage());
}
});
return mRemoteDataSource;
}
}
And then you can perform something like:
public class UserRepository extends AbstractRepository {
public static String TAG = "UserRepository";
ApiService mApiService;
SharedPreferences mPrefs;
Context mContext;
RemoteDataSource<User> mRemoteDataSource;
public UserRepository() {
mApiService = new RetrofitClient().getApiService();
mContext = App.getAppContext();
mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
mRemoteDataSource = new RemoteDataSource<>();
}
protected Call<ApiResponse> performCall() {
return mApiService.getUserInfo(mPrefs.getString(User.TOKEN_NAME, null));
}
}
I let you adapt to your needs, but this is the best solution.
edited Nov 12 '18 at 14:10
answered Nov 12 '18 at 12:35
Bsquare
2,59731031
2,59731031
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53258088%2fhow-i-can-dry-android-retrofit-calls%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown