Created
December 17, 2015 18:55
-
-
Save niftynei/b42b39328c9f8cc2f4ce 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
public class CreateUserRequest extends ClientNetworkRequest<User, Object> { | |
// ... | |
@Override | |
public NetworkCallResponse<Object> onMakeRequest() throws IOException { | |
EoLog.d(TAG, "Register a user called"); | |
String bearerString = ClientAuthManager.get().createBearerString(); | |
retrofit.Response<User> userResponse = EoApp.getAppContext() | |
.getClientRequestManager() | |
.getAuthApiService() | |
.createUser(bearerString, mNewUser).execute(); | |
if (!userResponse.isSuccess()) { | |
return NetworkCallResponse.get(userResponse); | |
} | |
// fetch the user's token | |
boolean wasSuccess = ClientAuthManager.get().fetchUserToken(mNewUser); | |
if (!wasSuccess) { | |
return NetworkCallResponse.get(retrofit.Response.error(500, null)); | |
} | |
return NetworkCallResponse.get(userResponse); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could you instead of using object use something like
And that LisaSuperResponse enforce a contact similar to what you were doing here: https://gist.github.com/niftynei/0dca2b1a0151788f4ecc