Class AbstractJobsResource<JRAR extends AbstractResult<JobResponse>,​JRPAR extends AbstractResult<Pageable<JobResponse>>,​VAR extends AbstractResult<java.lang.Void>>

java.lang.Object
com.cloudconvert.resource.AbstractResource
com.cloudconvert.resource.AbstractJobsResource<JRAR,​JRPAR,​VAR>
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 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

  • 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, CloudConvertServerException
      Create 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.IOException
      java.net.URISyntaxException
      CloudConvertClientException
      CloudConvertServerException
    • 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, CloudConvertServerException
      Create 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.IOException
      java.net.URISyntaxException
      CloudConvertClientException
      CloudConvertServerException
    • 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.IOException
      java.net.URISyntaxException
    • show

      public abstract JRAR show​(@NotNull @NotNull java.lang.String jobId) throws java.io.IOException, java.net.URISyntaxException, CloudConvertClientException, CloudConvertServerException
      Show a job. Requires the task.read scope.
      Parameters:
      jobId - job id
      Returns:
      AbstractJobsResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
      CloudConvertClientException
      CloudConvertServerException
    • 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, CloudConvertServerException
      Wait 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.IOException
      java.net.URISyntaxException
      CloudConvertClientException
      CloudConvertServerException
    • 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, CloudConvertServerException
      List all jobs. Requires the task.read scope.
      Returns:
      AbstractJobsResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
      CloudConvertClientException
      CloudConvertServerException
    • list

      public abstract JRPAR list​(@NotNull @NotNull java.util.Map<Filter,​java.lang.String> filters) throws java.io.IOException, java.net.URISyntaxException, CloudConvertClientException, CloudConvertServerException
      List 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.IOException
      java.net.URISyntaxException
      CloudConvertClientException
      CloudConvertServerException
    • 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, CloudConvertServerException
      List 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.IOException
      java.net.URISyntaxException
      CloudConvertClientException
      CloudConvertServerException
    • 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, CloudConvertServerException
      List 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.IOException
      java.net.URISyntaxException
      CloudConvertClientException
      CloudConvertServerException
    • 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.IOException
      java.net.URISyntaxException
    • delete

      public abstract VAR delete​(@NotNull @NotNull java.lang.String jobId) throws java.io.IOException, java.net.URISyntaxException, CloudConvertClientException, CloudConvertServerException
      Delete 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.IOException
      java.net.URISyntaxException
      CloudConvertClientException
      CloudConvertServerException
    • getDeleteHttpUriRequest

      protected org.apache.http.client.methods.HttpUriRequest getDeleteHttpUriRequest​(@NotNull @NotNull java.lang.String jobId) throws java.net.URISyntaxException
      Throws:
      java.net.URISyntaxException