diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2016-03-19 02:05:33 -0700 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2016-03-19 02:07:24 -0700 |
commit | b9eb1329a6dbec7b75c21d8e0eb13134121db6bb (patch) | |
tree | fec73ab32ff625c304513c24e864809845eede1a /src/main/java/com/p4square/ccbapi/HTTPInterface.java |
Initial commit for the CCB API Client.
The client currently supports the following APIs:
* individual_profiles
* individual_profile_from_id
* individual_profile_from_login_password
* individual_profile_from_micr
* custom_field_labels
Diffstat (limited to 'src/main/java/com/p4square/ccbapi/HTTPInterface.java')
-rw-r--r-- | src/main/java/com/p4square/ccbapi/HTTPInterface.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/main/java/com/p4square/ccbapi/HTTPInterface.java b/src/main/java/com/p4square/ccbapi/HTTPInterface.java new file mode 100644 index 0000000..11d87ec --- /dev/null +++ b/src/main/java/com/p4square/ccbapi/HTTPInterface.java @@ -0,0 +1,34 @@ +package com.p4square.ccbapi; + +import com.p4square.ccbapi.exception.CCBException; +import com.p4square.ccbapi.exception.CCBRetryableErrorException; + +import java.io.Closeable; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.util.Map; + +/** + * HTTPInterface exists to separate the HTTP client implementation from the CCB client. + * + * The concern here is that it may not be possible or desirable to take a dependency on the + * Apache HTTP Client library. If that case arises the CCBAPIClient and the HTTPInterface + * implementation can be split into separate packages. For simplicity's sake I'm not doing + * that now. But if it needs to be done at a later time the code will already be isolated. + */ +public interface HTTPInterface extends Closeable { + /** + * Send an HTTP POST request to the given URI. + * + * The form data for the request is specified in the form Map. + * + * @param uri The URI to request. + * @param form Map of key/value pairs to send as form data. + * @return The response received. + * @throws com.p4square.ccbapi.exception.CCBRetryableErrorException + * @throws CCBRetryableErrorException if a retryable error occurs. + * @throws IOException If a non-retryable error occurs. + */ + InputStream sendPostRequest(URI uri, Map<String, String> form) throws IOException; +} |