I am using Retrofit + RxJava + GSON to consume a rest api for search. The way the API is built, it returns a list of objects and the total results as a header in the response (total-results
):
@GET("search/events?eager=[competition,tv]")
fun searchEvents(@Query("q") q: String, @Query("category") category: String, @Query("order") order: String): Single<List<Event>>
I would like to instead return Single, where SearchResult is:
SearchResult {
var total: Int
var events: List<Event>
}
Is this possible?