freedomotic / fd-android-client

Android Client for Freedomotic v2
GNU General Public License v2.0
7 stars 19 forks source link

Create a connector for consuming Restful APIs on Android client #18

Open mcicolella opened 7 years ago

mcicolella commented 7 years ago

The interaction with our framework is based on a RESTful API https://github.com/freedomotic/freedomotic/tree/master/plugins/devices/restapi-v3/src/main/java/com/freedomotic/plugins/devices/restapiv3 To try it start Freedomotic and point your browser to http://localhost:9111.

In the first prototype of this client we used Retrofit and Robospice.

They should be updated to the last version and the code properly changed. Alternatively you can propose a better solution (if so) with the same goal: interacting with our APIs and receiving updates from backend (for example when an object changes its state).

mcicolella commented 7 years ago

@paulnunezm @paynemiller92 what do you think?

paynemiller92 commented 7 years ago

If version 3 of the Freedomotic API is stable and ready for consumption, I say let's just plug it in and update the app accordingly. Do we have sample requests and responses for each endpoint contained within the API?

I definitely say we continue to use Retrofit and my recommendation is that we use RxJava for event and stream handling.

paulnunezm commented 7 years ago

I'll go with @paynemiller92, Retrofit+RxJava or RxKotlin would be great for this.

mcicolella commented 7 years ago

@paynemiller92 @paulnunezm the API is available and all the doc is served by Swagger. So you have to download the last dailybuild from http://teamcity.jetbrains.com/guestAuth/repository/download/bt1177/.lastSuccessful/freedomotic-5.6.0-%7Bbuild.number%7D.zip, run it and point your browser to http://localhost:9111/ Default credentials are admin/admin. Thanks a lot for your support.

paynemiller92 commented 7 years ago

@mcicolella Thank you for the info!

mcicolella commented 7 years ago

@paynemiller92 I just merged your PR. Sorry but our public API demo isn't available. I updated the docs. You need to work with a local installation of Freedomotic. Anyway the framework is intended to be independent from cloud services. Thanks

paynemiller92 commented 6 years ago

@mcicolella That's a bummer. Is there any way we as contributors can get a development environment set up? We really need to have the ability to validate successful and unsuccessful API calls. It would really be unfortunate if every developer had to stand up their own database and connect it to their own unique instance of the Freedomotic API.

ubaldop commented 6 years ago

@paynemiller92 I guess is enough just downloading and launch the daily build available here. It starts a local API server responding at port 9111. No hussle in creating any local DB then.

paynemiller92 commented 6 years ago

@P3trur0 At least for me, when I launch the API locally, no data exists, which makes it difficult to create a similar environment that our users will have. Also, it's best to not call localhost from Android apps. Emulators may work, with some tweaking, but physical devices cannot connect to a localhost api.

paulnunezm commented 6 years ago

@paynemiller92 @mcicolella I know there's a way to test to mock the results for a non-release environment using mockwebserver and retrofit but we still need to know how is the response going to be like to create the models.

mcicolella commented 6 years ago

@paynemiller92 @paulnunezm I don't know why you can't access APIs locally. Anyway there is a temporarly online demo at http://104.236.92.231:9111/

mcicolella commented 6 years ago

@paynemiller92 @paulnunezm have you tried the online demo?

paynemiller92 commented 6 years ago

@mcicolella Yes, it appears to be functioning properly! I will start integrating some endpoints.

mcicolella commented 6 years ago

@paynemiller92 are you still on this?

paynemiller92 commented 6 years ago

@mcicolella Sorry, took a few months off to due my 9-5 coding obligations! Is this issue still open?

mcicolella commented 6 years ago

Yes it is open.