Open Grandolf49 opened 4 years ago
@Grandolf49 you can do something like this:
public static <T> Single<Response<T>> toSingle(Call<T> call){
val single = SingleSubject.<Response<T>>create();
call.enqueue(new Callback<>() {
@Override
public void onFailure(@NotNull Call<T> call, @NotNull Throwable e) {
single.onError(e);
}
@Override
public void onResponse(@NotNull Call<T> call, @NotNull Response<T> response) {
single.onSuccess(response);
}
});
return single;
}
to add support to the methods you are interested in.
@aubryll Thanks for the comment.
Looks good, will try this approach!
Since we are upgrading to 1.5.0
, it consist of dedicated executer class Calls.java. Where we can directly execute query like PostSelfAuthenticationResponse resp = Calls.ok(client.selfAuthentication.authenticate1(""));
Summary
Currently, the API response is wrapped in
Call<ApiResponse>
object.Expectation
It would be very helpful for the Android Applications to get the response in either
Observable
orLiveData