restful-android-kotlin
restful-android-kotlin copied to clipboard
New Resource Client
The new idea of Restful Resource Client. The concept is to make it more explicit to follow by remove the Reflection part out and borrow some concepts from Robospice.
RestfulResourceClient
Execute RestRequest
object for connecting to API and Database. The result will be post back with OnDataReceivedEvent
object. When
MovieDBApi
API Interface use with Retrofit. Data classes defined as a Response for each service.
RestRequest
Request class to define how to interact with resources both API and Realm. The LocalRequest
class is used to execute database transactions with Realm and NetworkRequest
class is used to execute Retrofit service. Note that the LocalRequest
may be null to ignore the response that does not need to be saved to Realm (e.g. SignIn/SignUp). Each request will have generated ID (timestamp) to identify itself when the result is send back to UI with EventBus.
ActionExecutor
Class to define how to CRUD with Realm based on given API. Each ActionExecutor
need to implement trait from MovieDBApi
.
OnDataReceivedEvent
Event class to get the result from ResourcefulResourceClient
. Each event will contain requestId
, source
, result
and error
. The source
variable will be used to determine whether the result is come from DATABASE
or NETWORK
. The error
will not be null if there is an error occured