interface Call<T : Any!> : Cloneable
An invocation of a Retrofit method that sends a request to a webserver and returns a response. Each call yields its own HTTP request and response pair. Use #clone to make multiple calls with the same parameters to the same webserver; this may be used to implement polling or to retry a failed call.
Calls may be executed synchronously with #execute, or asynchronously with . In either case the call can be canceled at any time with #cancel. A call that is busy writing its request or reading its response may receive a IOException; this is working as designed.
abstract fun cancel(): Unit
Cancel this call. An attempt will be made to cancel in-flight calls, and if the call has not yet been executed it never will be. |
|
abstract fun clone(): Call<T>
Create a new, identical call to this one which can be enqueued or executed even if this call has already been. |
|
abstract fun enqueue(callback: Callback<T>!): Unit
Asynchronously send the request and notify |
|
abstract fun execute(): Response<T>!
Synchronously send the request and return its response. |
|
abstract fun isCanceled(): Boolean
True if |
|
abstract fun isExecuted(): Boolean
Returns true if this call has been either executed or . It is an error to execute or enqueue a call more than once. |
|
abstract fun request(): Request!
The original HTTP request. |
|
abstract fun timeout(): Timeout!
Returns a timeout that spans the entire call: resolving DNS, connecting, writing the request body, server processing, and reading the response body. If the call requires redirects or retries all must complete within one timeout period. |
suspend fun <T : Any> Call<T>.await(): T |
|
suspend fun <T> Call<T>.awaitResponse(): Response<T> |