public class OkHttpTrelloHttpClient extends java.lang.Object implements TrelloHttpClient
TrelloHttpClient backed by OkHttpClient.| Constructor and Description |
|---|
OkHttpTrelloHttpClient()
Constructs new instance of
OkHttpTrelloHttpClient with default values. |
OkHttpTrelloHttpClient(okhttp3.OkHttpClient httpClient,
com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Constructs new instance of
OkHttpTrelloHttpClient. |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
delete(java.lang.String url,
java.lang.Class<T> responseType,
java.lang.String... params)
Performs HTTP
DELETE request and converts response. |
<T> T |
get(java.lang.String url,
java.lang.Class<T> responseType,
java.lang.String... params)
Performs HTTP
GET request and converts response. |
<T> T |
postFileForObject(java.lang.String url,
java.io.File file,
java.lang.Class<T> responseType,
java.lang.String... params)
Performs HTTP
POST request and converts response. |
java.net.URI |
postForLocation(java.lang.String url,
java.lang.Object body,
java.lang.String... params)
Performs HTTP
POST request and returns the value of the Location header. |
<T> T |
postForObject(java.lang.String url,
java.lang.Object body,
java.lang.Class<T> responseType,
java.lang.String... params)
Performs HTTP
POST request and converts response. |
<T> T |
putForObject(java.lang.String url,
java.lang.Object body,
java.lang.Class<T> responseType,
java.lang.String... params)
Performs HTTP
PUT request and converts response. |
public OkHttpTrelloHttpClient(okhttp3.OkHttpClient httpClient,
com.fasterxml.jackson.databind.ObjectMapper objectMapper)
OkHttpTrelloHttpClient.httpClient - The HTTP client to perform network calls.objectMapper - The request/response encoder/decoder.java.lang.NullPointerException - When any argument is null.public OkHttpTrelloHttpClient()
OkHttpTrelloHttpClient with default values.public <T> T get(java.lang.String url,
java.lang.Class<T> responseType,
java.lang.String... params)
TrelloHttpClientGET request and converts response.
The template variables in url are expanded using the given params, if any.
get in interface TrelloHttpClientT - The response object type.url - The URL to make request to.responseType - The response object class object.params - The URL query part or path parameters that should be expanded.public <T> T postForObject(java.lang.String url,
java.lang.Object body,
java.lang.Class<T> responseType,
java.lang.String... params)
TrelloHttpClientPOST request and converts response.
The template variables in url are expanded using the given params, if any.
postForObject in interface TrelloHttpClientT - The response object type.url - The URL to make request to.body - The object to be converted to its JSON representation and POSTed. Use null to send request with empty body.responseType - The response object class object.params - The URL query part or path parameters that should be expanded.public java.net.URI postForLocation(java.lang.String url,
java.lang.Object body,
java.lang.String... params)
TrelloHttpClientPOST request and returns the value of the Location header.
The template variables in url are expanded using the given params, if any.
postForLocation in interface TrelloHttpClienturl - The URL to make request to.body - The object to be converted to its JSON representation and POSTed. Use null
to send request with empty body.params - The URL query part or path parameters that should be expanded.POSTed resource location.public <T> T putForObject(java.lang.String url,
java.lang.Object body,
java.lang.Class<T> responseType,
java.lang.String... params)
TrelloHttpClientPUT request and converts response.
The template variables in url are expanded using the given params, if any.
putForObject in interface TrelloHttpClientT - The response object type.url - The URL to make request to.body - The object to be converted to its JSON representation and POSTed. Use null send request with empty body.responseType - The response object class object.params - The URL query part or path parameters that should be expanded.public <T> T delete(java.lang.String url,
java.lang.Class<T> responseType,
java.lang.String... params)
TrelloHttpClientDELETE request and converts response.
The template variables in url are expanded using the given params, if any.
delete in interface TrelloHttpClientT - The response object type.url - The URL to make request to.responseType - The response object class object.params - The URL query part or path parameters that should be expanded.public <T> T postFileForObject(java.lang.String url,
java.io.File file,
java.lang.Class<T> responseType,
java.lang.String... params)
TrelloHttpClientPOST request and converts response. The file should be transmitted using multipart/form-data.
This is optional method.
The template variables in url are expanded using the given params, if any.
postFileForObject in interface TrelloHttpClientT - The response object type.url - The URL to make request to.file - The file to upload.responseType - The response object class object.params - The URL query part or path parameters that should be expanded.