Package io.getstream.result.call
Class CoroutineCall
-
- All Implemented Interfaces:
-
io.getstream.result.call.Call
public final class CoroutineCall<T extends Object> implements Call<T>
-
-
Constructor Summary
Constructors Constructor Description CoroutineCall(CoroutineScope scope, SuspendFunction1<CoroutineScope, Result<T>> suspendingTask)
-
Method Summary
Modifier and Type Method Description Result<T>execute()Executes the call synchronously, in a blocking way. Result<T>await()Awaits the result of this Call in a suspending way, asynchronously. Unitcancel()Cancels the execution of the call. Unitenqueue(Call.Callback<T> callback)Executes the call asynchronously, on a background thread. -
-
Constructor Detail
-
CoroutineCall
CoroutineCall(CoroutineScope scope, SuspendFunction1<CoroutineScope, Result<T>> suspendingTask)
-
-
Method Detail
-
execute
Result<T> execute()
Executes the call synchronously, in a blocking way. Only call this from a background thread.
-
await
Result<T> await()
Awaits the result of this Call in a suspending way, asynchronously. Safe to call from any CoroutineContext.
Does not throw exceptions. Any errors will be wrapped in the Result that's returned.
-
enqueue
Unit enqueue(Call.Callback<T> callback)
-
-
-
-