com.gocardless.http.DeleteRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gocardless-pro Show documentation
Show all versions of gocardless-pro Show documentation
Client library for accessing the GoCardless Pro API
package com.gocardless.http;
/**
* Base class for DELETE requests.
*
* @param the type of the item returned by this request.
*/
public abstract class DeleteRequest extends ApiRequest {
protected DeleteRequest(HttpClient httpClient) {
super(httpClient);
}
/**
* Executes this request.
*
* Returns the response entity.
*
* @throws com.gocardless.GoCardlessException
*/
public T execute() {
return getHttpClient().executeWithRetries(this);
}
/**
* Executes this request.
*
* Returns a {@link com.gocardless.http.ApiResponse} that wraps the response entity.
*
* @throws com.gocardless.GoCardlessException
*/
public ApiResponse executeWrapped() {
return getHttpClient().executeWrapped(this);
}
@Override
protected T parseResponse(String responseBody, ResponseParser responseParser) {
if (responseBody == null || responseBody.trim().isEmpty()) {
return null;
} else {
return responseParser.parseSingle(responseBody, getEnvelope(), getResponseClass());
}
}
@Override
protected final String getMethod() {
return "DELETE";
}
protected abstract Class getResponseClass();
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy