Webcom Android SDK Public API Reference / com.orange.webcom.sdkv2 / WebcomResult

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

Failure

data class Failure : WebcomResult<Nothing>

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

Success

data class Success<out T> : WebcomResult<T>

Represents a successful computation with a result of type T.

Properties

failureError

abstract val failureError: WebcomError?

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

Functions

get

abstract fun get(): T

Gets the result of computation when successful, throws otherwise.

getOrElse

abstract fun getOrElse(default: T): T

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

getOrNull

abstract fun getOrNull(): T?

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

isSuccess

abstract fun isSuccess(): Boolean

Indicates whether the computation was successful.

map

abstract fun <U> map(f: (T) -> U): WebcomResult<U>

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

Inheritors

Failure

data class Failure : WebcomResult<Nothing>

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

Success

data class Success<out T> : WebcomResult<T>

Represents a successful computation with a result of type T.