RxJava2: alternative to observable <Void>

I have an API that returns only error / success codes, without a body. With RxJava1, I would use Observable<Void>as the return value for this call.

What can I use for RxJava2? The Wiki hint for RxJava2 ( link ) does not help, since I cannot change the way the API works.

Setup:

compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
+4
source share
1 answer

Use Completable.

If the operation completes successfully, it throws a successful completion event. If this fails, you can use your own subclass Exceptionto wrap the necessary error codes.

+17

Source: https://habr.com/ru/post/1669053/


All Articles