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 WebcomApplication.withAsset or AuthenticationService.unauthenticate, GuestMethod.authenticate... or DatasyncNode.subscribe.

Types

Companion
Link copied to clipboard
object Companion

Provides useful tools for building WebcomResult instances.

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

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

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

Represents a successful computation with a result of type T.

Functions

get
Link copied to clipboard
abstract fun get(): T

Gets the result of computation when successful, throws otherwise.

getOrElse
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.

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

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

isSuccess
Link copied to clipboard
abstract fun isSuccess(): Boolean

Indicates whether the computation was successful.

map
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

failureError
Link copied to clipboard
abstract val failureError: WebcomError?

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

Inheritors

WebcomResult
Link copied to clipboard
WebcomResult
Link copied to clipboard