proximax-storage/java-xpx-chain-sdk

Create central router for requests

Opened this issue · 1 comments

at the moment it is difficult to tell which endpoint is used where and validate that all endpoints are available in the API.

Come up with mechanism that allows

  • central definition of request routing
  • string substitution to use directly openapi definitions
  • lookup of "where do I call this route"
  • assess whether all defined routes are implemented

could use enum
client.get(Router.GET_BLOCK.with(height))

or perhaps even better use static fields that could each have different implementation, allowing for forced API (types and counts of arguments)

public class Router {
   public static final GetByOneArgument<BigInteger> GET_BLOCK = new GetByOneArgument<>("/block/{height}", "{height}");
}

or build the request reactivex style?

client.get(Routes.GET_BLOCK).withHeight(BigInteger.ONE)...