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> Tdelete(String url, RequestData requestData, Class<T> responseType) <T> Tget(String url, RequestData requestData, Class<T> responseType) <T> List<T>getList(String url, RequestData requestData, Class<T> responseClass) <T> Thead(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, waitMethods inherited from interface io.mailtrap.http.CustomHttpClient
appendUrlParams
-
Constructor Details
-
DefaultMailtrapHttpClient
-
-
Method Details
-
get
- Specified by:
getin 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 specificHttpClientExceptionfor HTTP response codes 4xx orHttpServerExceptionfor HTTP response codes 5xx
-
getList
public <T> List<T> getList(String url, RequestData requestData, Class<T> responseClass) throws HttpException - Specified by:
getListin 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 specificHttpClientExceptionfor HTTP response codes 4xx orHttpServerExceptionfor HTTP response codes 5xx
-
delete
public <T> T delete(String url, RequestData requestData, Class<T> responseType) throws HttpException - Specified by:
deletein 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 specificHttpClientExceptionfor HTTP response codes 4xx orHttpServerExceptionfor HTTP response codes 5xx
-
head
- Specified by:
headin 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 specificHttpClientExceptionfor HTTP response codes 4xx orHttpServerExceptionfor 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:
postin 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 specificHttpClientExceptionfor HTTP response codes 4xx orHttpServerExceptionfor 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:
putin 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 specificHttpClientExceptionfor HTTP response codes 4xx orHttpServerExceptionfor 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:
patchin 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 specificHttpClientExceptionfor HTTP response codes 4xx orHttpServerExceptionfor HTTP response codes 5xx
-