Skip to content

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

@marco-eckstein

Description

@marco-eckstein

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions