uniflow-core
Module Contents
alltypes
Module Contents
class
Action
Module Contents
Action
(
onSuccess
:
ActionFunction
,
onError
:
ActionErrorFunction
,
targetState
:
KClass
<
out
UIState
>
?
=
null
)
val
onError
:
ActionErrorFunction
val
onSuccess
:
ActionFunction
val
targetState
:
KClass
<
out
UIState
>
?
class
ActionDispatcher
Module Contents
ActionDispatcher
(
reducer
:
ActionReducer
,
runError
:
suspend
(
Exception
,
UIState
)
->
Unit
,
tag
:
String
)
fun
actionOn
(
kClass
:
KClass
<
out
UIState
>
,
onAction
:
ActionFunction
)
:
Unit
fun
actionOn
(
kClass
:
KClass
<
out
UIState
>
,
onAction
:
ActionFunction
,
onError
:
ActionErrorFunction
)
:
Unit
fun
close
(
)
:
Unit
fun
dispatchAction
(
onAction
:
ActionFunction
)
:
Unit
fun
dispatchAction
(
onAction
:
ActionFunction
,
onError
:
ActionErrorFunction
)
:
Unit
fun
dispatchAction
(
action
:
Action
)
:
Unit
val
tag
:
String
typealias
ActionErrorFunction
=
suspend
(
Exception
,
UIState
)
->
Unit
typealias
ActionErrorFunction_T
<
T
>
=
suspend
(
Exception
,
T
)
->
Unit
typealias
ActionFunction
=
suspend
(
UIState
)
->
Unit
typealias
ActionFunction_T
<
T
>
=
suspend
(
T
)
->
Unit
open
class
ActionReducer
Module Contents
ActionReducer
(
defaultPublisher
:
(
)
->
DataPublisher
,
coroutineScope
:
CoroutineScope
,
defaultDispatcher
:
CoroutineDispatcher
,
defaultCapacity
:
Int
=
Channel.BUFFERED
,
tag
:
String
)
fun
close
(
)
:
Unit
open
fun
enqueueAction
(
action
:
Action
)
:
Unit
class
ApplicationDispatchers
:
UniFlowDispatcherConfiguration
Module Contents
ApplicationDispatchers
(
)
fun
default
(
)
:
CoroutineDispatcher
fun
io
(
)
:
CoroutineDispatcher
fun
main
(
)
:
MainCoroutineDispatcher
class
BadOrWrongStateException
:
Exception
Module Contents
BadOrWrongStateException
(
state
:
UIState
,
requiredState
:
KClass
<
out
UIState
>
)
class
DatabaseException
:
UIError
Module Contents
DatabaseException
(
message
:
String
?
=
null
,
error
:
Throwable
?
=
null
)
data
class
DatabaseRequestFailure
:
UIEvent
Module Contents
DatabaseRequestFailure
(
error
:
Exception
)
val
error
:
Exception
interface
DataFlow
Module Contents
open
fun
action
(
onAction
:
ActionFunction
)
:
Unit
open
fun
action
(
onAction
:
ActionFunction
,
onError
:
ActionErrorFunction
)
:
Unit
abstract
val
actionDispatcher
:
ActionDispatcher
abstract
val
coroutineScope
:
CoroutineScope
abstract
fun
defaultPublisher
(
)
:
DataPublisher
open
suspend
fun
onError
(
error
:
Exception
,
currentState
:
UIState
)
:
Unit
abstract
val
tag
:
String
interface
DataPublisher
:
StatePublisher
,
EventPublisher
Module Contents
open
suspend
fun
notifyStateUpdate
(
state
:
UIState
,
event
:
UIEvent
)
:
Unit
class
DebugMessageLogger
:
SimpleMessageLogger
Module Contents
DebugMessageLogger
(
)
class
EmptyLogger
:
Logger
Module Contents
EmptyLogger
(
)
fun
debug
(
message
:
String
)
:
Unit
fun
log
(
message
:
String
)
:
Unit
fun
logError
(
errorMessage
:
String
,
error
:
Exception
?
)
:
Unit
fun
logEvent
(
event
:
UIEvent
)
:
Unit
fun
logState
(
state
:
UIState
)
:
Unit
data
class
Event
<
out
T
:
UIEvent
>
Module Contents
Event
(
id
:
String
=
UUID.randomUUID().toString()
,
content
:
T
)
val
content
:
T
fun
getContentForConsumer
(
consumer
:
EventConsumer
)
:
UIEvent
?
val
id
:
String
data
class
EventConsumer
Module Contents
EventConsumer
(
id
:
String
)
val
id
:
String
fun
onEvent
(
event
:
Event
<
UIEvent
>
)
:
UIEvent
?
interface
EventPublisher
Module Contents
abstract
suspend
fun
publishEvent
(
event
:
UIEvent
)
:
Unit
open
suspend
fun
sendEvent
(
event
:
UIEvent
)
:
Unit
open
suspend
fun
sendEvent
(
event
:
(
)
->
UIEvent
)
:
Unit
kotlin.Throwable
Module Contents
fun
Throwable
.
toUIError
(
)
:
UIError
kotlinx.coroutines.CoroutineScope
Module Contents
fun
CoroutineScope
.
launchOnDefault
(
block
:
suspend
CoroutineScope
.
(
)
->
Unit
)
:
Job
fun
CoroutineScope
.
launchOnIO
(
block
:
suspend
CoroutineScope
.
(
)
->
Unit
)
:
Job
fun
CoroutineScope
.
launchOnMain
(
block
:
suspend
CoroutineScope
.
(
)
->
Unit
)
:
Job
interface
Logger
Module Contents
abstract
fun
debug
(
message
:
String
)
:
Unit
abstract
fun
log
(
message
:
String
)
:
Unit
abstract
fun
logError
(
errorMessage
:
String
,
error
:
Exception
?
=
null
)
:
Unit
abstract
fun
logEvent
(
event
:
UIEvent
)
:
Unit
abstract
fun
logState
(
state
:
UIState
)
:
Unit
class
NetworkException
:
UIError
Module Contents
NetworkException
(
message
:
String
?
=
null
,
error
:
Throwable
?
=
null
)
data
class
NetworkRequestFailure
:
UIEvent
Module Contents
NetworkRequestFailure
(
error
:
Exception
)
val
error
:
Exception
open
class
SimpleMessageLogger
:
Logger
Module Contents
SimpleMessageLogger
(
tag
:
String
=
TAG
,
showDebug
:
Boolean
=
false
)
open
fun
debug
(
message
:
String
)
:
Unit
open
fun
log
(
message
:
String
)
:
Unit
open
fun
logError
(
errorMessage
:
String
,
error
:
Exception
?
)
:
Unit
open
fun
logEvent
(
event
:
UIEvent
)
:
Unit
open
fun
logState
(
state
:
UIState
)
:
Unit
val
showDebug
:
Boolean
val
tag
:
String
interface
StatePublisher
Module Contents
abstract
fun
getState
(
)
:
UIState
abstract
suspend
fun
publishState
(
state
:
UIState
,
pushStateUpdate
:
Boolean
=
true
)
:
Unit
open
suspend
fun
setState
(
state
:
UIState
)
:
Unit
open
suspend
fun
setState
(
state
:
(
)
->
UIState
)
:
Unit
interface
UIData
:
Serializable
open
class
UIError
Module Contents
UIError
(
message
:
String
?
=
null
)
UIError
(
message
:
String
?
=
null
,
throwable
:
Throwable
?
=
null
)
UIError
(
message
:
String
?
=
null
,
cause
:
UIError
?
=
null
)
val
cause
:
UIError
?
open
fun
equals
(
other
:
Any
?
)
:
Boolean
open
fun
hashCode
(
)
:
Int
val
message
:
String
?
var
origin
:
Throwable
?
open
fun
toString
(
)
:
String
open
class
UIEvent
:
UIData
Module Contents
UIEvent
(
)
data
class
BadOrWrongState
:
UIEvent
Module Contents
BadOrWrongState
(
currentState
:
UIState
)
val
currentState
:
UIState
data
class
Error
:
UIEvent
Module Contents
Error
(
message
:
String
?
=
null
)
Error
(
message
:
String
?
=
null
,
error
:
Throwable
?
=
null
,
state
:
UIState
?
=
null
)
Error
(
message
:
String
?
=
null
,
error
:
UIError
?
=
null
,
state
:
UIState
?
=
null
)
val
error
:
UIError
?
val
message
:
String
?
val
state
:
UIState
?
object
Loading
:
UIEvent
Module Contents
fun
toString
(
)
:
String
data
class
StateUpdate
:
UIEvent
Module Contents
StateUpdate
(
currentState
:
UIState
)
val
currentState
:
UIState
object
Success
:
UIEvent
Module Contents
fun
toString
(
)
:
String
open
class
UIState
:
UIData
Module Contents
UIState
(
)
object
Empty
:
UIState
Module Contents
fun
toString
(
)
:
String
data
class
Failed
:
UIState
Module Contents
Failed
(
message
:
String
?
=
null
)
Failed
(
message
:
String
?
=
null
,
state
:
UIState
?
=
null
)
Failed
(
message
:
String
?
=
null
,
error
:
Throwable
?
=
null
,
state
:
UIState
?
=
null
)
Failed
(
message
:
String
?
=
null
,
error
:
Exception
?
=
null
,
state
:
UIState
?
=
null
)
Failed
(
message
:
String
?
=
null
,
error
:
UIError
?
=
null
,
state
:
UIState
?
=
null
)
val
error
:
UIError
?
val
message
:
String
?
val
state
:
UIState
?
object
Loading
:
UIState
Module Contents
fun
toString
(
)
:
String
object
Success
:
UIState
Module Contents
fun
toString
(
)
:
String
object
UniFlowDispatcher
Module Contents
var
dispatcher
:
UniFlowDispatcherConfiguration
interface
UniFlowDispatcherConfiguration
Module Contents
abstract
fun
default
(
)
:
CoroutineDispatcher
abstract
fun
io
(
)
:
CoroutineDispatcher
abstract
fun
main
(
)
:
CoroutineDispatcher
object
UniFlowLogger
:
Logger
Module Contents
fun
debug
(
message
:
String
)
:
Unit
fun
default
(
)
:
Unit
fun
empty
(
)
:
Unit
const
val
FUN_TAG
:
String
fun
init
(
logger
:
Logger
)
:
Unit
fun
log
(
message
:
String
)
:
Unit
fun
logError
(
errorMessage
:
String
,
error
:
Exception
?
)
:
Unit
fun
logEvent
(
event
:
UIEvent
)
:
Unit
var
logger
:
Logger
fun
logState
(
state
:
UIState
)
:
Unit
const
val
TAG
:
String
package
io.uniflow.core.coroutines
Module Contents
fun
<
T
>
DataFlow
.
onFlow
(
flow
:
(
)
->
Flow
<
T
>
,
doAction
:
suspend
UIState
.
(
T
)
->
Unit
)
:
Job
fun
<
T
>
DataFlow
.
onFlow
(
flow
:
(
)
->
Flow
<
T
>
,
doAction
:
suspend
UIState
.
(
T
)
->
Unit
,
onError
:
ActionErrorFunction
)
:
Job
package
io.uniflow.core.dispatcher
Module Contents
class
ApplicationDispatchers
:
UniFlowDispatcherConfiguration
Module Contents
ApplicationDispatchers
(
)
fun
default
(
)
:
CoroutineDispatcher
fun
io
(
)
:
CoroutineDispatcher
fun
main
(
)
:
MainCoroutineDispatcher
object
UniFlowDispatcher
Module Contents
var
dispatcher
:
UniFlowDispatcherConfiguration
interface
UniFlowDispatcherConfiguration
Module Contents
abstract
fun
default
(
)
:
CoroutineDispatcher
abstract
fun
io
(
)
:
CoroutineDispatcher
abstract
fun
main
(
)
:
CoroutineDispatcher
package
io.uniflow.core.flow
Module Contents
class
Action
Module Contents
Action
(
onSuccess
:
ActionFunction
,
onError
:
ActionErrorFunction
,
targetState
:
KClass
<
out
UIState
>
?
=
null
)
val
onError
:
ActionErrorFunction
val
onSuccess
:
ActionFunction
val
targetState
:
KClass
<
out
UIState
>
?
class
ActionDispatcher
Module Contents
ActionDispatcher
(
reducer
:
ActionReducer
,
runError
:
suspend
(
Exception
,
UIState
)
->
Unit
,
tag
:
String
)
fun
actionOn
(
kClass
:
KClass
<
out
UIState
>
,
onAction
:
ActionFunction
)
:
Unit
fun
actionOn
(
kClass
:
KClass
<
out
UIState
>
,
onAction
:
ActionFunction
,
onError
:
ActionErrorFunction
)
:
Unit
fun
close
(
)
:
Unit
fun
dispatchAction
(
onAction
:
ActionFunction
)
:
Unit
fun
dispatchAction
(
onAction
:
ActionFunction
,
onError
:
ActionErrorFunction
)
:
Unit
fun
dispatchAction
(
action
:
Action
)
:
Unit
val
tag
:
String
typealias
ActionErrorFunction
=
suspend
(
Exception
,
UIState
)
->
Unit
typealias
ActionErrorFunction_T
<
T
>
=
suspend
(
Exception
,
T
)
->
Unit
typealias
ActionFunction
=
suspend
(
UIState
)
->
Unit
typealias
ActionFunction_T
<
T
>
=
suspend
(
T
)
->
Unit
inline
fun
<
reified
T
:
UIState
>
DataFlow
.
actionOn
(
noinline
onAction
:
ActionFunction_T
<
T
>
)
:
Unit
inline
fun
<
reified
T
:
UIState
>
DataFlow
.
actionOn
(
noinline
onAction
:
ActionFunction_T
<
T
>
,
noinline
onError
:
ActionErrorFunction_T
<
T
>
)
:
Unit
open
class
ActionReducer
Module Contents
ActionReducer
(
defaultPublisher
:
(
)
->
DataPublisher
,
coroutineScope
:
CoroutineScope
,
defaultDispatcher
:
CoroutineDispatcher
,
defaultCapacity
:
Int
=
Channel.BUFFERED
,
tag
:
String
)
fun
close
(
)
:
Unit
open
fun
enqueueAction
(
action
:
Action
)
:
Unit
interface
DataFlow
Module Contents
open
fun
action
(
onAction
:
ActionFunction
)
:
Unit
open
fun
action
(
onAction
:
ActionFunction
,
onError
:
ActionErrorFunction
)
:
Unit
abstract
val
actionDispatcher
:
ActionDispatcher
abstract
val
coroutineScope
:
CoroutineScope
abstract
fun
defaultPublisher
(
)
:
DataPublisher
open
suspend
fun
onError
(
error
:
Exception
,
currentState
:
UIState
)
:
Unit
abstract
val
tag
:
String
interface
DataPublisher
:
StatePublisher
,
EventPublisher
Module Contents
open
suspend
fun
notifyStateUpdate
(
state
:
UIState
,
event
:
UIEvent
)
:
Unit
interface
EventPublisher
Module Contents
abstract
suspend
fun
publishEvent
(
event
:
UIEvent
)
:
Unit
open
suspend
fun
sendEvent
(
event
:
UIEvent
)
:
Unit
open
suspend
fun
sendEvent
(
event
:
(
)
->
UIEvent
)
:
Unit
inline
fun
<
reified
T
:
UIState
>
StatePublisher
.
getStateOrNull
(
)
:
T
?
inline
fun
<
reified
T
:
UIState
,
R
:
Any
>
StatePublisher
.
letOnState
(
code
:
(
T
)
->
R
)
:
R
?
inline
fun
<
reified
T
:
UIState
>
StatePublisher
.
onState
(
code
:
(
T
)
->
Unit
)
:
Unit
interface
StatePublisher
Module Contents
abstract
fun
getState
(
)
:
UIState
abstract
suspend
fun
publishState
(
state
:
UIState
,
pushStateUpdate
:
Boolean
=
true
)
:
Unit
open
suspend
fun
setState
(
state
:
UIState
)
:
Unit
open
suspend
fun
setState
(
state
:
(
)
->
UIState
)
:
Unit
package
io.uniflow.core.flow.data
Module Contents
data
class
Event
<
out
T
:
UIEvent
>
Module Contents
Event
(
id
:
String
=
UUID.randomUUID().toString()
,
content
:
T
)
val
content
:
T
fun
getContentForConsumer
(
consumer
:
EventConsumer
)
:
UIEvent
?
val
id
:
String
data
class
EventConsumer
Module Contents
EventConsumer
(
id
:
String
)
val
id
:
String
fun
onEvent
(
event
:
Event
<
UIEvent
>
)
:
UIEvent
?
kotlin.Throwable
Module Contents
fun
Throwable
.
toUIError
(
)
:
UIError
interface
UIData
:
Serializable
open
class
UIError
Module Contents
UIError
(
message
:
String
?
=
null
)
UIError
(
message
:
String
?
=
null
,
throwable
:
Throwable
?
=
null
)
UIError
(
message
:
String
?
=
null
,
cause
:
UIError
?
=
null
)
val
cause
:
UIError
?
open
fun
equals
(
other
:
Any
?
)
:
Boolean
open
fun
hashCode
(
)
:
Int
val
message
:
String
?
var
origin
:
Throwable
?
open
fun
toString
(
)
:
String
open
class
UIEvent
:
UIData
Module Contents
UIEvent
(
)
data
class
BadOrWrongState
:
UIEvent
Module Contents
BadOrWrongState
(
currentState
:
UIState
)
val
currentState
:
UIState
data
class
Error
:
UIEvent
Module Contents
Error
(
message
:
String
?
=
null
)
Error
(
message
:
String
?
=
null
,
error
:
Throwable
?
=
null
,
state
:
UIState
?
=
null
)
Error
(
message
:
String
?
=
null
,
error
:
UIError
?
=
null
,
state
:
UIState
?
=
null
)
val
error
:
UIError
?
val
message
:
String
?
val
state
:
UIState
?
object
Loading
:
UIEvent
Module Contents
fun
toString
(
)
:
String
data
class
StateUpdate
:
UIEvent
Module Contents
StateUpdate
(
currentState
:
UIState
)
val
currentState
:
UIState
object
Success
:
UIEvent
Module Contents
fun
toString
(
)
:
String
open
class
UIState
:
UIData
Module Contents
UIState
(
)
object
Empty
:
UIState
Module Contents
fun
toString
(
)
:
String
data
class
Failed
:
UIState
Module Contents
Failed
(
message
:
String
?
=
null
)
Failed
(
message
:
String
?
=
null
,
state
:
UIState
?
=
null
)
Failed
(
message
:
String
?
=
null
,
error
:
Throwable
?
=
null
,
state
:
UIState
?
=
null
)
Failed
(
message
:
String
?
=
null
,
error
:
Exception
?
=
null
,
state
:
UIState
?
=
null
)
Failed
(
message
:
String
?
=
null
,
error
:
UIError
?
=
null
,
state
:
UIState
?
=
null
)
val
error
:
UIError
?
val
message
:
String
?
val
state
:
UIState
?
object
Loading
:
UIState
Module Contents
fun
toString
(
)
:
String
object
Success
:
UIState
Module Contents
fun
toString
(
)
:
String
package
io.uniflow.core.flow.error
Module Contents
class
BadOrWrongStateException
:
Exception
Module Contents
BadOrWrongStateException
(
state
:
UIState
,
requiredState
:
KClass
<
out
UIState
>
)
class
DatabaseException
:
UIError
Module Contents
DatabaseException
(
message
:
String
?
=
null
,
error
:
Throwable
?
=
null
)
data
class
DatabaseRequestFailure
:
UIEvent
Module Contents
DatabaseRequestFailure
(
error
:
Exception
)
val
error
:
Exception
fun
UIState.Failed
.
isDatabaseError
(
)
:
Boolean
fun
UIState.Failed
.
isNetworkError
(
)
:
Boolean
class
NetworkException
:
UIError
Module Contents
NetworkException
(
message
:
String
?
=
null
,
error
:
Throwable
?
=
null
)
data
class
NetworkRequestFailure
:
UIEvent
Module Contents
NetworkRequestFailure
(
error
:
Exception
)
val
error
:
Exception
package
io.uniflow.core.logger
Module Contents
class
DebugMessageLogger
:
SimpleMessageLogger
Module Contents
DebugMessageLogger
(
)
class
EmptyLogger
:
Logger
Module Contents
EmptyLogger
(
)
fun
debug
(
message
:
String
)
:
Unit
fun
log
(
message
:
String
)
:
Unit
fun
logError
(
errorMessage
:
String
,
error
:
Exception
?
)
:
Unit
fun
logEvent
(
event
:
UIEvent
)
:
Unit
fun
logState
(
state
:
UIState
)
:
Unit
interface
Logger
Module Contents
abstract
fun
debug
(
message
:
String
)
:
Unit
abstract
fun
log
(
message
:
String
)
:
Unit
abstract
fun
logError
(
errorMessage
:
String
,
error
:
Exception
?
=
null
)
:
Unit
abstract
fun
logEvent
(
event
:
UIEvent
)
:
Unit
abstract
fun
logState
(
state
:
UIState
)
:
Unit
open
class
SimpleMessageLogger
:
Logger
Module Contents
SimpleMessageLogger
(
tag
:
String
=
TAG
,
showDebug
:
Boolean
=
false
)
open
fun
debug
(
message
:
String
)
:
Unit
open
fun
log
(
message
:
String
)
:
Unit
open
fun
logError
(
errorMessage
:
String
,
error
:
Exception
?
)
:
Unit
open
fun
logEvent
(
event
:
UIEvent
)
:
Unit
open
fun
logState
(
state
:
UIState
)
:
Unit
val
showDebug
:
Boolean
val
tag
:
String
object
UniFlowLogger
:
Logger
Module Contents
fun
debug
(
message
:
String
)
:
Unit
fun
default
(
)
:
Unit
fun
empty
(
)
:
Unit
const
val
FUN_TAG
:
String
fun
init
(
logger
:
Logger
)
:
Unit
fun
log
(
message
:
String
)
:
Unit
fun
logError
(
errorMessage
:
String
,
error
:
Exception
?
)
:
Unit
fun
logEvent
(
event
:
UIEvent
)
:
Unit
var
logger
:
Logger
fun
logState
(
state
:
UIState
)
:
Unit
const
val
TAG
:
String
package
io.uniflow.core.threading
Module Contents
kotlinx.coroutines.CoroutineScope
Module Contents
fun
CoroutineScope
.
launchOnDefault
(
block
:
suspend
CoroutineScope
.
(
)
->
Unit
)
:
Job
fun
CoroutineScope
.
launchOnIO
(
block
:
suspend
CoroutineScope
.
(
)
->
Unit
)
:
Job
fun
CoroutineScope
.
launchOnMain
(
block
:
suspend
CoroutineScope
.
(
)
->
Unit
)
:
Job
suspend
fun
<
T
>
onDefault
(
block
:
suspend
CoroutineScope
.
(
)
->
T
)
:
T
suspend
fun
<
T
>
onIO
(
block
:
suspend
CoroutineScope
.
(
)
->
T
)
:
T
suspend
fun
<
T
>
onMain
(
immediate
:
Boolean
=
false
,
block
:
suspend
CoroutineScope
.
(
)
->
T
)
:
T