Package io.getstream.result.call
Class CallKt
-
- All Implemented Interfaces:
public final class CallKt
-
-
Method Summary
Modifier and Type Method Description final static <T extends Any> Unitlaunch(Call<T> $self, CoroutineScope scope)Launches a call using coroutines scope. final static <T extends Any, K extends Any> Call<K>map(Call<T> $self, Function1<T, K> mapper)Maps a Call type to a transformed Call. final static <T extends Any, K extends Any> Call<Pair<T, K>>zipWith(Call<T> $self, Call<K> call)Zips a Call of T and a given call of K. final static <T extends Any> Call<T>doOnStart(Call<T> $self, CoroutineScope scope, SuspendFunction0<Unit> function)Run the given function before running the Call. final static <T extends Any> Call<T>doOnResult(Call<T> $self, CoroutineScope scope, SuspendFunction1<Result<T>, Unit> function)Run the given function before running the Call. final static <T extends Any> Call<T>withPrecondition(Call<T> $self, CoroutineScope scope, SuspendFunction0<Result<Unit>> precondition)Run the Call if the given precondition is Result.Success. final static <T extends Any> ReturnOnErrorCall<T>onErrorReturn(Call<T> $self, CoroutineScope scope, SuspendFunction1<Error, Result<T>> function)Wraps this Call into ReturnOnErrorCall to return an item specified by side effect function when it encounters an error. final static <T extends Any> Call<T>share(Call<T> $self, CoroutineScope scope, Function0<Integer> identifier)Shares the existing Call instance for the specified identifier. final static Call<Unit>toUnitCall(Call<?> $self)final static <T extends Any> Unitenqueue(Call<T> $self, Function1<T, Unit> onSuccess, Function1<Error, Unit> onError)final static <T extends Any> Call<T>retry(Call<T> $self, CoroutineScope scope, RetryPolicy retryPolicy)Wraps the original call with RetryCall wrapper. final static <T extends Any> Call<T>forceNewRequest(Call<T> $self)Forces a regular call to be used instead of DistinctCall. -
-
Method Detail
-
launch
final static <T extends Any> Unit launch(Call<T> $self, CoroutineScope scope)
Launches a call using coroutines scope.
- Parameters:
scope- CoroutineScope to launch this procedure.
-
zipWith
final static <T extends Any, K extends Any> Call<Pair<T, K>> zipWith(Call<T> $self, Call<K> call)
Zips a Call of T and a given call of K.
-
doOnStart
final static <T extends Any> Call<T> doOnStart(Call<T> $self, CoroutineScope scope, SuspendFunction0<Unit> function)
Run the given function before running the Call.
- Parameters:
scope- CoroutineScope to launch this procedure.function- A given lambda function to be executed.
-
doOnResult
final static <T extends Any> Call<T> doOnResult(Call<T> $self, CoroutineScope scope, SuspendFunction1<Result<T>, Unit> function)
Run the given function before running the Call.
- Parameters:
scope- CoroutineScope to launch this procedure.function- A given lambda function to be executed.
-
withPrecondition
final static <T extends Any> Call<T> withPrecondition(Call<T> $self, CoroutineScope scope, SuspendFunction0<Result<Unit>> precondition)
Run the Call if the given precondition is Result.Success.
- Parameters:
scope- CoroutineScope to launch this procedure.precondition- A given Result to decide to execute this Call.
-
onErrorReturn
final static <T extends Any> ReturnOnErrorCall<T> onErrorReturn(Call<T> $self, CoroutineScope scope, SuspendFunction1<Error, Result<T>> function)
Wraps this Call into ReturnOnErrorCall to return an item specified by side effect function when it encounters an error.
- Parameters:
scope- Scope of coroutine in which to execute side effect function.function- Function that returns data in the case of error.
-
share
final static <T extends Any> Call<T> share(Call<T> $self, CoroutineScope scope, Function0<Integer> identifier)
-
toUnitCall
final static Call<Unit> toUnitCall(Call<?> $self)
-
enqueue
final static <T extends Any> Unit enqueue(Call<T> $self, Function1<T, Unit> onSuccess, Function1<Error, Unit> onError)
-
retry
final static <T extends Any> Call<T> retry(Call<T> $self, CoroutineScope scope, RetryPolicy retryPolicy)
Wraps the original call with RetryCall wrapper. Allows to retry the original call based on RetryPolicy
- Parameters:
scope- Coroutine scope where the call should be run.retryPolicy- A policy used for retrying the call.
-
forceNewRequest
final static <T extends Any> Call<T> forceNewRequest(Call<T> $self)
Forces a regular call to be used instead of DistinctCall.
-
-
-
-