Package io.mailtrap.http.impl
Class DefaultMailtrapHttpClient
java.lang.Object
io.mailtrap.http.impl.DefaultMailtrapHttpClient
- All Implemented Interfaces:
CustomHttpClient
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> T
delete
(String url, RequestData requestData, Class<T> responseType) <T> T
get
(String url, RequestData requestData, Class<T> responseType) <T> List<T>
getList
(String url, RequestData requestData, Class<T> responseClass) <T> T
head
(String url, RequestData requestData, Class<T> responseType) <T,
V extends AbstractModel>
Tpatch
(String url, V data, RequestData requestData, Class<T> responseType) <T,
V extends AbstractModel>
Tpost
(String url, V data, RequestData requestData, Class<T> responseType) <T,
V extends AbstractModel>
Tput
(String url, V data, RequestData requestData, Class<T> responseType) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.mailtrap.http.CustomHttpClient
appendUrlParams
-
Constructor Details
-
DefaultMailtrapHttpClient
-
-
Method Details
-
get
- Specified by:
get
in interfaceCustomHttpClient
- Type Parameters:
T
- Return type- Parameters:
url
- Request urlrequestData
- Additional request data - headers and query parametersresponseType
- Return class type- Returns:
- Response type
- Throws:
HttpException
- in case any error. Might throw specificHttpClientException
for HTTP response codes 4xx orHttpServerException
for HTTP response codes 5xx
-
getList
public <T> List<T> getList(String url, RequestData requestData, Class<T> responseClass) throws HttpException - Specified by:
getList
in interfaceCustomHttpClient
- Type Parameters:
T
- Return type- Parameters:
url
- Request urlrequestData
- Additional request data - headers and query parametersresponseClass
- Return class type- Returns:
- Response type
- Throws:
HttpException
- in case any error. Might throw specificHttpClientException
for HTTP response codes 4xx orHttpServerException
for HTTP response codes 5xx
-
delete
public <T> T delete(String url, RequestData requestData, Class<T> responseType) throws HttpException - Specified by:
delete
in interfaceCustomHttpClient
- Type Parameters:
T
- Return type- Parameters:
url
- Request urlrequestData
- Additional request data - headers and query parametersresponseType
- Return class type- Returns:
- Response type
- Throws:
HttpException
- in case any error. Might throw specificHttpClientException
for HTTP response codes 4xx orHttpServerException
for HTTP response codes 5xx
-
head
- Specified by:
head
in interfaceCustomHttpClient
- Type Parameters:
T
- Return type- Parameters:
url
- Request urlrequestData
- Additional request data - headers and query parametersresponseType
- Return class type- Returns:
- Response type
- Throws:
HttpException
- in case any error. Might throw specificHttpClientException
for HTTP response codes 4xx orHttpServerException
for HTTP response codes 5xx
-
post
public <T,V extends AbstractModel> T post(String url, V data, RequestData requestData, Class<T> responseType) throws HttpException - Specified by:
post
in interfaceCustomHttpClient
- Type Parameters:
T
- Return typeV
- Request type- Parameters:
url
- Request urldata
- Request body. By default, would be converted to string usingAbstractModel.toJson()
requestData
- Additional request data - headers and query parametersresponseType
- Return class type- Returns:
- Response type
- Throws:
HttpException
- in case any error. Might throw specificHttpClientException
for HTTP response codes 4xx orHttpServerException
for HTTP response codes 5xx
-
put
public <T,V extends AbstractModel> T put(String url, V data, RequestData requestData, Class<T> responseType) throws HttpException - Specified by:
put
in interfaceCustomHttpClient
- Type Parameters:
T
- Return typeV
- Request type- Parameters:
url
- Request urldata
- Request body. By default, would be converted to string usingAbstractModel.toJson()
requestData
- Additional request data - headers and query parametersresponseType
- Return class type- Returns:
- Response type
- Throws:
HttpException
- in case any error. Might throw specificHttpClientException
for HTTP response codes 4xx orHttpServerException
for HTTP response codes 5xx
-
patch
public <T,V extends AbstractModel> T patch(String url, V data, RequestData requestData, Class<T> responseType) throws HttpException - Specified by:
patch
in interfaceCustomHttpClient
- Type Parameters:
T
- Return typeV
- Request type- Parameters:
url
- Request urldata
- Request body. By default, would be converted to string usingAbstractModel.toJson()
requestData
- Additional request data - headers and query parametersresponseType
- Return class type- Returns:
- Response type
- Throws:
HttpException
- in case any error. Might throw specificHttpClientException
for HTTP response codes 4xx orHttpServerException
for HTTP response codes 5xx
-