Call

interface Call<T> : Cloneable

An invocation of an SDK call that sends a request to Square servers and returns a response. Each call yields its own request and response. Use clone to make multiple calls with the same parameters to the same web server; this may be used to retry a failed call.

Calls may be executed synchronously with execute, or asynchronously with enqueue. In either case the call can be canceled at any time with cancel.

Parameters

Successful response body type.

Functions

Link copied to clipboard
abstract fun cancel()

Cancels 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 override fun clone(): Call<T>

Creates a new, identical call to this one which can be enqueued or executed even if this call has already been executed.

Link copied to clipboard
abstract fun enqueue(callback: Callback<T>)

Asynchronously sends the request and notifies callback of the result.

Link copied to clipboard
abstract fun execute(): T

Synchronously sends the request and returns the result.

Link copied to clipboard
abstract fun isCanceled(): Boolean

True if cancel was called.

Link copied to clipboard
abstract fun isExecuted(): Boolean

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