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 client
P - the proxy class used by the application to call specific endpoints

public class ClientProxyBuilder<A,P> extends Object
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 Details

    • ClientProxyBuilder

      public ClientProxyBuilder()
  • Method Details

    • apiClientCtor

      public ClientProxyBuilder<A,P> apiClientCtor(Supplier<A> apiClientCtor)
    • basePath

      public ClientProxyBuilder<A,P> basePath(URI 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 - the JerseyClientConfiguration instance defining the HTTP client settings
      Returns:
      the current instance of ClientProxyBuilder<A, D> to allow method chaining
    • proxyCtor

      public ClientProxyBuilder<A,P> proxyCtor(Function<A,P> 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

      public P build()