Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarifies async nature of jobs().create(...) #19

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions src/main/java/com/zamzar/api/JobsService.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,42 +66,57 @@ public JobManager cancel(Integer id) throws ApiException {
}

/**
* Starts a job to convert a local file.
* Starts a job to convert a local file, returning once the job has been created.
* <p>
* Call {@link JobManager#awaitOrThrow()} on the returned object to block until the job has completed.
*/
public JobManager create(File source, String targetFormat) throws ApiException {
return create(source, targetFormat, JobBuilder.Modifier.identity());
}

/**
* Starts a job to convert a local file, with a customised job builder.
* Starts a job to convert a local file, with a customised job builder; returning once the job has been created.
* <p>
* Call {@link JobManager#awaitOrThrow()} on the returned object to block until the job has completed.
*/
public JobManager create(File source, String targetFormat, JobBuilder.Modifier modifier) throws ApiException {
return create(modifier.modify(new JobBuilder(source, targetFormat)));
}

/**
* Starts a job to convert a file already resident on the Zamzar API servers.
* Starts a job to convert a file already resident on the Zamzar API servers; returning once the job has been
* created.
* <p>
* Call {@link JobManager#awaitOrThrow()} on the returned object to block until the job has completed.
*/
public JobManager create(Integer sourceId, String targetFormat) throws ApiException {
return create(sourceId, targetFormat, JobBuilder.Modifier.identity());
}

/**
* Starts a job to convert a file already resident on the Zamzar API servers, with a customised job builder.
* Returns once the job has been created.
* <p>
* Call {@link JobManager#awaitOrThrow()} on the returned object to block until the job has completed.
*/
public JobManager create(Integer sourceId, String targetFormat, JobBuilder.Modifier modifier) throws ApiException {
return create(modifier.modify(new JobBuilder(sourceId, targetFormat)));
}

/**
* Starts a job to convert a file from a URL.
* Starts a job to convert a file from a URL, returning once the job has been created.
* <p>
* Call {@link JobManager#awaitOrThrow()} on the returned object to block until the job has completed.
*/
public JobManager create(URI source, String targetFormat) throws ApiException {
return create(source, targetFormat, JobBuilder.Modifier.identity());
}

/**
* Starts a job to convert a file from a URL, with a customised job builder.
* Starts a job to convert a file from a URL, with a customised job builder; returning once the job has been
* created.
* <p>
* Call {@link JobManager#awaitOrThrow()} on the returned object to block until the job has completed.
*/
public JobManager create(URI source, String targetFormat, JobBuilder.Modifier modifier) throws ApiException {
return create(modifier.modify(new JobBuilder(source, targetFormat)));
Expand Down