Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split the project into a reusable client library and the current REST server #42

Open
marco-eckstein opened this issue Apr 4, 2021 · 1 comment

Comments

@marco-eckstein
Copy link

Right now, if I want to implement a client for your API, I have to implement a client for your REST API, i.e., model classes, mappings to JSON and the client class that performs the HTTP requests. While not hard, this is a very tedious task. I need to duplicate most of the code that is already in your project, e.g., EtoroHttpClient and EtoroPosition. I could probably reuse some of your code by depending on the Jar, but that would be very cumbersome, because your code relies on Spring's dependency injection. So I would need to use reflection to construct a EtoroHttpClient instance, e.g.

It would be very handy if you extracted your client into a separate project that could be used as a library and with code akin to:

val client = EtoroHttpClient()
client.login("username", "password")
val positions: List<EtoroPosition> = client.getPositions(TradingMode.REAL)

Your REST API project would then simply depend on that new client library, just as my code.

This client library (or at least parts of it) could even be a Kotlin multiplatform project, i.e. usable not only from JVM languages like Kotlin and Java, but also from JavaScript and other languages.

I would guess that extracting a JVM-only client would not be a lot of work for you. A multiplatform client might be a bit more challenging, but since I have some limited experience with that, I could offer my help.

@mohammadfarari1360
Copy link

Okay

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

No branches or pull requests

2 participants