com.cloudconvert.resource.sync.ExecuteCommandsResource Maven / Gradle / Ivy
package com.cloudconvert.resource.sync;
import com.cloudconvert.client.mapper.ObjectMapperProvider;
import com.cloudconvert.client.setttings.SettingsProvider;
import com.cloudconvert.dto.request.ExecuteCommandsTaskRequest;
import com.cloudconvert.dto.response.TaskResponse;
import com.cloudconvert.dto.result.Result;
import com.cloudconvert.executor.RequestExecutor;
import com.cloudconvert.resource.AbstractExecuteCommandsResource;
import com.google.common.collect.ImmutableList;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.HttpPost;
import org.jetbrains.annotations.NotNull;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
@Slf4j
public class ExecuteCommandsResource extends AbstractExecuteCommandsResource> {
private final RequestExecutor requestExecutor;
public ExecuteCommandsResource(
final SettingsProvider settingsProvider,
final ObjectMapperProvider objectMapperProvider, final RequestExecutor requestExecutor
) {
super(settingsProvider, objectMapperProvider);
this.requestExecutor = requestExecutor;
}
@Override
public Result command(
@NotNull final ExecuteCommandsTaskRequest executeCommandsTaskRequest
) throws IOException, URISyntaxException {
return requestExecutor.execute(getCommandHttpUriRequest(executeCommandsTaskRequest), TASK_RESPONSE_TYPE_REFERENCE);
}
@Override
public void close() throws IOException {
requestExecutor.close();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy