com.ingenico.direct.Connection Maven / Gradle / Ivy
package com.ingenico.direct;
import java.io.Closeable;
import java.io.IOException;
import java.net.URI;
import java.util.List;
import com.ingenico.direct.logging.LoggingCapable;
/**
* Represents a connection to the Ingenico ePayments platform server. Thread-safe.
*/
public interface Connection extends Closeable, LoggingCapable {
/**
* Releases any system resources associated with this object.
* Should be called when this object is about to go out of scope.
*/
@Override
void close() throws IOException;
/**
* Send a GET request to the Ingenico ePayments platform.
*
* @param uri The URI to call, including any necessary query parameters.
* @param requestHeaders An optional list of request headers.
* @param responseHandler A handler for the response.
* @throws CommunicationException when an exception occurred communicating with the Ingenico ePayments platform
*/
R get(URI uri, List requestHeaders, ResponseHandler responseHandler);
/**
* Send a DELETE request to the Ingenico ePayments platform.
*
* @param uri The URI to call, including any necessary query parameters.
* @param requestHeaders An optional list of request headers.
* @param responseHandler A handler for the response.
* @throws CommunicationException when an exception occurred communicating with the Ingenico ePayments platform
*/
R delete(URI uri, List requestHeaders, ResponseHandler responseHandler);
/**
* Send a POST request to the Ingenico ePayments platform.
*
* @param uri The URI to call, including any necessary query parameters.
* @param requestHeaders An optional list of request headers.
* @param body The optional body to send.
* @param responseHandler A handler for the response.
* @throws CommunicationException when an exception occurred communicating with the Ingenico ePayments platform
*/
R post(URI uri, List requestHeaders, String body, ResponseHandler responseHandler);
/**
* Send a PUT request to the Ingenico ePayments platform.
*
* @param uri The URI to call, including any necessary query parameters.
* @param requestHeaders An optional list of request headers.
* @param body The optional body to send.
* @param responseHandler A handler for the response.
* @throws CommunicationException when an exception occurred communicating with the Ingenico ePayments platform
*/
R put(URI uri, List requestHeaders, String body, ResponseHandler responseHandler);
}