Call

Represents 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

Link copied to clipboard
interface Factory

A Call factory that abstract the concrete Call instance creation.

Properties

Link copied to clipboard
abstract val request: Request<RequestBody>

Returns the original request that initiated this call.

Link copied to clipboard
abstract val response: Response<out ResponseBody>?

Returns the response if this call is successful, otherwise it might be null

Functions

Link copied to clipboard
abstract suspend fun await(): ResponseBody

Synchronously send the request and return its response from a kotlin.coroutines.CoroutineContext

Link copied to clipboard

Convenience function to catch any Exception and return it as a Failure Result This is useful, if we want to use when classes in processing result

Link copied to clipboard
abstract fun cancel()

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.

Link copied to clipboard
abstract fun enqueue(@NotNull responseCallback: Callback<RequestBody, ResponseBody>)

Asynchronously send the request and notify responseCallback of its response or if an error occurred talking to the server, creating the request, or processing the response.

Link copied to clipboard
abstract fun execute(): ResponseBody

Synchronously send the request and return its response.