Skip to content

Instantly share code, notes, and snippets.

@raulh82vlc
Last active June 9, 2020 23:44
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 raulh82vlc/a7f884a8c2ef8f8af4772f1e299381e7 to your computer and use it in GitHub Desktop.
Save raulh82vlc/a7f884a8c2ef8f8af4772f1e299381e7 to your computer and use it in GitHub Desktop.
NetworkDataSourceImpl java version with Single - RxJava
@NotNull
Single<List<TweetApiModel>> search(@NotNull String token, @NotNull String query) {
return twitterApi.search(requestsIOHandler.getTokenFormatted(access.getToken()),query)
.subscribeOn(taskThreading.io())
.observeOn(taskThreading.computation())
.filter(requestsIOHandler::searchHasNoErrorResponse)
.map(requestsIOHandler::getSearchContent)
.map(requestsIOHandler::getTweets)
.flatMapSingle(Single::just));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment