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

Adds support for listing successful jobs #17

Merged
merged 2 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions src/main/java/com/zamzar/api/JobsService.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ protected JobsService(ZamzarClient zamzar) {
this.api = new JobsApi(zamzar.client);
}


/**
* Retrieves a service for managing successful jobs.
*/
public SuccessfulJobsService successful() {
return new SuccessfulJobsService(zamzar);
}

/**
* Retrieves a job by its ID.
*/
Expand Down
50 changes: 50 additions & 0 deletions src/main/java/com/zamzar/api/SuccessfulJobsService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.zamzar.api;

import com.zamzar.api.core.JobsApi;
import com.zamzar.api.internal.Listable;
import com.zamzar.api.invoker.ApiException;
import com.zamzar.api.model.Job;
import com.zamzar.api.model.Jobs;
import com.zamzar.api.pagination.Anchor;
import com.zamzar.api.pagination.Paged;
import com.zamzar.api.pagination.Paging;

import java.util.List;
import java.util.stream.Collectors;

/**
* Retrieves information about existing successful jobs on the Zamzar API servers.
*/
public class SuccessfulJobsService implements Listable<JobManager, Integer> {

protected final ZamzarClient zamzar;
protected final JobsApi api;

protected SuccessfulJobsService(ZamzarClient zamzar) {
this.zamzar = zamzar;
this.api = new JobsApi(zamzar.client);
}

/**
* Retrieves a list of successful jobs.
*
* @param anchor indicates the position in the list from which to start retrieving jobs
* @param limit indicates the maximum number of jobs to retrieve
*/
@Override
public Paged<JobManager, Integer> list(Anchor<Integer> anchor, Integer limit) throws ApiException {
final Integer after = anchor == null ? null : anchor.getAfterParameterValue();
final Integer before = anchor == null ? null : anchor.getBeforeParameterValue();

final Jobs response = api.listSuccessfulJobs(limit, after, before);
return new Paged<>(this, toJobs(response.getData()), Paging.fromNumeric(response.getPaging()));
}

protected List<JobManager> toJobs(List<Job> models) {
return models.stream().map(this::toJob).collect(Collectors.toList());
}

protected JobManager toJob(Job model) {
return new JobManager(zamzar, model);
}
}
2 changes: 1 addition & 1 deletion src/main/java/com/zamzar/api/core/AccountApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Zamzar API
* Zamzar provides a simple API for fast, scalable, high-quality file conversion for 100s of formats.
*
* The version of the OpenAPI document: 0.0.5
* The version of the OpenAPI document: 0.0.6
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/zamzar/api/core/FilesApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Zamzar API
* Zamzar provides a simple API for fast, scalable, high-quality file conversion for 100s of formats.
*
* The version of the OpenAPI document: 0.0.5
* The version of the OpenAPI document: 0.0.6
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/zamzar/api/core/FormatsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Zamzar API
* Zamzar provides a simple API for fast, scalable, high-quality file conversion for 100s of formats.
*
* The version of the OpenAPI document: 0.0.5
* The version of the OpenAPI document: 0.0.6
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/zamzar/api/core/ImportsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Zamzar API
* Zamzar provides a simple API for fast, scalable, high-quality file conversion for 100s of formats.
*
* The version of the OpenAPI document: 0.0.5
* The version of the OpenAPI document: 0.0.6
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
139 changes: 138 additions & 1 deletion src/main/java/com/zamzar/api/core/JobsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Zamzar API
* Zamzar provides a simple API for fast, scalable, high-quality file conversion for 100s of formats.
*
* The version of the OpenAPI document: 0.0.5
* The version of the OpenAPI document: 0.0.6
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down Expand Up @@ -456,6 +456,143 @@ public okhttp3.Call listJobsAsync(Integer limit, Integer after, Integer before,
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for listSuccessfulJobs
* @param limit Limit the number of results (max 50) (optional, default to 50)
* @param after Retrieve jobs after the specified jobId (optional)
* @param before Retrieve jobs after the specified jobId (optional)
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> A list of all successful jobs. </td><td> - </td></tr>
</table>
*/
public okhttp3.Call listSuccessfulJobsCall(Integer limit, Integer after, Integer before, final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };

// Determine Base Path to Use
if (localCustomBaseUrl != null){
basePath = localCustomBaseUrl;
} else if ( localBasePaths.length > 0 ) {
basePath = localBasePaths[localHostIndex];
} else {
basePath = null;
}

Object localVarPostBody = null;

// create path and map variables
String localVarPath = "/jobs/successful";

List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, String> localVarCookieParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();

if (limit != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit));
}

if (after != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("after", after));
}

if (before != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("before", before));
}

final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}

final String[] localVarContentTypes = {
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
localVarHeaderParams.put("Content-Type", localVarContentType);
}

String[] localVarAuthNames = new String[] { "ApiKeyAuth" };
return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}

@SuppressWarnings("rawtypes")
private okhttp3.Call listSuccessfulJobsValidateBeforeCall(Integer limit, Integer after, Integer before, final ApiCallback _callback) throws ApiException {
return listSuccessfulJobsCall(limit, after, before, _callback);

}

/**
* Retrieve a list of all successful jobs
* Retrieve a list of all successful jobs
* @param limit Limit the number of results (max 50) (optional, default to 50)
* @param after Retrieve jobs after the specified jobId (optional)
* @param before Retrieve jobs after the specified jobId (optional)
* @return Jobs
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> A list of all successful jobs. </td><td> - </td></tr>
</table>
*/
public Jobs listSuccessfulJobs(Integer limit, Integer after, Integer before) throws ApiException {
ApiResponse<Jobs> localVarResp = listSuccessfulJobsWithHttpInfo(limit, after, before);
return localVarResp.getData();
}

