Changing API URLSee original GitHub issue
Is there a way of changing the API URLs? I would like to use this library against an Enterprise GitHub and so I need to change the default URL.
I found that it is implicitly passed to individual constructors of the APIs in
Interpreters.scala, but I have no idea if it can be changed to something else.
Just as a side note, I really like the design of the library in principle, but it is very hard to use for people that don’t have experience with Cats. You should consider either improving the docs (I couldn’t even get the current Getting Started to compile) or providing a higher level API on top, that does not leak the Monad abstractions and underlying libraries.
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
There are somewhat ugly but working hack to change urls:
val clazz = GithubDefaultUrls.getClass val field = clazz.getDeclaredField("defaultUrls") val accessibility = field.isAccessible field.setAccessible(true) field.set( GithubDefaultUrls, GithubApiUrls( "https://api.github.com/", "https://github.com/login/oauth/authorize?client_id=%s&redirect_uri=%s&scope=%s&state=%s", "https://github.com/login/oauth/access_token" ) ) field.setAccessible(accessibility)
It still would be nice to have a proper way to set url’s 😃
I think there is no easy way to change this without breaking current users programs, as there is an explicit import of
GithubDefaultUrls in the
Removing this import breaks the compilation, and adding a new implicit that fixes that in the
Interpreters class argument list forces a change upwards into
Implicits files to allow the user to inject its own