Class AsyncJobsResource

java.lang.Object
All Implemented Interfaces:
java.io.Closeable, java.lang.AutoCloseable

public class AsyncJobsResource
extends AbstractJobsResource<AsyncResult<JobResponse>,​AsyncResult<Pageable<JobResponse>>,​AsyncResult<java.lang.Void>>
  • Constructor Details

  • Method Details

    • create

      public AsyncResult<JobResponse> create​(@NotNull @NotNull java.util.Map<java.lang.String,​TaskRequest> tasks) throws java.io.IOException, java.net.URISyntaxException
      Description copied from class: AbstractJobsResource
      Create a job with one ore more tasks. Requires the task.write scope.
      Specified by:
      create in class AbstractJobsResource<AsyncResult<JobResponse>,​AsyncResult<Pageable<JobResponse>>,​AsyncResult<java.lang.Void>>
      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
    • create

      public AsyncResult<JobResponse> create​(@NotNull @NotNull java.util.Map<java.lang.String,​TaskRequest> tasks, @NotNull @NotNull java.lang.String tag) throws java.io.IOException, java.net.URISyntaxException
      Description copied from class: AbstractJobsResource
      Create a job with one ore more tasks. Requires the task.write scope.
      Specified by:
      create in class AbstractJobsResource<AsyncResult<JobResponse>,​AsyncResult<Pageable<JobResponse>>,​AsyncResult<java.lang.Void>>
      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
    • show

      public AsyncResult<JobResponse> show​(@NotNull @NotNull java.lang.String jobId) throws java.io.IOException, java.net.URISyntaxException
      Description copied from class: AbstractJobsResource
      Show a job. Requires the task.read scope.
      Specified by:
      show in class AbstractJobsResource<AsyncResult<JobResponse>,​AsyncResult<Pageable<JobResponse>>,​AsyncResult<java.lang.Void>>
      Parameters:
      jobId - job id
      Returns:
      AbstractJobsResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • wait

      public AsyncResult<JobResponse> wait​(@NotNull @NotNull java.lang.String jobId) throws java.io.IOException, java.net.URISyntaxException
      Description copied from class: AbstractJobsResource
      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.

      Specified by:
      wait in class AbstractJobsResource<AsyncResult<JobResponse>,​AsyncResult<Pageable<JobResponse>>,​AsyncResult<java.lang.Void>>
      Parameters:
      jobId - job id
      Returns:
      AbstractJobsResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • list

      public AsyncResult<Pageable<JobResponse>> list() throws java.io.IOException, java.net.URISyntaxException
      Description copied from class: AbstractJobsResource
      List all jobs. Requires the task.read scope.
      Specified by:
      list in class AbstractJobsResource<AsyncResult<JobResponse>,​AsyncResult<Pageable<JobResponse>>,​AsyncResult<java.lang.Void>>
      Returns:
      AbstractJobsResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • list

      public AsyncResult<Pageable<JobResponse>> list​(@NotNull @NotNull java.util.Map<Filter,​java.lang.String> filters) throws java.io.IOException, java.net.URISyntaxException
      Description copied from class: AbstractJobsResource
      List all jobs. Requires the task.read scope.
      Specified by:
      list in class AbstractJobsResource<AsyncResult<JobResponse>,​AsyncResult<Pageable<JobResponse>>,​AsyncResult<java.lang.Void>>
      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
    • list

      public AsyncResult<Pageable<JobResponse>> 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
      Description copied from class: AbstractJobsResource
      List all jobs. Requires the task.read scope.
      Specified by:
      list in class AbstractJobsResource<AsyncResult<JobResponse>,​AsyncResult<Pageable<JobResponse>>,​AsyncResult<java.lang.Void>>
      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
    • list

      public AsyncResult<Pageable<JobResponse>> 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
      Description copied from class: AbstractJobsResource
      List all jobs. Requires the task.read scope.
      Specified by:
      list in class AbstractJobsResource<AsyncResult<JobResponse>,​AsyncResult<Pageable<JobResponse>>,​AsyncResult<java.lang.Void>>
      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
    • delete

      public AsyncResult<java.lang.Void> delete​(@NotNull @NotNull java.lang.String jobId) throws java.io.IOException, java.net.URISyntaxException
      Description copied from class: AbstractJobsResource
      Delete a job, including all tasks and data. Requires the task.write scope. Jobs are deleted automatically 24 hours after they have ended.
      Specified by:
      delete in class AbstractJobsResource<AsyncResult<JobResponse>,​AsyncResult<Pageable<JobResponse>>,​AsyncResult<java.lang.Void>>
      Parameters:
      jobId - job id
      Returns:
      AbstractJobsResource
      Throws:
      java.io.IOException
      java.net.URISyntaxException
    • close

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