Package-level declarations

Types

Link copied to clipboard
class CacheableFireAndForgetMutationWithInput<TInput : CacheableInput.MutationInput, TError : Throwable>(howTo: suspend (input: TInput) -> Unit, cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default)
class CacheableFireAndForgetMutationWithNoInput<TError : Throwable>(howTo: suspend () -> Unit, cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default)
Link copied to clipboard
data class CacheableFlowResult<TData, TError : Throwable>(val fetchState: FetchState, val error: TError?, val data: TData?) : CacheableResultWithData<TData, TError>

Cacheable flow operations for subscribing to reactive data sources (SSE, WebSockets, etc.) and writing each emission to the cache.

Link copied to clipboard
class CacheableFlowWithInput<TInput : CacheableInput.FlowInput, TData, TError : Throwable>(coroutineScope: CoroutineScope, launchFlow: (input: TInput) -> Flow<TData?>, startingCacheKey: TInput? = null, cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default, ttl: Duration? = null, initialFetchState: FetchState = FetchState.IDLE)
Link copied to clipboard
class CacheableFlowWithNoInput<TData, TError : Throwable>(coroutineScope: CoroutineScope, launchFlow: () -> Flow<TData?>, val cacheKey: CacheableInput.FlowInput, cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default, ttl: Duration? = null, initialFetchState: FetchState = FetchState.IDLE)
Link copied to clipboard
data class CacheableInfiniteQueryResult<TPageParam, TData, TError : Throwable>(val fetchState: FetchState, val error: TError?, val data: List<PagedData<TPageParam?, TData>>? = null, val hasNextPage: Boolean = true, val hasPreviousPage: Boolean = false) : CacheableResultWithData<List<PagedData<TPageParam?, TData>>, TError>
Link copied to clipboard
class CacheableInfiniteQueryWithInput<TInput : CacheableInput.QueryInput, TPageParam, TData, TError : Throwable>(coroutineScope: CoroutineScope, launchQuery: suspend (input: TInput, page: TPageParam?) -> TData?, initialPageParam: TPageParam? = null, getNextPageParam: suspend (pages: List<PagedData<TPageParam?, TData>>) -> PageParam<TPageParam>, getPreviousPageParam: suspend (pages: List<PagedData<TPageParam?, TData>>) -> PageParam<TPageParam>? = null, startingCacheKey: TInput? = null, cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default, ttl: Duration? = null, initialFetchState: FetchState = FetchState.IDLE)
Link copied to clipboard
class CacheableInfiniteQueryWithNoInput<TPageParam, TData, TError : Throwable>(coroutineScope: CoroutineScope, launchQuery: suspend (page: TPageParam?) -> TData?, initialPageParam: TPageParam? = null, getNextPageParam: suspend (pages: List<PagedData<TPageParam?, TData>>) -> PageParam<TPageParam>, getPreviousPageParam: suspend (pages: List<PagedData<TPageParam?, TData>>) -> PageParam<TPageParam>? = null, val cacheKey: CacheableInput.QueryInput, cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default, ttl: Duration? = null, initialFetchState: FetchState = FetchState.IDLE)
Link copied to clipboard
data class CacheableMutationResult<TData, TError : Throwable>(val fetchState: FetchState, val error: TError?, val data: TData?) : CacheableResultWithData<TData, TError>
Link copied to clipboard
class CacheableMutationWithInput<TInput : CacheableInput.MutationInput, TData, TError : Throwable>(launchMutation: suspend (input: TInput) -> TData?, cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default)
Link copied to clipboard
class CacheableMutationWithNoInput<TData, TError : Throwable>(launchMutation: suspend () -> TData?, cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default)
Link copied to clipboard

Interface for query-like results used in the compose layer.

