AdResult

sealed class AdResult<out T>

A wrapper class that represents either a success or a failure.

All public SDK methods that can result in an error use this class to represent the result of the work. You can use it to easily work with and process the results of the SDK.

val result = AdService.makeAdvertisement(adRequest, adEventListener = adEventListener)
result.get(
onSuccess = {
// Do smth with the Advertisement
},
onError = {
// Do smth with the AdError
}
)

Inheritors

Types

Link copied to clipboard
data class Error<T>(val error: AdError) : AdResult<T>

Represents a failed result.

Link copied to clipboard
data class Success<T>(val result: T) : AdResult<T>

Represents a successful result.

Properties

Link copied to clipboard

Boolean flag to determine whether the result is failure.

Link copied to clipboard

Boolean flag to determine whether the result is successful.

Functions

Link copied to clipboard

A method to get the AdError if the operation is completed with an error, or null if the operation is completed successfully.

Link copied to clipboard
fun get(onSuccess: (T) -> Unit, onError: (AdError) -> Unit = {})

The main method for parsing the result.

Link copied to clipboard
fun getOrNull(): T?

A method to get the result of the operation if the operation is completed successfully, or null if an error occurs.