com.cloudconvert.resource.AbstractCreateArchivesResource Maven / Gradle / Ivy
package com.cloudconvert.resource;
import com.cloudconvert.client.mapper.ObjectMapperProvider;
import com.cloudconvert.client.setttings.SettingsProvider;
import com.cloudconvert.dto.request.CreateArchivesTaskRequest;
import com.cloudconvert.dto.response.TaskResponse;
import com.cloudconvert.dto.result.AbstractResult;
import com.google.common.collect.ImmutableList;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.jetbrains.annotations.NotNull;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
public abstract class AbstractCreateArchivesResource> extends AbstractResource {
public static final String PATH_SEGMENT_ARCHIVE = "archive";
public AbstractCreateArchivesResource(
final SettingsProvider settingsProvider, final ObjectMapperProvider objectMapperProvider
) {
super(settingsProvider, objectMapperProvider);
}
/**
* Create a task to create a ZIP, RAR, 7Z, TAR, TAR.GZ or TAR.BZ2 archive.
*
* @param createArchivesTaskRequest {@link CreateArchivesTaskRequest}
* @return {@link TRAR}
* @throws IOException
* @throws URISyntaxException
*/
public abstract TRAR archive(
@NotNull final CreateArchivesTaskRequest createArchivesTaskRequest
) throws IOException, URISyntaxException;
protected HttpUriRequest getArchiveHttpUriRequest(
@NotNull final CreateArchivesTaskRequest createArchivesTaskRequest
) throws IOException, URISyntaxException {
final URI uri = getUri(ImmutableList.of(PATH_SEGMENT_ARCHIVE));
final HttpEntity httpEntity = getHttpEntity(createArchivesTaskRequest);
return getHttpUriRequest(HttpPost.class, uri, httpEntity);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy