com.cloudconvert.resource.sync.ConvertFilesResource 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.ConvertFilesTaskRequest;
import com.cloudconvert.dto.response.OperationResponse;
import com.cloudconvert.dto.response.Pageable;
import com.cloudconvert.dto.response.TaskResponse;
import com.cloudconvert.dto.result.Result;
import com.cloudconvert.executor.RequestExecutor;
import com.cloudconvert.resource.AbstractConvertFilesResource;
import com.cloudconvert.resource.params.Filter;
import com.cloudconvert.resource.params.Include;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Map;
@Slf4j
public class ConvertFilesResource extends AbstractConvertFilesResource<
Result, Result>> {
private final RequestExecutor requestExecutor;
public ConvertFilesResource(
final SettingsProvider settingsProvider,
final ObjectMapperProvider objectMapperProvider, final RequestExecutor requestExecutor
) {
super(settingsProvider, objectMapperProvider);
this.requestExecutor = requestExecutor;
}
@Override
public Result convert(
@NotNull final ConvertFilesTaskRequest convertFilesTaskRequest
) throws IOException, URISyntaxException {
return requestExecutor.execute(getConvertHttpUriRequest(convertFilesTaskRequest), TASK_RESPONSE_TYPE_REFERENCE);
}
@Override
public Result> convertFormats() throws IOException, URISyntaxException {
return convertFormats(ImmutableMap.of());
}
@Override
public Result> convertFormats(
@NotNull final Map filters
) throws IOException, URISyntaxException {
return convertFormats(filters, ImmutableList.of());
}
@Override
public Result> convertFormats(
@NotNull final Map filters, @NotNull final List includes
) throws IOException, URISyntaxException {
return convertFormats(filters, includes, null);
}
@Override
public Result> convertFormats(
@NotNull final Map filters, @NotNull final List includes, @Nullable final Boolean alternative
) throws IOException, URISyntaxException {
return requestExecutor.execute(getConvertFormatsHttpUriRequest(filters, includes, alternative), OPERATION_RESPONSE_PAGEABLE_TYPE_REFERENCE);
}
@Override
public void close() throws IOException {
requestExecutor.close();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy