Last active
April 2, 2020 00:02
-
-
Save hissain/1aa3ee08de662c211029515681485665 to your computer and use it in GitHub Desktop.
Rest Call Example
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
fun addDummyUser() { | |
val apiService = RestApiService() | |
val userInfo = UserInfo( id = null, | |
userName = "Alex", | |
userEmail = "alex@gmail.com", | |
userAge = 32, | |
userUid = "164E92FC-D37A-4946-81CB-29DE7EE4B124" ) | |
apiService.addUser(userInfo) { | |
if (it?.id != null) { | |
// it = newly added user parsed as response | |
// it?.id = newly added user ID | |
} else { | |
Timber.d("Error registering new user") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment