java.lang.Object
dev.eidentification.bankid.internal.http.Client

public class Client extends Object
  • Method Details

    • of

      public static Client of(Configuration configuration)
      Returns a Client with the given configuration.
      Parameters:
      configuration - the configuration
      Returns:
      an Client
      Throws:
      BankIdException - in case of an error
    • sendRequest

      public <R extends Response> R sendRequest(Request request, Class<R> responseClazz)
      Sends the given request synchronously using the HTTP client and returns the response of the specified class.
      Type Parameters:
      R - the response type
      Parameters:
      request - the request to be sent
      responseClazz - the response class type
      Returns:
      the response of the specified class
      Throws:
      BankIdException - in case of an unexpected error
      BankIdApiErrorException - in case of an api error
      BankIdApiUnexpectedResponseException - in case of an unexpected api error
    • sendRequestAsync

      public <R extends Response> CompletableFuture<R> sendRequestAsync(Request request, Class<R> responseClass)
      Sends the given request asynchronously using this client with the given response class.

      Propagates BankIdException in case of error.

      Type Parameters:
      R - the response type
      Parameters:
      request - the request to be sent.
      responseClass - the response class typel
      Returns:
      a CompletableFuture<Response<T>>