Resource

sealed class Resource<T>

Represents the result of an API operation in the Discovery API.

Holds either successful data or an error with optional data.

Parameters

data

The result data, if available.

error

The error, if an error occurred.

Inheritors

Types

Link copied to clipboard
class Error<T>(throwable: Throwable, data: T? = null) : Resource<T>

Represents a failed API operation.

Link copied to clipboard
class Success<T>(data: T) : Resource<T>

Represents a successful API operation.

Properties

Link copied to clipboard
val data: T? = null
Link copied to clipboard
val error: Throwable? = null

Functions

Link copied to clipboard

Checks if the resource represents an error.

Link copied to clipboard

Checks if the resource represents a successful operation.