
io.sphere.sdk.requests.DeleteByIdCommandImpl Maven / Gradle / Ivy
package io.sphere.sdk.requests;
import io.sphere.sdk.models.Versioned;
public abstract class DeleteByIdCommandImpl extends CommandImpl {
private final Versioned versionData;
protected DeleteByIdCommandImpl(final Versioned versionData) {
this.versionData = versionData;
}
@Override
public HttpRequest httpRequest() {
String baseEndpointWithoutId = baseEndpointWithoutId();
if (!baseEndpointWithoutId.startsWith("/")) {
throw new RuntimeException("By convention the paths start with a slash, see baseEndpointWithoutId()");
}
return HttpRequest.of(HttpMethod.DELETE, baseEndpointWithoutId + "/" + versionData.getId() + "?version=" + versionData.getVersion());
}
protected abstract String baseEndpointWithoutId();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy