WebcomResult

sealed class WebcomResult<out T>

Wraps the result of a computation of type T.

It is typically used for implementing callbacks that may fail in various methods such as AuthenticationService.unauthenticate, GuestMethod.authenticate... or DatasyncNode.subscribe.

Types

Link copied to clipboard
object Companion

Provides useful tools for building WebcomResult instances.

Link copied to clipboard
data class Failure : WebcomResult<Nothing>

Represents a failed computation with an error that originated the failure.

Link copied to clipboard
open class Success<out T> : WebcomResult<T>

Represents a successful computation with a result of type T.

Functions

Link copied to clipboard
abstract fun get(): T

Gets the result of computation when successful, throws otherwise.

Link copied to clipboard
abstract fun getOrElse(default: @UnsafeVariance T): T

Gets the result of the computation when successful, or a given default value otherwise.

Link copied to clipboard
abstract fun getOrNull(): T?

Gets the result of the computation when successful, or null otherwise.

Link copied to clipboard
abstract fun isSuccess(): Boolean

Indicates whether the computation was successful.

Link copied to clipboard
abstract fun <U> map(f: (T) -> U): WebcomResult<U>

Maps the result of this computation using the given f function.

Properties

Link copied to clipboard
abstract val failureError: WebcomError?

Gets the error of computation when failed, or null otherwise.

Inheritors

Link copied to clipboard
Link copied to clipboard