androidarchitecturemvpclean-architecture

Where to put REST API Calls in Uncle Bob's Clean Architecture?


I'm trying to use Uncle Bob's clean architecture in my android app. So, I followed this guy's great implementation based on RxAndroid, Dagger 2 for DI.
I know that to get data from data stores (Cloud or local db or disk), the Interactors (Use Case classes in the Domain layer) will invoke Repositories in the DATA Layer.

In my case, I have to execute two parallel REST API calls (Foursquare API and Google places API), then, compare the received data from each call.
Do I have to put these Retrofit calls' implementation in the Data layer or inside the Interactors in the Domain layer ?
If any external API call belongs to the data layer, what's exactly the role of interactors in Uncle Bob's approach ?

I'm new to this approach, any help is greatly appreciated!


Solution

  • i think you should call the API in data layer and then process the result in domain layer, of course if the result was independent from any framework.

    and interactors was the one that orchestrate the flow of data to and from the entities. (http://fernandocejas.com/2014/09/03/architecting-android-the-clean-way/)