Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RxJava support #41

Open
NathHorrigan opened this issue Jan 13, 2017 · 8 comments
Open

RxJava support #41

NathHorrigan opened this issue Jan 13, 2017 · 8 comments

Comments

@NathHorrigan
Copy link

Any plans for adding support for RxJava by making service methods return observables?

@urizev
Copy link

urizev commented Jan 13, 2017

No need since Retrofit2 already supports RxJava. Indeed, it supports every interface through call adapters

Add this library:

compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'

And extend the Tmdb class to add the support.

class RxTmdb extends Tmdb {
      protected Retrofit.Builder retrofitBuilder() {
        return super.retrofitBuilder().
                         .addCallAdapterFactory(RxJava2CallAdapterFactory.create());
     }
}

@UweTrottmann
Copy link
Owner

@urizev But you still would have to change all the service method return types, no? Like:

@GET("search/movie")
Call<MovieResultsPage> movie(...);

has to be changed to:

@GET("search/movie")
Observable<MovieResultsPage> movie(...);

@NathHorrigan In any case, you should create a fork of this library and make the necessary adjustments (find/replace return types, add call adapter). Adding any possible RxJava method seems not useful.

@SimonVT
Copy link
Contributor

SimonVT commented Jan 14, 2017

Having separate RxMoviesService, etc, classes and an optional dependency on RxJava would probably not cause any issues for existing users tho

@urizev
Copy link

urizev commented Jan 14, 2017

@UweTrottmann Yes, you're right. I didn't realize. 😞

@NathHorrigan
Copy link
Author

I'll create a fork and let you know how it goes :)

@sevar83
Copy link

sevar83 commented Feb 15, 2017

I derived my local RxJava1 tmdb service and just using the entities. I guess we need 1 main (entities + Call) and 2 additional optional artifacts - RxJava and RxJava2. Don't know this packaging stuff well but you could check out how it is done in RxBinding for example.

@sevar83
Copy link

sevar83 commented Sep 29, 2017

I've pushed a fork with support for Kotlin and RxJava2. But it's built as an Android Gradle library not a pure Java artifact.
https://github.com/sevar83/tmdb-rxjava2-kotlin

@serafo27
Copy link
Contributor

serafo27 commented Sep 4, 2018

I created a fork, and relative pull request, in wich i duplcated all the services that return Observables.
All the new Services can be found into the class Tmdb.rx

https://github.com/serafo27/tmdb-rxjava

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants