okhttp / okhttp3 / Call

Call

interface Call : Cloneable

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.

Types

Factory

interface Factory

Functions

cancel

abstract fun cancel(): Unit

Cancels the request, if possible. Requests that are already complete cannot be canceled.

clone

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.

enqueue

abstract fun enqueue(responseCallback: Callback): Unit

Schedules the request to be executed at some point in the future.

execute

abstract fun execute(): Response

Invokes the request immediately, and blocks until the response can be processed or is in error.

isCanceled

abstract fun isCanceled(): Boolean

isExecuted

abstract fun isExecuted(): Boolean

Returns true if this call has been either executed or enqueued. It is an error to execute a call more than once.

request

abstract fun request(): Request

Returns the original request that initiated this call.

timeout

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.