Package io.hanko.sdk.http
Class HankoHttpClient
java.lang.Object
io.hanko.sdk.http.HankoHttpClientBase
io.hanko.sdk.http.HankoHttpClient
Main
HankoHttpClientBase extension providing methods aligned with HTTP verbs/operations
used with the Hanko API. Handles API error responses.-
Constructor Summary
ConstructorsConstructorDescriptionHankoHttpClient(HankoClientConfig config)Construct a HankoHttpClient.HankoHttpClient(HankoClientConfig config, org.apache.http.impl.client.CloseableHttpClient httpClient)Construct a HankoHttpClient using a custom underlyingCloseableHttpClient. -
Method Summary
Modifier and TypeMethodDescriptionMake a delete request to the Hanko API.Make a GET request to the Hanko API.protected org.slf4j.LoggerGet a loggerMake a POST request to the Hanko API.Make a PUT request to the Hanko API.Methods inherited from class io.hanko.sdk.http.HankoHttpClientBase
makeRequest, makeRequest
-
Constructor Details
-
HankoHttpClient
Construct a HankoHttpClient. Uses a default underlyingCloseableHttpClient.- Parameters:
config- non-null, theHankoClientConfig
-
HankoHttpClient
public HankoHttpClient(HankoClientConfig config, org.apache.http.impl.client.CloseableHttpClient httpClient)Construct a HankoHttpClient using a custom underlyingCloseableHttpClient.- Parameters:
config- theHankoClientConfighttpClient- non-null, theCloseableHttpClient
-
-
Method Details
-
post
Make a POST request to the Hanko API.- Parameters:
path- the API endpoint path as a Stringbody- the request body as a String- Returns:
- a
HankoHttpResponse - Throws:
HankoApiException- if theHankoHttpResponsedoes not contain a 2xx response code
-
get
Make a GET request to the Hanko API.- Parameters:
path- the API endpoint path as a String- Returns:
- a
HankoHttpResponse - Throws:
HankoApiException- if theHankoHttpResponsedoes not contain a 2xx response code
-
put
Make a PUT request to the Hanko API.- Parameters:
path- the API endpoint path as a Stringbody- the request body as a String- Returns:
- a
HankoHttpResponse - Throws:
HankoApiException- if theHankoHttpResponsedoes not contain a 2xx response code
-
delete
Make a delete request to the Hanko API.- Parameters:
path- the API endpoint path as a String- Returns:
- a
HankoHttpResponse - Throws:
HankoApiException- if theHankoHttpResponsedoes not contain a 2xx response code
-
getLogger
protected org.slf4j.Logger getLogger()Description copied from class:HankoHttpClientBaseGet a logger- Specified by:
getLoggerin classHankoHttpClientBase- Returns:
- the
Logger
-