Package com.adyen.httpclient
Interface ClientInterface
-
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
AdyenHttpClient
public interface ClientInterface extends Closeable
Interface for HTTP client implementations used to make Adyen API requests. All API services delegate HTTP communication to an implementation of this interface.Implements
Closeableto allow releasing underlying resources (e.g. connection pools). A default no-opclose()is provided for backward compatibility with existing custom implementations.- See Also:
AdyenHttpClient
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidclose()Default no-op close for backward compatibility with custom implementations.Stringrequest(String endpoint, String requestBody, Config config)Sends an HTTP POST request to the given endpoint.Stringrequest(String endpoint, String requestBody, Config config, boolean isApiKeyRequired)Sends an HTTP POST request with optional API key authentication.Stringrequest(String endpoint, String requestBody, Config config, boolean isApiKeyRequired, RequestOptions requestOptions)Sends an HTTP POST request with optional API key authentication and request options.Stringrequest(String endpoint, String requestBody, Config config, boolean isApiKeyRequired, RequestOptions requestOptions, ApiConstants.HttpMethod httpMethod)Sends an HTTP request with the specified method, authentication, and request options.Stringrequest(String endpoint, String requestBody, Config config, boolean isApiKeyRequired, RequestOptions requestOptions, ApiConstants.HttpMethod httpMethod, Map<String,String> params)Sends an HTTP request with the specified method, authentication, request options, and query string parameters.
-
-
-
Method Detail
-
close
default void close() throws IOExceptionDefault no-op close for backward compatibility with custom implementations.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
request
String request(String endpoint, String requestBody, Config config) throws IOException, HTTPClientException
Sends an HTTP POST request to the given endpoint.- Parameters:
endpoint- the full URL of the API endpointrequestBody- the JSON request bodyconfig- the client configuration containing authentication and timeout settings- Returns:
- the JSON response body
- Throws:
IOException- if a network error occursHTTPClientException- if the server returns a non-2xx status code
-
request
String request(String endpoint, String requestBody, Config config, boolean isApiKeyRequired) throws IOException, HTTPClientException
Sends an HTTP POST request with optional API key authentication.- Parameters:
endpoint- the full URL of the API endpointrequestBody- the JSON request bodyconfig- the client configurationisApiKeyRequired- whether API key authentication is mandatory for this request- Returns:
- the JSON response body
- Throws:
IOException- if a network error occursHTTPClientException- if the server returns a non-2xx status code
-
request
String request(String endpoint, String requestBody, Config config, boolean isApiKeyRequired, RequestOptions requestOptions) throws IOException, HTTPClientException
Sends an HTTP POST request with optional API key authentication and request options.- Parameters:
endpoint- the full URL of the API endpointrequestBody- the JSON request bodyconfig- the client configurationisApiKeyRequired- whether API key authentication is mandatoryrequestOptions- additional request options (idempotency key, custom headers)- Returns:
- the JSON response body
- Throws:
IOException- if a network error occursHTTPClientException- if the server returns a non-2xx status code
-
request
String request(String endpoint, String requestBody, Config config, boolean isApiKeyRequired, RequestOptions requestOptions, ApiConstants.HttpMethod httpMethod) throws IOException, HTTPClientException
Sends an HTTP request with the specified method, authentication, and request options.- Parameters:
endpoint- the full URL of the API endpointrequestBody- the JSON request body (may be null for GET/DELETE)config- the client configurationisApiKeyRequired- whether API key authentication is mandatoryrequestOptions- additional request options (idempotency key, custom headers)httpMethod- the HTTP method (GET, POST, PATCH, DELETE)- Returns:
- the JSON response body
- Throws:
IOException- if a network error occursHTTPClientException- if the server returns a non-2xx status code
-
request
String request(String endpoint, String requestBody, Config config, boolean isApiKeyRequired, RequestOptions requestOptions, ApiConstants.HttpMethod httpMethod, Map<String,String> params) throws IOException, HTTPClientException
Sends an HTTP request with the specified method, authentication, request options, and query string parameters. This is the most complete overload used by all API service classes.- Parameters:
endpoint- the full URL of the API endpointrequestBody- the JSON request body (may be null for GET/DELETE)config- the client configurationisApiKeyRequired- whether API key authentication is mandatoryrequestOptions- additional request options (idempotency key, custom headers)httpMethod- the HTTP method (GET, POST, PATCH, DELETE)params- query string parameters appended to the URL- Returns:
- the JSON response body
- Throws:
IOException- if a network error occursHTTPClientException- if the server returns a non-2xx status code
-
-