Package 

Interface Call

  • All Implemented Interfaces:
    kotlin.Cloneable

    
    public interface Call<T extends Object>
     implements 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.

    • Method Summary

      Modifier and Type Method Description
      abstract T execute() Synchronously sends the request and returns the result.
      abstract Unit enqueue(Callback<T> callback) Asynchronously sends the request and notifies callback of the result.
      abstract Boolean isExecuted() True if this call has been either executed or enqueued.
      abstract Unit cancel() Cancels this call.
      abstract Boolean isCanceled() True if cancel was called.
      abstract Call<T> clone() Creates a new, identical call to this one which can be enqueued or executed even if this call has already been executed.
      • Methods inherited from class kotlin.Cloneable

        equals, hashCode, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • execute

         abstract T execute()

        Synchronously sends the request and returns the result.

      • enqueue

         abstract Unit enqueue(Callback<T> callback)

        Asynchronously sends the request and notifies callback of the result.

      • cancel

         abstract Unit 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.

      • clone

         abstract Call<T> clone()

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