Class AbstractJobsResource<JRAR extends AbstractResult<JobResponse>,JRPAR extends AbstractResult<Pageable<JobResponse>>,VAR extends AbstractResult<java.lang.Void>>
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
- Direct Known Subclasses:
AsyncJobsResource,JobsResource
public abstract class AbstractJobsResource<JRAR extends AbstractResult<JobResponse>,JRPAR extends AbstractResult<Pageable<JobResponse>>,VAR extends AbstractResult<java.lang.Void>> extends AbstractResource
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPATH_SEGMENT_JOBSstatic java.lang.StringPATH_SEGMENT_WAITFields inherited from class com.cloudconvert.resource.AbstractResource
BEARER, HEADER_AUTHORIZATION, HEADER_USER_AGENT, INPUT_STREAM_TYPE_REFERENCE, JOB_RESPONSE_PAGEABLE_TYPE_REFERENCE, JOB_RESPONSE_TYPE_REFERENCE, MAP_STRING_TO_OBJECT_TYPE_REFERENCE, OPERATION_RESPONSE_PAGEABLE_TYPE_REFERENCE, TASK_RESPONSE_PAGEABLE_TYPE_REFERENCE, TASK_RESPONSE_TYPE_REFERENCE, USER_RESPONSE_TYPE_REFERENCE, V2, VALUE_USER_AGENT, VOID_TYPE_REFERENCE, WEBHOOKS_RESPONSE_PAGEABLE_TYPE_REFERENCE, WEBHOOKS_RESPONSE_TYPE_REFERENCE -
Constructor Summary
Constructors Constructor Description AbstractJobsResource(SettingsProvider settingsProvider, ObjectMapperProvider objectMapperProvider) -
Method Summary
Modifier and Type Method Description abstract JRARcreate(@NotNull java.util.Map<java.lang.String,TaskRequest> tasks)Create a job with one ore more tasks.abstract JRARcreate(@NotNull java.util.Map<java.lang.String,TaskRequest> tasks, @NotNull java.lang.String tag)Create a job with one ore more tasks.abstract VARdelete(@NotNull java.lang.String jobId)Delete a job, including all tasks and data.protected org.apache.http.client.methods.HttpUriRequestgetCreateHttpUriRequest(@NotNull java.util.Map<java.lang.String,TaskRequest> tasks, @NotNull java.lang.String tag)protected org.apache.http.client.methods.HttpUriRequestgetDeleteHttpUriRequest(@NotNull java.lang.String jobId)protected org.apache.http.client.methods.HttpUriRequestgetListHttpUriRequest(@NotNull java.util.Map<Filter,java.lang.String> filters, @NotNull java.util.List<Include> includes, @Nullable Pagination pagination)protected org.apache.http.client.methods.HttpUriRequestgetShowHttpUriRequest(@NotNull java.lang.String jobId)protected org.apache.http.client.methods.HttpUriRequestgetWaitHttpUriRequest(@NotNull java.lang.String jobId)abstract JRPARlist()List all jobs.abstract JRPARlist(@NotNull java.util.Map<Filter,java.lang.String> filters)List all jobs.abstract JRPARlist(@NotNull java.util.Map<Filter,java.lang.String> filters, @NotNull java.util.List<Include> includes)List all jobs.abstract JRPARlist(@NotNull java.util.Map<Filter,java.lang.String> filters, @NotNull java.util.List<Include> includes, @Nullable Pagination pagination)List all jobs.abstract JRARshow(@NotNull java.lang.String jobId)Show a job.abstract JRARwait(@NotNull java.lang.String jobId)Wait until the job status is finished or error.Methods inherited from class com.cloudconvert.resource.AbstractResource
getHttpEntity, getHttpEntity, getHttpUriRequest, getHttpUriRequest, getJson, getSyncUri, getSyncUri, getUri, getUri, requestToMapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.io.Closeable
close
-
Field Details
-
PATH_SEGMENT_JOBS
public static final java.lang.String PATH_SEGMENT_JOBS- See Also:
- Constant Field Values
-
PATH_SEGMENT_WAIT
public static final java.lang.String PATH_SEGMENT_WAIT- See Also:
- Constant Field Values
-
-
Constructor Details
-
AbstractJobsResource
public AbstractJobsResource(SettingsProvider settingsProvider, ObjectMapperProvider objectMapperProvider)
-
-
Method Details
-
create
public abstract JRAR create(@NotNull @NotNull java.util.Map<java.lang.String,TaskRequest> tasks) throws java.io.IOException, java.net.URISyntaxException, CloudConvertClientException, CloudConvertServerExceptionCreate a job with one ore more tasks. Requires the task.write scope.- Parameters:
tasks- The example on the right consists of three tasks: import-my-file, convert-my-file and export-my-file. You can name these tasks however you want, but only alphanumeric characters, - and _ are allowed in the task names.Each task has a operation, which is the endpoint for creating the task (for example: convert, import/s3 or export/s3). The other parameters are the same as for creating the task using their direct endpoint. The input parameter allows it to directly reference the name of another task, created with the same job request.
- Returns:
AbstractJobsResource- Throws:
java.io.IOExceptionjava.net.URISyntaxExceptionCloudConvertClientExceptionCloudConvertServerException
-
create
public abstract JRAR create(@NotNull @NotNull java.util.Map<java.lang.String,TaskRequest> tasks, @NotNull @NotNull java.lang.String tag) throws java.io.IOException, java.net.URISyntaxException, CloudConvertClientException, CloudConvertServerExceptionCreate a job with one ore more tasks. Requires the task.write scope.- Parameters:
tasks- The example on the right consists of three tasks: import-my-file, convert-my-file and export-my-file. You can name these tasks however you want, but only alphanumeric characters, - and _ are allowed in the task names.Each task has a operation, which is the endpoint for creating the task (for example: convert, import/s3 or export/s3). The other parameters are the same as for creating the task using their direct endpoint. The input parameter allows it to directly reference the name of another task, created with the same job request.
tag- An arbitrary string to identify the job. Does not have any effect and can be used to associate the job with an ID in your application.- Returns:
AbstractJobsResource- Throws:
java.io.IOExceptionjava.net.URISyntaxExceptionCloudConvertClientExceptionCloudConvertServerException
-
getCreateHttpUriRequest
protected org.apache.http.client.methods.HttpUriRequest getCreateHttpUriRequest(@NotNull @NotNull java.util.Map<java.lang.String,TaskRequest> tasks, @NotNull @NotNull java.lang.String tag) throws java.io.IOException, java.net.URISyntaxException- Throws:
java.io.IOExceptionjava.net.URISyntaxException
-
show
public abstract JRAR show(@NotNull @NotNull java.lang.String jobId) throws java.io.IOException, java.net.URISyntaxException, CloudConvertClientException, CloudConvertServerExceptionShow a job. Requires the task.read scope.- Parameters:
jobId- job id- Returns:
AbstractJobsResource- Throws:
java.io.IOExceptionjava.net.URISyntaxExceptionCloudConvertClientExceptionCloudConvertServerException
-
getShowHttpUriRequest
protected org.apache.http.client.methods.HttpUriRequest getShowHttpUriRequest(@NotNull @NotNull java.lang.String jobId) throws java.net.URISyntaxException- Throws:
java.net.URISyntaxException
-
wait
public abstract JRAR wait(@NotNull @NotNull java.lang.String jobId) throws java.io.IOException, java.net.URISyntaxException, CloudConvertClientException, CloudConvertServerExceptionWait until the job status is finished or error. This makes the request block until the job has been completed. Requires the task.read scope.We do not recommend using this for long running jobs (e.g. video encodings). Your system might automatically time out requests if there is not data transferred for a longer time.
In general, please avoid to block your application until a CloudConvert job completes. There might be cases in which we need to queue your job which results in longer processing times than usual. Using an asynchronous approach with webhooks is beneficial in such cases.
- Parameters:
jobId- job id- Returns:
AbstractJobsResource- Throws:
java.io.IOExceptionjava.net.URISyntaxExceptionCloudConvertClientExceptionCloudConvertServerException
-
getWaitHttpUriRequest
protected org.apache.http.client.methods.HttpUriRequest getWaitHttpUriRequest(@NotNull @NotNull java.lang.String jobId) throws java.net.URISyntaxException- Throws:
java.net.URISyntaxException
-
list
public abstract JRPAR list() throws java.io.IOException, java.net.URISyntaxException, CloudConvertClientException, CloudConvertServerExceptionList all jobs. Requires the task.read scope.- Returns:
AbstractJobsResource- Throws:
java.io.IOExceptionjava.net.URISyntaxExceptionCloudConvertClientExceptionCloudConvertServerException
-
list
public abstract JRPAR list(@NotNull @NotNull java.util.Map<Filter,java.lang.String> filters) throws java.io.IOException, java.net.URISyntaxException, CloudConvertClientException, CloudConvertServerExceptionList all jobs. Requires the task.read scope.- Parameters:
filters- (optional) Filters: - status - The result will be filtered to include only jobs with a specific status (processing, finished or error). - tag - The result will be filtered to include only jobs with a tag.- Returns:
AbstractJobsResource- Throws:
java.io.IOExceptionjava.net.URISyntaxExceptionCloudConvertClientExceptionCloudConvertServerException
-
list
public abstract JRPAR list(@NotNull @NotNull java.util.Map<Filter,java.lang.String> filters, @NotNull @NotNull java.util.List<Include> includes) throws java.io.IOException, java.net.URISyntaxException, CloudConvertClientException, CloudConvertServerExceptionList all jobs. Requires the task.read scope.- Parameters:
filters- (optional) Filters: - status - The result will be filtered to include only jobs with a specific status (processing, finished or error). - tag - The result will be filtered to include only jobs with a tag.includes- (optional) Include tasks in the result.- Returns:
AbstractJobsResource- Throws:
java.io.IOExceptionjava.net.URISyntaxExceptionCloudConvertClientExceptionCloudConvertServerException
-
list
public abstract JRPAR list(@NotNull @NotNull java.util.Map<Filter,java.lang.String> filters, @NotNull @NotNull java.util.List<Include> includes, @Nullable @Nullable Pagination pagination) throws java.io.IOException, java.net.URISyntaxException, CloudConvertClientException, CloudConvertServerExceptionList all jobs. Requires the task.read scope.- Parameters:
filters- (optional) Filters: - status - The result will be filtered to include only jobs with a specific status (processing, finished or error). - tag - The result will be filtered to include only jobs with a tag.includes- (optional) Include tasks in the result.pagination- (optional) Pagination: - per_page - Number of tasks per page, defaults to 100. - page - The result page to show.- Returns:
AbstractJobsResource- Throws:
java.io.IOExceptionjava.net.URISyntaxExceptionCloudConvertClientExceptionCloudConvertServerException
-
getListHttpUriRequest
protected org.apache.http.client.methods.HttpUriRequest getListHttpUriRequest(@NotNull @NotNull java.util.Map<Filter,java.lang.String> filters, @NotNull @NotNull java.util.List<Include> includes, @Nullable @Nullable Pagination pagination) throws java.io.IOException, java.net.URISyntaxException- Throws:
java.io.IOExceptionjava.net.URISyntaxException
-
delete
public abstract VAR delete(@NotNull @NotNull java.lang.String jobId) throws java.io.IOException, java.net.URISyntaxException, CloudConvertClientException, CloudConvertServerExceptionDelete a job, including all tasks and data. Requires the task.write scope. Jobs are deleted automatically 24 hours after they have ended.- Parameters:
jobId- job id- Returns:
AbstractJobsResource- Throws:
java.io.IOExceptionjava.net.URISyntaxExceptionCloudConvertClientExceptionCloudConvertServerException
-
getDeleteHttpUriRequest
protected org.apache.http.client.methods.HttpUriRequest getDeleteHttpUriRequest(@NotNull @NotNull java.lang.String jobId) throws java.net.URISyntaxException- Throws:
java.net.URISyntaxException
-