dev.fitko.fitconnect.api.services.http.HttpClient Maven / Gradle / Ivy
Show all versions of client Show documentation
package dev.fitko.fitconnect.api.services.http;
import dev.fitko.fitconnect.api.exceptions.internal.RestApiException;
import java.util.Map;
/**
* HTTP-Service that provides basic HTTP verbs for GET, PUT and POST requests.
*/
public interface HttpClient {
/**
* Send HTTP GET request to a given request url.
*
* @param url the URL the request is sent to
* @param headers map with HTTP headers
* @param responseType the response type of the requested payload
* @return {@link HttpResponse}
* @throws RestApiException if an error occurred during the request
*/
HttpResponse get(final String url, final Map headers, final Class responseType) throws RestApiException;
/**
* Send HTTP PUT request with payload to a given request url.
*
* @param url the URL the request is sent to
* @param headers map with HTTP headers
* @param httpPayload the payload that is sent
* @param responseType the response type of the request
* @param type of the payload
* @param type of the requests response
* @return {@link HttpResponse}
* @throws RestApiException if an error occurred during the request
*/
HttpResponse put(final String url, final Map headers, final P httpPayload, final Class responseType) throws RestApiException;
/**
* Send HTTP POST request with payload to a given request url.
*
* @param url the URL the request is sent to
* @param headers map with HTTP headers
* @param httpPayload the payload that is sent
* @param responseType the response type of the request
* @param type of the payload
* @param type of the requests response
* @return {@link HttpResponse}
* @throws RestApiException if an error occurred during the request
*/
HttpResponse post(final String url, final Map headers, final P httpPayload, final Class responseType) throws RestApiException;
}