Resource

public class Resource<T extends Object>

Represents a requested API resource. Resources can be requested successfully, with an error or they can be cancelled.

Types

Link copied to clipboard
public final class Cancelled<T extends Object> extends Resource<T>

The API resource request was cancelled.

Link copied to clipboard
public class Companion
Link copied to clipboard
public final class Error<T extends Object> extends Resource<T>

Holds the unsuccessfully requested API resource's error details.

Link copied to clipboard
public final class Success<T extends Object> extends Resource<T>

Holds the successfully requested API resource's data and HTTP response information.

Functions

Link copied to clipboard
public T getData()
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
public final Resource<U> mapSuccess<U extends Any>(SuspendFunction1<Resource.Success<T>, Resource<U>> block)

Utility method to chain API resource requests by mapping the successful resource request to the resource returned by the block.

Properties

Link copied to clipboard
private final T data
Link copied to clipboard
private final String responseBody
Link copied to clipboard
Link copied to clipboard

Inheritors

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard