Package-level declarations

Types

Link copied to clipboard
interface DataSource<in Request, out Response>

Any asynchronous source of data that provides Response on a call with a Request.

Link copied to clipboard

An action associated with a DataSource identified by a given key. It represents an event that is described by a given payload.

Link copied to clipboard

An action that triggers a DataSource (identified by a given key) call with a given request in a foreground coroutine.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
data class DataSourceResultPayload<Request, Response>(val request: Request, val result: Result<Response>)

Special type of payload that contains a kotlin.Result. It's not associated with DataSourceAction and it's only a util.

Link copied to clipboard
typealias PayloadReducer<State, Payload> = (state: State, payload: Payload) -> State
Link copied to clipboard
interface PureDataSourceKey<out T : DataSource<*, *>>

Identifies a DataSource of type T.

Link copied to clipboard
Link copied to clipboard

The scope for configuring DataSourceResolver with a type-safe DSL.

Functions

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

Returns this as T if it is an instance of DataSourceAction associated with given key.

Link copied to clipboard

Returns this as T if it is an instance of DataSourceAction associated with given key.

Link copied to clipboard

Resolves a DataSource identified by a given key and calls with a given request.

Link copied to clipboard
Link copied to clipboard
inline fun <Request, Response, State> createDataSourceReducer(key: PureDataSourceKey<DataSource<Request, Response>>, crossinline onStart: PayloadReducer<State, DataSourcePayload.Started<Request, Response>> = { s, _ -> s }, noinline onResult: PayloadReducer<State, DataSourceResultPayload<Request, Response>> = { s, _ -> s }, crossinline onElse: Reducer<State> = { s, _ -> s }): Reducer<State>
inline fun <Request, Response, State> createDataSourceReducer(key: PureDataSourceKey<DataSource<Request, Response>>, crossinline onStart: PayloadReducer<State, DataSourcePayload.Started<Request, Response>> = { s, _ -> s }, crossinline onSuccess: PayloadReducer<State, DataSourcePayload.Success<Request, Response>> = { s, _ -> s }, crossinline onFailure: PayloadReducer<State, DataSourcePayload.Failure<Request, Response>> = { s, _ -> s }, crossinline onElse: Reducer<State> = { s, _ -> s }): Reducer<State>

Creates a Reducer that:

Link copied to clipboard
inline fun <Request, Response> DataSource(crossinline block: suspend (Request) -> Response): DataSource<Request, Response>

Creates a DataSource with given block invoked on each DataSource.call.

Link copied to clipboard

Creates a DataSourceResolver with a config with type-safe DSL.

Properties

Link copied to clipboard

Consumes DataSourceCall and launches a DataSource call in a foreground coroutine.

Link copied to clipboard

Returns DataSourceResolver instance associated with a store. It depends on DataSourceResolver element injected into the closure.