-
- All Implemented Interfaces:
-
io.getstream.chat.android.client.call.Call
public final class CoroutineCall<T extends Object> implements Call<T>
-
-
Field Summary
Fields Modifier and Type Field Description private final SuspendFunction0<Result<T>>suspendingTask
-
Constructor Summary
Constructors Constructor Description CoroutineCall(CoroutineScope scope, SuspendFunction0<Result<T>> suspendingTask)
-
Method Summary
Modifier and Type Method Description Unitcancel()Cancels the execution of the call, if cancellation is supported for the operation. Result<T>execute()Executes the call synchronously, in a blocking way. Unitenqueue(Call.Callback<T> callback)Executes the call asynchronously, on a background thread. final SuspendFunction0<Result<T>>getSuspendingTask()-
Methods inherited from class io.getstream.chat.android.client.call.CoroutineCall
enqueue, enqueue -
Methods inherited from class io.getstream.chat.android.client.call.Call
equals, hashCode, toString -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
CoroutineCall
CoroutineCall(CoroutineScope scope, SuspendFunction0<Result<T>> suspendingTask)
-
-
Method Detail
-
cancel
Unit cancel()
Cancels the execution of the call, if cancellation is supported for the operation.
Note that calls can not be cancelled when running them with execute.
-
execute
Result<T> execute()
Executes the call synchronously, in a blocking way. Only call this from a background thread.
-
enqueue
Unit enqueue(Call.Callback<T> callback)
Executes the call asynchronously, on a background thread. Safe to call from the main thread. The callback will always be invoked on the main thread.
-
getSuspendingTask
final SuspendFunction0<Result<T>> getSuspendingTask()
-
-
-
-