Link copied to clipboard
data class CacheableQueryResult<TData, TError : Throwable>(val fetchState: FetchState, val error: TError?, val data: TData?) : CacheableResultWithData<TData, TError>
Link copied to clipboard
class CacheableQueryWithInput<TInput : CacheableInput.QueryInput, TData, TError : Throwable>(coroutineScope: CoroutineScope, launchQuery: suspend (input: TInput) -> TData?, startingCacheKey: TInput? = null, cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default, ttl: Duration? = null, initialFetchState: FetchState = FetchState.IDLE)
Link copied to clipboard
class CacheableQueryWithNoInput<TData, TError : Throwable>(coroutineScope: CoroutineScope, launchQuery: suspend () -> TData?, val cacheKey: CacheableInput.QueryInput, cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default, ttl: Duration? = null, initialFetchState: FetchState = FetchState.IDLE)
Link copied to clipboard

Base interface for all cacheable operation results. Provides the fetch state and error information.

Link copied to clipboard

Extended result interface that includes data. All results with data (query, mutation, flow, infinite query) implement this.

Link copied to clipboard

Property to determine the fetch state of your data

Link copied to clipboard
class FireAndForgetMutationFactoryWithInput<TInput : CacheableInput.MutationInput, TError : Throwable>(cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default, mutation: suspend (input: TInput) -> Unit)
Link copied to clipboard
class FireAndForgetMutationFactoryWithNoInput<TError : Throwable>(cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default, mutation: suspend () -> Unit)
Link copied to clipboard
class FlowFactoryWithInput<TInput : CacheableInput.FlowInput, TData, TError : Throwable>(cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default, ttl: Duration? = null, flow: (input: TInput) -> Flow<TData>)

Factory for creating CacheableFlowWithInput instances.

Link copied to clipboard
class FlowFactoryWithNoInput<TData, TError : Throwable>(cache: OnHandCache, cacheKey: CacheableInput.FlowInput, dispatcher: CoroutineDispatcher = Dispatchers.Default, ttl: Duration? = null, flow: () -> Flow<TData>)

Factory for creating CacheableFlowWithNoInput instances.

Link copied to clipboard
class InfiniteQueryFactoryWithInput<TInput : CacheableInput.QueryInput, TPageParam, TData, TError : Throwable>(cache: OnHandCache, initialPageParam: TPageParam? = null, getNextPageParam: suspend (pages: List<PagedData<TPageParam?, TData>>) -> PageParam<TPageParam>, getPreviousPageParam: suspend (pages: List<PagedData<TPageParam?, TData>>) -> PageParam<TPageParam>? = null, dispatcher: CoroutineDispatcher = Dispatchers.Default, ttl: Duration? = null, query: suspend (input: TInput, page: TPageParam?) -> TData?)
Link copied to clipboard
class InfiniteQueryFactoryWithNoInput<TPageParam, TData, TError : Throwable>(cache: OnHandCache, cacheKey: CacheableInput.QueryInput, initialPageParam: TPageParam? = null, getNextPageParam: suspend (pages: List<PagedData<TPageParam?, TData>>) -> PageParam<TPageParam>, getPreviousPageParam: suspend (pages: List<PagedData<TPageParam?, TData>>) -> PageParam<TPageParam>? = null, dispatcher: CoroutineDispatcher = Dispatchers.Default, ttl: Duration? = null, query: suspend (page: TPageParam?) -> TData?)
Link copied to clipboard
class MutationFactoryWithInput<TInput : CacheableInput.MutationInput, TData, TError : Throwable>(cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default, mutation: suspend (input: TInput) -> TData)
Link copied to clipboard
class MutationFactoryWithNoInput<TData, TError : Throwable>(cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default, mutation: suspend () -> TData)
Link copied to clipboard
data class PagedData<TPageParam, TData>(val page: TPageParam, val data: TData?)
Link copied to clipboard
sealed class PageParam<out T>

Sealed type for representing the next or previous page param in infinite queries. Use Value to signal that a page is available to fetch, and None to signal that no more pages exist in that direction.

Link copied to clipboard
class QueryFactoryWithInput<TInput : CacheableInput.QueryInput, TData, TError : Throwable>(cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default, ttl: Duration? = null, query: suspend (input: TInput) -> TData)

