DSL - kroegerama/retrofit-kaiteki GitHub Wiki
Usage
myApi.myCall(param).enqueue {
onSuccess {
Log.d("onSuccess", body().toString())
textView.text = body().toString()
}
onNoSuccess {
Log.d("onNoSuccess", body().toString())
}
onFailure { t ->
Log.d("onFailure", "" + t.toString())
textView.text = t.toString()
}
}
Available functions:
- before: will always be called before any listener will be called
- after: will always be called after any listener was called
- onResponse: will be called when a response arrives (not checked for success)
- onFailure: will be called when a network exception occurred
- onSuccess: will be called when a response arrives and
isSuccessful
is true - onNoSuccess: will be called when a response arrives and
isSuccessful
is false - onError: will be called when a response arrives, isSuccessful is false, and the response code is in the range 400..599