Call

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.

actual interface Call : Cloneable

Inheritors

actual interface Call

Types

Link copied to clipboard
expect fun interface Factory
actual fun interface Factory
actual fun interface Factory

Functions

Link copied to clipboard
expect abstract fun cancel()

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

actual abstract fun cancel()
actual abstract fun cancel()
Link copied to clipboard
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.

actual abstract override fun clone(): Call
actual abstract fun clone(): Call
Link copied to clipboard
expect abstract fun enqueue(responseCallback: Callback)

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

actual abstract fun enqueue(responseCallback: Callback)
actual abstract fun enqueue(responseCallback: Callback)
Link copied to clipboard
abstract fun execute(): Response

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

Link copied to clipboard
abstract suspend fun executeAsync(): Response

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

Link copied to clipboard
expect abstract fun isCanceled(): Boolean
actual abstract fun isCanceled(): Boolean
actual abstract fun isCanceled(): Boolean
Link copied to clipboard
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.

actual abstract fun isExecuted(): Boolean
actual abstract fun isExecuted(): Boolean
Link copied to clipboard

An external implementation of Call.executeAsync, useful in implementations of Call that implement enqueue and don't generally use coroutines in the implementation.

Link copied to clipboard
expect abstract fun request(): Request

Returns the original request that initiated this call.

actual abstract fun request(): Request
actual abstract fun request(): Request
Link copied to clipboard
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.