I’m a bit confused about the relationship between
The context is that I have a library where I want to use the ws client to connect to some web API, and I want to use this library both from a Play application and from a non-Play application, and I’m not sure what dependency to add to that library.
When I see
StandaloneWSClient I immediately think, ok,
WSClient is the interface, and
StandaloneWSClient is one implementation of this, so I’ll use the interface in the library and provide specific implementations in the application (i.e. the library would be exposing
class SomeApiService(ws: WSClient)).
However, when I look at the source I see
trait StandaloneWSClient extends Closeable and
trait WSClient extends Closeable so there is appearently no relationship between the two (except that they can be closed).
Furthermore, there is
trait WSRequest extends StandaloneWSRequest which is the opposite of what I expected.
The fact that they are both defined in
play.api.libs.ws adds to the confusion.
So - which dependency should I add to my library, and which version of the ws client should I use there so that the library could be reused both in a Play and a non-Play application?