I have a class SongResponse
:
public class SongResponse implements Parcelable {
@SerializedName("token")
public String token;
@SerializedName("items")
public List<Song> songList;
}
@GET("songs")
Observable<SongResponse> getSongs(@Query("token") String token)
In the manager class, I want to return an Observable
by used the request above
public Observable<Song> syncSongs(token) {
return mSongService.getSongs(token);
....
@Override
public Observable<Song> call(List<Song> songs) {
return mDatabaseHelper.setSongs(songs);
}
}
syncSongs
will call another Observer
to insert songs in the database.
I used RxAndroid 2. I try to find about .map
and .flatMapIterable
, but don't result my problem. Could you help me complete this function?