Package nl.knaw.dans.lib.util
Class ClientProxyBuilder<A,P>
java.lang.Object
nl.knaw.dans.lib.util.ClientProxyBuilder<A,P>
- Type Parameters:
A- the ApiClient class that serves as an intermediary between the proxy and the underlying HTTP clientP- the proxy class used by the application to call specific endpoints
Builder for creating a client proxy for an API endpoint. This is some boilerplate code needed to connect the http client (e.g., Jersey) to the classes generated by OpenAPI Generator.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapiClientCtor(Supplier<A> apiClientCtor) Sets the base URI of the API.build()httpClient(io.dropwizard.client.JerseyClientConfiguration httpClient) Sets the Jersey HTTP client configuration to be used for API interactions.Sets the constructor for the proxy to build.
-
Constructor Details
-
ClientProxyBuilder
public ClientProxyBuilder()
-
-
Method Details
-
apiClientCtor
-
basePath
Sets the base URI of the API.- Parameters:
basePath- the base URI to be used for constructing API endpoints- Returns:
- the current instance of
ClientProxyBuilder<A, D>for method chaining
-
httpClient
public ClientProxyBuilder<A,P> httpClient(io.dropwizard.client.JerseyClientConfiguration httpClient) Sets the Jersey HTTP client configuration to be used for API interactions.- Parameters:
httpClient- theJerseyClientConfigurationinstance defining the HTTP client settings- Returns:
- the current instance of
ClientProxyBuilder<A, D>to allow method chaining
-
proxyCtor
Sets the constructor for the proxy to build.- Parameters:
proxyCtor- the P constructor function that takes an instance of A.- Returns:
- the current instance of
ClientProxyBuilder<A, D>to allow method chaining
-
build
-