Skip to content

Instantly share code, notes, and snippets.

@paulocns
Created August 7, 2018 01:16
Show Gist options
  • Select an option

  • Save paulocns/b094e2f807f47f3aff2e602fe3a14ada to your computer and use it in GitHub Desktop.

Select an option

Save paulocns/b094e2f807f47f3aff2e602fe3a14ada to your computer and use it in GitHub Desktop.
class SearchShows @Inject
constructor(private val showRepository: ShowRepository, private val resourceRepository: ResourceRepository) :
UseCase<String>() {
var query: String? = null
override suspend fun executeOnBackground(): String {
query?.let {
val showsInfo = showRepository.searchShow(it)
val showName: String? = showsInfo?.getOrNull(0)?.show?.title
return showName ?: resourceRepository.notFoundShow
}
return ""
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment