com.cloudconvert.resource.async.AsyncOptimizeFilesResource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cloudconvert-java Show documentation
Show all versions of cloudconvert-java Show documentation
CloudConvert is an online file converter API - more than 200 different audio, video, document, ebook, archive, image, spreadsheet and presentation formats supported.
package com.cloudconvert.resource.async;
import com.cloudconvert.client.mapper.ObjectMapperProvider;
import com.cloudconvert.client.setttings.SettingsProvider;
import com.cloudconvert.dto.request.OptimizeFilesTaskRequest;
import com.cloudconvert.dto.response.TaskResponse;
import com.cloudconvert.dto.result.AsyncResult;
import com.cloudconvert.executor.AsyncRequestExecutor;
import com.cloudconvert.resource.AbstractOptimizeFilesResource;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import java.io.IOException;
import java.net.URISyntaxException;
@Slf4j
public class AsyncOptimizeFilesResource extends AbstractOptimizeFilesResource> {
private final AsyncRequestExecutor asyncRequestExecutor;
public AsyncOptimizeFilesResource(
final SettingsProvider settingsProvider,
final ObjectMapperProvider objectMapperProvider, final AsyncRequestExecutor asyncRequestExecutor
) {
super(settingsProvider, objectMapperProvider);
this.asyncRequestExecutor = asyncRequestExecutor;
}
@Override
public AsyncResult optimize(
@NotNull final OptimizeFilesTaskRequest optimizeFilesTaskRequest
) throws IOException, URISyntaxException {
return asyncRequestExecutor.execute(getOptimizeHttpUriRequest(optimizeFilesTaskRequest), TASK_RESPONSE_TYPE_REFERENCE);
}
@Override
public void close() throws IOException {
asyncRequestExecutor.close();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy