Skip to content
This repository has been archived by the owner on Jul 16, 2022. It is now read-only.

New Resource Client #11

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

Conversation

VerachadW
Copy link
Owner

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants