Call

interface Call<T> : Cloneable

An abstraction over a RPC call to pCloud's API servers.

A Call object resemebles a future request to execute a method having the following properties:

  • Allows for asynchronous execution by the enqueue method with a Callback object.
  • Allows for synchronous execution on the same thread by calling the execute method.
  • Can be executed only once, state can be checked via the isExecuted property.
  • Once created, a Call instance can be cloned via the clone method and executed again.
  • Executed calls can be cancelled via the cancel method. It is safe to call cancel multiple times.
  • Running calls that are being cancelled will result in an IOException being thrown or reported via onFailure.

Parameters

<T>

the type of the returned result

Functions

cancel
Link copied to clipboard
abstract fun cancel()
Cancel this call.
clone
Link copied to clipboard
abstract fun clone(): Call<T>
enqueue
Link copied to clipboard
abstract fun enqueue(callback: Callback<T>)
Asynchronously send the request and notify callback of its response or if an error occurred talking to the server, creating the request, or processing the response.
execute
Link copied to clipboard
abstract fun execute(): T
Synchronously send the request and return its response.
isCanceled
Link copied to clipboard
abstract fun isCanceled(): Boolean
isExecuted
Link copied to clipboard
abstract fun isExecuted(): Boolean
Returns true if this call has been either executed or enqueued.