java.lang.Object
dev.eidentification.bankid.internal.http.Client
-
Method Summary
Modifier and TypeMethodDescriptionstatic Client
of
(Configuration configuration) Returns aClient
with the given configuration.<R extends Response>
RsendRequest
(Request request, Class<R> responseClazz) Sends the given request synchronously using the HTTP client and returns the response of the specified class.<R extends Response>
CompletableFuture<R> sendRequestAsync
(Request request, Class<R> responseClass) Sends the given request asynchronously using this client with the given response class.
-
Method Details
-
of
Returns aClient
with the given configuration.- Parameters:
configuration
- the configuration- Returns:
- an
Client
- Throws:
BankIdException
- in case of an error
-
sendRequest
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 sentresponseClazz
- the response class type- Returns:
- the response of the specified class
- Throws:
BankIdException
- in case of an unexpected errorBankIdApiErrorException
- in case of an api errorBankIdApiUnexpectedResponseException
- 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>>
-