Package com.checkhim.http
Class HttpClient
java.lang.Object
com.checkhim.http.HttpClient
HTTP client wrapper for making requests to the CheckHim API.
This class handles authentication, request formatting, response parsing,
and error handling for all API communications.
-
Constructor Summary
ConstructorsConstructorDescriptionHttpClient(String apiKey, String baseUrl) Creates a new HTTP client with the specified API key and base URL. -
Method Summary
-
Constructor Details
-
HttpClient
Creates a new HTTP client with the specified API key and base URL.- Parameters:
apiKey- The CheckHim API keybaseUrl- The base URL for the API
-
-
Method Details
-
post
public <T,R> R post(String endpoint, T requestBody, Class<R> responseType) throws CheckHimException Makes a POST request to the specified endpoint.- Type Parameters:
T- The type of the request bodyR- The type of the response- Parameters:
endpoint- The API endpoint (e.g., "/api/v1/verify")requestBody- The request body objectresponseType- The expected response type class- Returns:
- The parsed response object
- Throws:
CheckHimException- if the request fails or returns an error
-
close
public void close()Closes the HTTP client and releases resources.
-