Class AbstractTasksResource<TRAR extends AbstractResult<TaskResponse>,​TRPAR extends AbstractResult<Pageable<TaskResponse>>,​VAR extends AbstractResult<java.lang.Void>,​ORPAR extends AbstractResult<Pageable<OperationResponse>>>

java.lang.Object
com.cloudconvert.resource.AbstractResource
com.cloudconvert.resource.AbstractTasksResource<TRAR,​TRPAR,​VAR,​ORPAR>
All Implemented Interfaces:
java.io.Closeable, java.lang.AutoCloseable
Direct Known Subclasses:
AsyncTasksResource, TasksResource

public abstract class AbstractTasksResource<TRAR extends AbstractResult<TaskResponse>,​TRPAR extends AbstractResult<Pageable<TaskResponse>>,​VAR extends AbstractResult<java.lang.Void>,​ORPAR extends AbstractResult<Pageable<OperationResponse>>>
extends AbstractResource
  • Field Details

    • PATH_SEGMENT_TASKS

      public static final java.lang.String PATH_SEGMENT_TASKS
      See Also:
      Constant Field Values
    • PATH_SEGMENT_OPERATIONS

      public static final java.lang.String PATH_SEGMENT_OPERATIONS
      See Also:
      Constant Field Values
    • PATH_SEGMENT_WAIT

      public static final java.lang.String PATH_SEGMENT_WAIT
      See Also:
      Constant Field Values
    • PATH_SEGMENT_CANCEL

      public static final java.lang.String PATH_SEGMENT_CANCEL
      See Also:
      Constant Field Values
    • PATH_SEGMENT_RETRY

      public static final java.lang.String PATH_SEGMENT_RETRY
      See Also:
      Constant Field Values
  • Constructor Details

  • Method Details

    • show

      public abstract TRAR show​(@NotNull @NotNull java.lang.String taskId) throws java.io.IOException, java.net.URISyntaxException
      Show a task. Requires the task.read scope.
      Parameters:
      taskId - task id
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • show

      public abstract TRAR show​(@NotNull @NotNull java.lang.String taskId, @NotNull @NotNull java.util.List<Include> includes) throws java.io.IOException, java.net.URISyntaxException
      Show a task. Requires the task.read scope.
      Parameters:
      taskId - task id
      includes - (optional) Include retries, depends_on_tasks, payload and/or job in the result. Multiple include values are separated by , (comma).
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • getShowHttpUriRequest

      protected org.apache.http.client.methods.HttpUriRequest getShowHttpUriRequest​(@NotNull @NotNull java.lang.String taskId, @NotNull @NotNull java.util.List<Include> includes) throws java.net.URISyntaxException
      Throws:
      java.net.URISyntaxException
    • wait

      public abstract TRAR wait​(@NotNull @NotNull java.lang.String taskId) throws java.io.IOException, java.net.URISyntaxException
      Wait until the task status is finished or error. This makes the request block until the task 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 task which results in longer processing times than usual. Using an asynchronous approach with webhooks is beneficial in such cases.

      Parameters:
      taskId - task id
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • getWaitHttpUriRequest

      protected org.apache.http.client.methods.HttpUriRequest getWaitHttpUriRequest​(@NotNull @NotNull java.lang.String taskId) throws java.net.URISyntaxException
      Throws:
      java.net.URISyntaxException
    • list

      public abstract TRPAR list() throws java.io.IOException, java.net.URISyntaxException
      List all tasks with their status, payload and result. Requires the task.read scope.
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • list

      public abstract TRPAR list​(@NotNull @NotNull java.util.Map<Filter,​java.lang.String> filters) throws java.io.IOException, java.net.URISyntaxException
      List all tasks with their status, payload and result. Requires the task.read scope.
      Parameters:
      filters - (optional) Filters: - job_id - The result will be filtered to include only tasks for a specific Job ID. - status - The result will be filtered to include only tasks with a specific status (waiting, processing, finished or error). - operation - Filter result to only include tasks of with a matching operation (for example convert or import/s3).
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • list

      public abstract TRPAR 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
      List all tasks with their status, payload and result. Requires the task.read scope.
      Parameters:
      filters - (optional) Filters: - job_id - The result will be filtered to include only tasks for a specific Job ID. - status - The result will be filtered to include only tasks with a specific status (waiting, processing, finished or error). - operation - Filter result to only include tasks of with a matching operation (for example convert or import/s3).
      includes - (optional) Include retries and/or depends_on_tasks in the result.
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • list

      public abstract TRPAR 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
      List all tasks with their status, payload and result. Requires the task.read scope.
      Parameters:
      filters - (optional) Filters: - job_id - The result will be filtered to include only tasks for a specific Job ID. - status - The result will be filtered to include only tasks with a specific status (waiting, processing, finished or error). - operation - Filter result to only include tasks of with a matching operation (for example convert or import/s3).
      includes - (optional) Include retries and/or depends_on_tasks in the result.
      pagination - (optional) Pagination: - per_page - Number of tasks per page, defaults to 100. - page - The result page to show.
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • 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.net.URISyntaxException
      Throws:
      java.net.URISyntaxException
    • cancel

      public abstract TRAR cancel​(@NotNull @NotNull java.lang.String taskId) throws java.io.IOException, java.net.URISyntaxException
      Cancel a task that is in status waiting or processing. Requires the task.write scope.
      Parameters:
      taskId - task id
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • getCancelHttpUriRequest

      protected org.apache.http.client.methods.HttpUriRequest getCancelHttpUriRequest​(@NotNull @NotNull java.lang.String taskId) throws java.net.URISyntaxException
      Throws:
      java.net.URISyntaxException
    • retry

      public abstract TRAR retry​(@NotNull @NotNull java.lang.String taskId) throws java.io.IOException, java.net.URISyntaxException
      Create a new task, based on the payload of another task. Requires the task.write scope.
      Parameters:
      taskId - task id
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • getRetryHttpUriRequest

      protected org.apache.http.client.methods.HttpUriRequest getRetryHttpUriRequest​(@NotNull @NotNull java.lang.String taskId) throws java.net.URISyntaxException
      Throws:
      java.net.URISyntaxException
    • delete

      public abstract VAR delete​(@NotNull @NotNull java.lang.String taskId) throws java.io.IOException, java.net.URISyntaxException
      Delete a task, including all data. Requires the task.write scope. Tasks are deleted automatically 24 hours after they have ended.
      Parameters:
      taskId - task id
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • getDeleteHttpUriRequest

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

      public abstract ORPAR operations() throws java.io.IOException, java.net.URISyntaxException
      List all possible operations, formats, engines and possible options.
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • operations

      public abstract ORPAR operations​(@NotNull @NotNull java.util.Map<Filter,​java.lang.String> filters) throws java.io.IOException, java.net.URISyntaxException
      List all possible operations, formats, engines and possible options.
      Parameters:
      filters - (optional) Filters: - operation - The result will be filtered to include only possible operations with a matching operation name (e.g. convert or optimize). - input_format - The result will be filtered to include only possible conversions with a matching input format. - output_format - The result will be filtered to include only possible conversions with a matching output format. - engine - Filter result to only include conversions with a matching engine name. - engine_version - Filter result to only include conversions with a matching engine version.
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • operations

      public abstract ORPAR operations​(@NotNull @NotNull java.util.Map<Filter,​java.lang.String> filters, @NotNull @NotNull java.util.List<Include> includes) throws java.io.IOException, java.net.URISyntaxException
      List all possible operations, formats, engines and possible options.
      Parameters:
      filters - (optional) Filters: - operation - The result will be filtered to include only possible operations with a matching operation name (e.g. convert or optimize). - input_format - The result will be filtered to include only possible conversions with a matching input format. - output_format - The result will be filtered to include only possible conversions with a matching output format. - engine - Filter result to only include conversions with a matching engine name. - engine_version - Filter result to only include conversions with a matching engine version.
      includes - (optional) Include options and/or engine_versions in the result.
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • operations

      public abstract ORPAR operations​(@NotNull @NotNull java.util.Map<Filter,​java.lang.String> filters, @NotNull @NotNull java.util.List<Include> includes, @Nullable @Nullable java.lang.Boolean alternative) throws java.io.IOException, java.net.URISyntaxException
      List all possible operations, formats, engines and possible options.
      Parameters:
      filters - (optional) Filters: - operation - The result will be filtered to include only possible operations with a matching operation name (e.g. convert or optimize). - input_format - The result will be filtered to include only possible conversions with a matching input format. - output_format - The result will be filtered to include only possible conversions with a matching output format. - engine - Filter result to only include conversions with a matching engine name. - engine_version - Filter result to only include conversions with a matching engine version.
      includes - (optional) Include options and/or engine_versions in the result.
      alternative - (optional) For some formats multiple alternative engines are available. If set to true, the result includes these alternative conversion types. Default to false.
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • getOperationsHttpUriRequest

      protected org.apache.http.client.methods.HttpUriRequest getOperationsHttpUriRequest​(@NotNull @NotNull java.util.Map<Filter,​java.lang.String> filters, @NotNull @NotNull java.util.List<Include> includes, @Nullable @Nullable java.lang.Boolean alternative) throws java.net.URISyntaxException
      Throws:
      java.net.URISyntaxException
    • convert

      public abstract TRAR convert​(@NotNull @NotNull ConvertFilesTaskRequest convertFilesTaskRequest) throws java.io.IOException, java.net.URISyntaxException
      Create a task to convert one input file from input_format to output_format. Requires the task.write scope.
      Parameters:
      convertFilesTaskRequest - ConvertFilesTaskRequest
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • convertFormats

      public abstract ORPAR convertFormats() throws java.io.IOException, java.net.URISyntaxException
      List all supported formats, their engines and possible options.
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • convertFormats

      public abstract ORPAR convertFormats​(@NotNull @NotNull java.util.Map<Filter,​java.lang.String> filters) throws java.io.IOException, java.net.URISyntaxException
      List all supported formats, their engines and possible options.
      Parameters:
      filters - (optional) Filters: - input_format - The result will be filtered to include only possible conversions with a matching input format. - output_format - The result will be filtered to include only possible conversions with a matching output format. - engine - Filter result to only include conversions with a matching engine name. - engine_version - Filter result to only include conversions with a matching engine version.
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • convertFormats

      public abstract ORPAR convertFormats​(@NotNull @NotNull java.util.Map<Filter,​java.lang.String> filters, @NotNull @NotNull java.util.List<Include> includes) throws java.io.IOException, java.net.URISyntaxException
      List all supported formats, their engines and possible options.
      Parameters:
      filters - (optional) Filters: - input_format - The result will be filtered to include only possible conversions with a matching input format. - output_format - The result will be filtered to include only possible conversions with a matching output format. - engine - Filter result to only include conversions with a matching engine name. - engine_version - Filter result to only include conversions with a matching engine version.
      includes - (optional) Include options and/or engine_versions in the result.
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • convertFormats

      public abstract ORPAR convertFormats​(@NotNull @NotNull java.util.Map<Filter,​java.lang.String> filters, @NotNull @NotNull java.util.List<Include> includes, @Nullable @Nullable java.lang.Boolean alternative) throws java.io.IOException, java.net.URISyntaxException
      List all supported formats, their engines and possible options.
      Parameters:
      filters - (optional) Filters: - input_format - The result will be filtered to include only possible conversions with a matching input format. - output_format - The result will be filtered to include only possible conversions with a matching output format. - engine - Filter result to only include conversions with a matching engine name. - engine_version - Filter result to only include conversions with a matching engine version.
      includes - (optional) Include options and/or engine_versions in the result.
      alternative - (optional) For some formats multiple alternative engines are available. If set to true, the result includes these alternative conversion types. Default to false.
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • optimize

      public abstract TRAR optimize​(@NotNull @NotNull OptimizeFilesTaskRequest optimizeFilesTaskRequest) throws java.io.IOException, java.net.URISyntaxException
      Create a task to optimize and compress a file. Currently supported formats are PDF, PNG and JPG.
      Parameters:
      optimizeFilesTaskRequest - OptimizeFilesTaskRequest
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • capture

      public abstract TRAR capture​(@NotNull @NotNull CaptureWebsitesTaskRequest captureWebsitesTaskRequest) throws java.io.IOException, java.net.URISyntaxException
      Create a task to convert a website to PDF or to capture a screenshot of a website (png, jpg).
      Parameters:
      captureWebsitesTaskRequest - CaptureWebsitesTaskRequest
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • merge

      public abstract TRAR merge​(@NotNull @NotNull MergeFilesTaskRequest mergeFilesTaskRequest) throws java.io.IOException, java.net.URISyntaxException
      Create a task to merge at least two files to one PDF. If input files are not PDFs yet, they are automatically converted to PDF.
      Parameters:
      mergeFilesTaskRequest - MergeFilesTaskRequest
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • archive

      public abstract TRAR archive​(@NotNull @NotNull CreateArchivesTaskRequest createArchivesTaskRequest) throws java.io.IOException, java.net.URISyntaxException
      Create a task to create a ZIP, RAR, 7Z, TAR, TAR.GZ or TAR.BZ2 archive.
      Parameters:
      createArchivesTaskRequest - CreateArchivesTaskRequest
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • command

      public abstract TRAR command​(@NotNull @NotNull ExecuteCommandsTaskRequest executeCommandsTaskRequest) throws java.io.IOException, java.net.URISyntaxException
      Create a task to execute a command. Currently, ffmpeg, imagemagick and graphicsmagick commands re supported. You can access the files from the input task in the /input/{taskName}/ (For example: /input/import-1/) directory. All files that are created in the /output/ directory are available for following tasks (e.g. export tasks).
      Parameters:
      executeCommandsTaskRequest - ExecuteCommandsTaskRequest
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • thumbnail

      public abstract TRAR thumbnail​(@NotNull @NotNull CreateThumbnailsTaskRequest createThumbnailsTaskRequest) throws java.io.IOException, java.net.URISyntaxException
      Create a task to convert one input file from input_format to output_format. Requires the task.write scope.
      Parameters:
      createThumbnailsTaskRequest - CreateThumbnailsTaskRequest
      Returns:
      AbstractTasksResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • close

      public void close() throws java.io.IOException
      Throws:
      java.io.IOException