fold

inline fun <T, R> HubPayload<T>.fold(onSuccess: (value: T) -> R, onFailure: (error: ErrorPayload) -> R): R

Returns the result of onSuccess for the encapsulated value if this instance represents success or the result of onFailure function for the encapsulated ErrorPayload if it is failure.