Factory for creating CacheableQueryWithInput instances.

Link copied to clipboard
class QueryFactoryWithNoInput<TData, TError : Throwable>(cache: OnHandCache, cacheKey: CacheableInput.QueryInput, dispatcher: CoroutineDispatcher = Dispatchers.Default, ttl: Duration? = null, query: suspend () -> TData)

Factory for creating CacheableQueryWithNoInput instances.

Properties

Link copied to clipboard

Convenience property to know if your cache already has data. This can be helpful with optimistic updates so that you don't always show a spinner if there is cache information already, but you are doing a fetch operation

Functions

Link copied to clipboard
fun <TInput : CacheableInput.FlowInput, TData, TError : Throwable> flowFactoryOf(cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default, ttl: Duration? = null, flow: (input: TInput) -> Flow<TData>): FlowFactoryWithInput<TInput, TData, TError>
fun <TInput : CacheableInput.FlowInput, TData, TError : Throwable> flowFactoryOf(cache: OnHandCache, cacheKey: TInput, dispatcher: CoroutineDispatcher = Dispatchers.Default, ttl: Duration? = null, flow: () -> Flow<TData>): FlowFactoryWithNoInput<TData, TError>
Link copied to clipboard
fun <TInput : CacheableInput.QueryInput, TPageParam, TData, TError : Throwable> infiniteQueryFactoryOf(cache: OnHandCache, initialPageParam: TPageParam? = null, getNextPageParam: suspend (pages: List<PagedData<TPageParam?, TData>>) -> PageParam<TPageParam>, getPreviousPageParam: suspend (pages: List<PagedData<TPageParam?, TData>>) -> PageParam<TPageParam>? = null, dispatcher: CoroutineDispatcher = Dispatchers.Default, ttl: Duration? = null, query: suspend (input: TInput, page: TPageParam?) -> TData?): InfiniteQueryFactoryWithInput<TInput, TPageParam, TData, TError>
fun <TPageParam, TData, TError : Throwable> infiniteQueryFactoryOf(cache: OnHandCache, cacheKey: CacheableInput.QueryInput, initialPageParam: TPageParam? = null, getNextPageParam: suspend (pages: List<PagedData<TPageParam?, TData>>) -> PageParam<TPageParam>, getPreviousPageParam: suspend (pages: List<PagedData<TPageParam?, TData>>) -> PageParam<TPageParam>? = null, dispatcher: CoroutineDispatcher = Dispatchers.Default, ttl: Duration? = null, query: suspend (page: TPageParam?) -> TData?): InfiniteQueryFactoryWithNoInput<TPageParam, TData, TError>
Link copied to clipboard
fun <TData, TError : Throwable> mutationFactoryOf(cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default, query: suspend () -> TData): MutationFactoryWithNoInput<TData, TError>
fun <TInput : CacheableInput.MutationInput, TData, TError : Throwable> mutationFactoryOf(cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default, query: suspend (input: TInput) -> TData): MutationFactoryWithInput<TInput, TData, TError>
Link copied to clipboard
fun <TError : Throwable> mutationFactoryWithNoOutputOf(cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default, query: suspend () -> Unit): FireAndForgetMutationFactoryWithNoInput<TError>
fun <TInput : CacheableInput.MutationInput, TError : Throwable> mutationFactoryWithNoOutputOf(cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default, query: suspend (input: TInput) -> Unit): FireAndForgetMutationFactoryWithInput<TInput, TError>
Link copied to clipboard
fun <TInput : CacheableInput.QueryInput, TData, TError : Throwable> queryFactoryOf(cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default, ttl: Duration? = null, query: suspend (input: TInput) -> TData): QueryFactoryWithInput<TInput, TData, TError>
fun <TInput : CacheableInput.QueryInput, TData, TError : Throwable> queryFactoryOf(cache: OnHandCache, cacheKey: TInput, dispatcher: CoroutineDispatcher = Dispatchers.Default, ttl: Duration? = null, query: suspend () -> TData): QueryFactoryWithNoInput<TData, TError>