Package-level declarations
Types
Models the state of an asynchronous operation.
The modeled request failed. If there was anything thrown to cause this, it'll be included in throwable. It might also contain some extra metadata, typically used to provide context about the failure, to help make it actionable (either for the user or the developer). An optional errorId can be provided for error tracking and correlation purposes.
Marks any AsyncResult that hasn't yet delivered a result (Success or Error). Useful to bundle NotStarted and Loading states in exhaustive when statements.
Used to model idle states. For example, if an operation is user initiated, it'll remain in this state until the user starts it (when it'll likely transition to Loading).
Scope for the resultFlow builder. Provides explicit emission functions for each AsyncResult state: success, error, loading, and notStarted.
Scope for the result DSL block. Provides bind, error, loading, notStarted, ensure, and ensureNotNull for short-circuit evaluation of AsyncResult values.
Properties
Returns true if the AsyncResult is Error, false otherwise.
Returns true if the AsyncResult is Incomplete, false otherwise.
Returns true if the AsyncResult is Success, false otherwise.
Functions
Returns true if any of the given AsyncResult items is an Error.
Returns true if any of the given AsyncResult items is Incomplete.
Returns true if any of the AsyncResult instances are Incomplete.
Returns true if any of the given AsyncResult items is Loading.
Returns true if any of the AsyncResult instances are Loading.
Transforms a Flow of values into a Flow of AsyncResult, wrapping each emitted value in a Success and handling errors by wrapping them in Error.
Converts Loading and NotStarted to a AsyncResult of type T. This is to prevent us to having to map everything when we know we don't have a Success value, where types would actually matter.
Converts the current AsyncResult to a AsyncResult of type R if the current value is of type R. If the current value is not of type R, it will return an Error.
Combines an Iterable of AsyncResult items into a single AsyncResult containing a List.
Combines a List of AsyncResult items into a single AsyncResult containing a List.
Combines a Sequence of AsyncResult items into a single AsyncResult containing a List.
Returns true if this AsyncResult is a Success containing the given value.
Returns the ErrorId if the AsyncResult is Error and has an errorId, else returns null.
Returns the Error itself if the AsyncResult is Error else returns null.
Returns a list of all the Errors from an array of AsyncResult items.
Returns a list of all the Errors from a list of AsyncResult items.
Returns a list of all the Errors from a sequence of AsyncResult items.
Returns a list of all the Errors from the given AsyncResult items.
Returns the metadata value from the Error if the AsyncResult is Error, and has metadata or the requested type.
Extracts the value from the AsyncResult if it's a Success, otherwise throws an UnwrapException with the computed message in it.
Extracts the value from the AsyncResult if it's an Error, otherwise throws an UnwrapException with the computed message in it.
Extracts the ErrorId from the AsyncResult if it's an Error with an ErrorId, otherwise throws an UnwrapException with the computed message in it.
Extracts the metadata from the AsyncResult if it's an Error with the metadata of type M, otherwise throws an UnwrapException with the computed message in it.
Extracts the value from the AsyncResult if it's an Error with a Throwable in it, otherwise throws an UnwrapException with the computed message in it.
Alias for skipWhileLoading. Filters out all Loading emissions from this flow.
Returns the current AsyncResult if it matches the given predicate, or an Error if it does not.
Transforms the current AsyncResult to the result of transform if it's a Success, based on its contained value.
Unwraps the AsyncResult inside of the AsyncResult.
Returns a list of all the Errors from a list of AsyncResult items.
Returns a list of all the Throwables inside of Errors from a list of AsyncResult items.
Returns the value if the AsyncResult is Success else returns the default value.
Returns the value if the AsyncResult is Success else returns the result of the transform function.
Returns the value if the AsyncResult is Success else returns an empty list.
Returns the value if the AsyncResult is Success else returns an empty map.
Returns the value if the AsyncResult is Success else returns null.
Obtains the first terminal value of the flow, and if it is a Success, it returns the encapsulated value. Otherwise, it returns null.
Returns the value if the AsyncResult is Success else returns null.
Obtains the first terminal value of the flow, and if it is a Success, it returns the encapsulated value. Otherwise, it throws an exception.
Returns a list of Incomplete items (Loading and NotStarted) from an Array of AsyncResult items.
Returns a list of Incomplete items (Loading and NotStarted) from a list of AsyncResult items.
Returns a list of Incomplete items (Loading and NotStarted) from a Sequence of AsyncResult items.
Returns true if the AsyncResult is Error and the predicate returns true for the throwable.
Returns true if the AsyncResult is Error and the predicate returns true for the throwable and metadata.
Returns true if the AsyncResult is Success and the predicate returns true for the success value.
Transforms the current AsyncResult to the result of transform.
Transforms the Success value via transform. The AsyncResult will change its containing type accordingly.
Returns a list of metadata objects of type T from Errors in a list of AsyncResult items.
Runs the block when the result is Incomplete (Loading or NotStarted).
It invokes the given action before each value of the upstream flow is emitted downstream, IF the emitted value is Incomplete (Loading or NotStarted).
Runs the block when the result is NotStarted.
Transforms the type of AsyncResult from nullable to non-nullable. If the value is null, it will return an Error. It also allows adding specific metadata to disambiguate errors if necessary, via lazyMetadata.
Partitions an array of AsyncResult items into successful values and errors.
Partitions a collection of AsyncResult items into successful values and errors.
Partitions a sequence of AsyncResult items into successful values and errors.
Monad comprehension DSL for AsyncResult.
Creates a Flow of AsyncResult with a DSL that provides explicit success, error, loading, and notStarted emissions.
Retries collecting from the upstream flow when an Error is emitted.
Alias for combine. Converts a List of AsyncResult items into a single AsyncResult containing a List.
Filters out all Loading emissions from this flow, only emitting NotStarted, Success, or Error values.
Spreads a AsyncResult of a Pair into a Pair of AsyncResults.
Spreads a AsyncResult of a Triple into a Triple of AsyncResults.
Returns all Success values from an array of AsyncResult items.
Returns all Success values from a list of AsyncResult items.
Returns all Success values from a sequence of AsyncResult items.
Returns the throwable if the AsyncResult is Error else returns null.
Returns a list of all the Throwables inside of Errors from an Array of AsyncResult items.
Returns a list of all the Throwables inside of Errors from a list of AsyncResult items.
Returns a list of all the Throwables inside of Errors from a Sequence of AsyncResult items.
Extracts the value from the AsyncResult if it's a Success, otherwise throws an UnwrapException.
Extracts the value from the AsyncResult if it's an Error, otherwise throws an UnwrapException.
Extracts the ErrorId from the AsyncResult if it's an Error with an ErrorId, otherwise throws an UnwrapException.
Extracts the metadata from the AsyncResult if it's an Error with metadata of type M, otherwise throws an UnwrapException.
Extracts the value from the AsyncResult if it's an Error with a Throwable, otherwise throws an UnwrapException.
Combines two AsyncResults (result1 and result2) into a single one, by applying the transform to their values.
Combines three AsyncResults (result1, result2, and result3) into a single one, by applying the transform to their values.
Combines two AsyncResults (the receiver and result) into a single one, by applying the transform to their values.
Combines two AsyncResults (the receiver lambda result and the producer lambda) into a single one, by applying the transform to their values.
Combines three AsyncResults (the receiver, result1, and result2) into a single one, by applying the transform to their values.
Combines three AsyncResults (the receiver lambda result, producer1, and producer2) into a single one, by applying the transform to their values.
Combines four AsyncResults (the receiver, result1, result2, and result3) into a single one, by applying the transform to their values.
Combines four AsyncResults (the receiver lambda result, producer1, producer2, and producer3) into a single one, by applying the transform to their values.