Skip to content

//okhttp/okhttp3/Call

Call

[common]\ expect interface Call

A call is a request that has been prepared for execution. A call can be canceled. As this object represents a single request/response pair (stream), it cannot be executed twice.

[jvm]\ actual interface Call : Cloneable

[nonJvm]\ actual interface Call

Types

Name Summary
Factory [common, jvm, nonJvm]
[common]
expect fun interface Factory
[jvm, nonJvm]
actual fun interface Factory

Functions

Name Summary
cancel [common]
expect abstract fun cancel()
Cancels the request, if possible. Requests that are already complete cannot be canceled.
[jvm, nonJvm]
[jvm, nonJvm]
actual abstract fun cancel()
clone [common]
expect abstract fun clone(): Call
Create a new, identical call to this one which can be enqueued or executed even if this call has already been.
[jvm, nonJvm]
[jvm]
actual abstract override fun clone(): Call
[nonJvm]
actual abstract fun clone(): Call
enqueue [common]
expect abstract fun enqueue(responseCallback: Callback)
Schedules the request to be executed at some point in the future.
[jvm, nonJvm]
[jvm, nonJvm]
actual abstract fun enqueue(responseCallback: Callback)
execute [jvm]
abstract fun execute(): Response
Invokes the request immediately, and blocks until the response can be processed or is in error.
executeAsync [nonJvm]
abstract suspend fun executeAsync(): Response
Invokes the request immediately, and blocks until the response can be processed or is in error.
isCanceled [common, jvm, nonJvm]
[common]
expect abstract fun isCanceled(): Boolean
[jvm, nonJvm]
actual abstract fun isCanceled(): Boolean
isExecuted [common]
expect abstract fun isExecuted(): Boolean
Returns true if this call has been either execute or enqueued. It is an error to execute a call more than once.
[jvm, nonJvm]
[jvm, nonJvm]
actual abstract fun isExecuted(): Boolean
request [common]
expect abstract fun request(): Request
Returns the original request that initiated this call.
[jvm, nonJvm]
[jvm, nonJvm]
actual abstract fun request(): Request
timeout [jvm]
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.