Skip to content

Instantly share code, notes, and snippets.

@kozmi55
Created September 6, 2017 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kozmi55/9380a64f977c0880d6e707269ea86362 to your computer and use it in GitHub Desktop.
Save kozmi55/9380a64f977c0880d6e707269ea86362 to your computer and use it in GitHub Desktop.
class GetUsers(private val userRepository: UserRepository) {
fun execute(page: Int, forced: Boolean) : Single<List<UserViewModel>> {
val usersList = userRepository.getUsers(page, forced)
return usersList.map { userListModel: UserListModel? ->
val items = userListModel?.items ?: emptyList()
items.map { UserViewModel(it.userId, it.displayName, it.reputation, it.profileImage) }
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment