Skip to content

Instantly share code, notes, and snippets.

@hissain
Last active April 2, 2020 00:02
Show Gist options
  • Save hissain/1aa3ee08de662c211029515681485665 to your computer and use it in GitHub Desktop.
Save hissain/1aa3ee08de662c211029515681485665 to your computer and use it in GitHub Desktop.
Rest Call Example
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