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 Closeable to allow releasing underlying resources (e.g. connection pools). A default no-op close() is provided for backward compatibility with existing custom implementations.

    See Also:
    AdyenHttpClient
    • Method Detail

      • 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 endpoint
        requestBody - the JSON request body
        config - the client configuration containing authentication and timeout settings
        Returns:
        the JSON response body
        Throws:
        IOException - if a network error occurs
        HTTPClientException - 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 endpoint
        requestBody - the JSON request body
        config - the client configuration
        isApiKeyRequired - whether API key authentication is mandatory for this request
        Returns:
        the JSON response body
        Throws:
        IOException - if a network error occurs
        HTTPClientException - 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 endpoint
        requestBody - the JSON request body
        config - the client configuration
        isApiKeyRequired - whether API key authentication is mandatory
        requestOptions - additional request options (idempotency key, custom headers)
        Returns:
        the JSON response body
        Throws:
        IOException - if a network error occurs
        HTTPClientException - 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 endpoint
        requestBody - the JSON request body (may be null for GET/DELETE)
        config - the client configuration
        isApiKeyRequired - whether API key authentication is mandatory
        requestOptions - 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 occurs
        HTTPClientException - 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 endpoint
        requestBody - the JSON request body (may be null for GET/DELETE)
        config - the client configuration
        isApiKeyRequired - whether API key authentication is mandatory
        requestOptions - 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 occurs
        HTTPClientException - if the server returns a non-2xx status code