/**
* Retrieve a list of all successful jobs
* Retrieve a list of all successful jobs
* @param limit Limit the number of results (max 50) (optional, default to 50)
* @param after Retrieve jobs after the specified jobId (optional)
* @param before Retrieve jobs after the specified jobId (optional)
* @return ApiResponse&lt;Jobs&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> A list of all successful jobs. </td><td> - </td></tr>
</table>
*/
public ApiResponse<Jobs> listSuccessfulJobsWithHttpInfo(Integer limit, Integer after, Integer before) throws ApiException {
okhttp3.Call localVarCall = listSuccessfulJobsValidateBeforeCall(limit, after, before, null);
Type localVarReturnType = new TypeToken<Jobs>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}

/**
* Retrieve a list of all successful jobs (asynchronously)
* Retrieve a list of all successful jobs
* @param limit Limit the number of results (max 50) (optional, default to 50)
* @param after Retrieve jobs after the specified jobId (optional)
* @param before Retrieve jobs after the specified jobId (optional)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> A list of all successful jobs. </td><td> - </td></tr>
</table>
*/
public okhttp3.Call listSuccessfulJobsAsync(Integer limit, Integer after, Integer before, final ApiCallback<Jobs> _callback) throws ApiException {

okhttp3.Call localVarCall = listSuccessfulJobsValidateBeforeCall(limit, after, before, _callback);
Type localVarReturnType = new TypeToken<Jobs>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for submitJob
* @param sourceFile ID of the source file (optional)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/zamzar/api/core/WelcomeApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Zamzar API
* Zamzar provides a simple API for fast, scalable, high-quality file conversion for 100s of formats.
*
* The version of the OpenAPI document: 0.0.5
* The version of the OpenAPI document: 0.0.6
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/zamzar/api/invoker/ApiCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Zamzar API
* Zamzar provides a simple API for fast, scalable, high-quality file conversion for 100s of formats.
*
* The version of the OpenAPI document: 0.0.5
* The version of the OpenAPI document: 0.0.6
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/zamzar/api/invoker/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Zamzar API
* Zamzar provides a simple API for fast, scalable, high-quality file conversion for 100s of formats.
*
* The version of the OpenAPI document: 0.0.5
* The version of the OpenAPI document: 0.0.6
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/zamzar/api/invoker/ApiException.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Zamzar API
* Zamzar provides a simple API for fast, scalable, high-quality file conversion for 100s of formats.
*
* The version of the OpenAPI document: 0.0.5
* The version of the OpenAPI document: 0.0.6
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/zamzar/api/invoker/ApiResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Zamzar API
* Zamzar provides a simple API for fast, scalable, high-quality file conversion for 100s of formats.
*
* The version of the OpenAPI document: 0.0.5
* The version of the OpenAPI document: 0.0.6
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/zamzar/api/invoker/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Zamzar API
* Zamzar provides a simple API for fast, scalable, high-quality file conversion for 100s of formats.
*
* The version of the OpenAPI document: 0.0.5
* The version of the OpenAPI document: 0.0.6
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Zamzar API
* Zamzar provides a simple API for fast, scalable, high-quality file conversion for 100s of formats.
*
* The version of the OpenAPI document: 0.0.5
* The version of the OpenAPI document: 0.0.6
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/zamzar/api/invoker/JSON.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Zamzar API
* Zamzar provides a simple API for fast, scalable, high-quality file conversion for 100s of formats.
*
* The version of the OpenAPI document: 0.0.5
* The version of the OpenAPI document: 0.0.6
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/zamzar/api/invoker/Pair.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Zamzar API
* Zamzar provides a simple API for fast, scalable, high-quality file conversion for 100s of formats.
*
* The version of the OpenAPI document: 0.0.5
* The version of the OpenAPI document: 0.0.6
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Zamzar API
* Zamzar provides a simple API for fast, scalable, high-quality file conversion for 100s of formats.
*
* The version of the OpenAPI document: 0.0.5
* The version of the OpenAPI document: 0.0.6
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Zamzar API
* Zamzar provides a simple API for fast, scalable, high-quality file conversion for 100s of formats.
*
* The version of the OpenAPI document: 0.0.5
* The version of the OpenAPI document: 0.0.6
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/zamzar/api/invoker/StringUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Zamzar API
* Zamzar provides a simple API for fast, scalable, high-quality file conversion for 100s of formats.
*
* The version of the OpenAPI document: 0.0.5
* The version of the OpenAPI document: 0.0.6
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/zamzar/api/invoker/auth/ApiKeyAuth.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Zamzar API
* Zamzar provides a simple API for fast, scalable, high-quality file conversion for 100s of formats.
*
* The version of the OpenAPI document: 0.0.5
* The version of the OpenAPI document: 0.0.6
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Zamzar API
* Zamzar provides a simple API for fast, scalable, high-quality file conversion for 100s of formats.
*
* The version of the OpenAPI document: 0.0.5
* The version of the OpenAPI document: 0.0.6
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Zamzar API
* Zamzar provides a simple API for fast, scalable, high-quality file conversion for 100s of formats.
*
* The version of the OpenAPI document: 0.0.5
* The version of the OpenAPI document: 0.0.6
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Zamzar API
* Zamzar provides a simple API for fast, scalable, high-quality file conversion for 100s of formats.
*
* The version of the OpenAPI document: 0.0.5
* The version of the OpenAPI document: 0.0.6
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Loading