retrofit / retrofit2 / Callback

Callback

interface Callback<T : Any!>

Communicates responses from a server or offline requests. One and only one method will be invoked in response to a given request.

Callback methods are executed using the Retrofit callback executor. When none is specified, the following defaults are used:

Functions

onFailure

abstract fun onFailure(call: Call<T>!, t: Throwable!): Unit

Invoked when a network exception occurred talking to the server or when an unexpected exception occurred creating the request or processing the response.

onResponse

abstract fun onResponse(call: Call<T>!, response: Response<T>!): Unit

Invoked for a received HTTP response.