Instantly share code, notes, and snippets.

What would you like to do?
Making a Retrofit API call with RxJava with a Kotlin-esque API
.subscribe { response : NetworkResponse<AccessToken, Error> ->
when (response) {
is NetworkResponse.Success<AccessToken> -> {
// A 2XX response that's guaranteed to have a body of type AccessToken.
is NetworkResponse.ServerError<Error> -> {
// A non-2XX response that may have an Error as its error body.
is NetworkResponse.NetworkError -> {
// A request that didn't result in a response from the server.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment