/*
 * Daytona
 * Daytona AI platform API Docs
 *
 * The version of the OpenAPI document: 1.0
 * Contact: support@daytona.com
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package io.daytona.api.client.api;

import io.daytona.api.client.ApiCallback;
import io.daytona.api.client.ApiClient;
import io.daytona.api.client.ApiException;
import io.daytona.api.client.ApiResponse;
import io.daytona.api.client.Configuration;
import io.daytona.api.client.Pair;
import io.daytona.api.client.ProgressRequestBody;
import io.daytona.api.client.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import java.math.BigDecimal;
import io.daytona.api.client.model.Job;
import io.daytona.api.client.model.JobStatus;
import io.daytona.api.client.model.PaginatedJobs;
import io.daytona.api.client.model.PollJobsResponse;
import io.daytona.api.client.model.UpdateJobStatus;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class JobsApi {
    private ApiClient localVarApiClient;
    private int localHostIndex;
    private String localCustomBaseUrl;

    public JobsApi() {
        this(Configuration.getDefaultApiClient());
    }

    public JobsApi(ApiClient apiClient) {
        this.localVarApiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return localVarApiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.localVarApiClient = apiClient;
    }

    public int getHostIndex() {
        return localHostIndex;
    }

    public void setHostIndex(int hostIndex) {
        this.localHostIndex = hostIndex;
    }

    public String getCustomBaseUrl() {
        return localCustomBaseUrl;
    }

    public void setCustomBaseUrl(String customBaseUrl) {
        this.localCustomBaseUrl = customBaseUrl;
    }

    /**
     * Build call for getJob
     * @param jobId ID of the job (required)
     * @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 border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Job details </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getJobCall(@javax.annotation.Nonnull String jobId, 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/{jobId}"
            .replace("{" + "jobId" + "}", localVarApiClient.escapeString(jobId.toString()));

        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>();

        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[] { "bearer", "oauth2" };
        return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getJobValidateBeforeCall(@javax.annotation.Nonnull String jobId, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'jobId' is set
        if (jobId == null) {
            throw new ApiException("Missing the required parameter 'jobId' when calling getJob(Async)");
        }

        return getJobCall(jobId, _callback);

    }

    /**
     * Get job details
     * 
     * @param jobId ID of the job (required)
     * @return Job
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Job details </td><td>  -  </td></tr>
     </table>
     */
    public Job getJob(@javax.annotation.Nonnull String jobId) throws ApiException {
        ApiResponse<Job> localVarResp = getJobWithHttpInfo(jobId);
        return localVarResp.getData();
    }

    /**
     * Get job details
     * 
     * @param jobId ID of the job (required)
     * @return ApiResponse&lt;Job&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Job details </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<Job> getJobWithHttpInfo(@javax.annotation.Nonnull String jobId) throws ApiException {
        okhttp3.Call localVarCall = getJobValidateBeforeCall(jobId, null);
        Type localVarReturnType = new TypeToken<Job>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Get job details (asynchronously)
     * 
     * @param jobId ID of the job (required)
     * @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 border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Job details </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getJobAsync(@javax.annotation.Nonnull String jobId, final ApiCallback<Job> _callback) throws ApiException {

        okhttp3.Call localVarCall = getJobValidateBeforeCall(jobId, _callback);
        Type localVarReturnType = new TypeToken<Job>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for listJobs
     * @param page Page number of the results (optional, default to 1)
     * @param limit Maximum number of jobs to return (default: 100, max: 500) (optional, default to 100)
     * @param status Filter jobs by status (optional)
     * @param offset Number of jobs to skip for pagination (default: 0) (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 border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> List of jobs for the runner </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call listJobsCall(@javax.annotation.Nullable BigDecimal page, @javax.annotation.Nullable BigDecimal limit, @javax.annotation.Nullable JobStatus status, @javax.annotation.Nullable BigDecimal offset, 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";

        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 (page != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("page", page));
        }

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

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

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

        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[] { "bearer", "oauth2" };
        return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call listJobsValidateBeforeCall(@javax.annotation.Nullable BigDecimal page, @javax.annotation.Nullable BigDecimal limit, @javax.annotation.Nullable JobStatus status, @javax.annotation.Nullable BigDecimal offset, final ApiCallback _callback) throws ApiException {
        return listJobsCall(page, limit, status, offset, _callback);

    }

    /**
     * List jobs for the runner
     * Returns a paginated list of jobs for the runner, optionally filtered by status.
     * @param page Page number of the results (optional, default to 1)
     * @param limit Maximum number of jobs to return (default: 100, max: 500) (optional, default to 100)
     * @param status Filter jobs by status (optional)
     * @param offset Number of jobs to skip for pagination (default: 0) (optional)
     * @return PaginatedJobs
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> List of jobs for the runner </td><td>  -  </td></tr>
     </table>
     */
    public PaginatedJobs listJobs(@javax.annotation.Nullable BigDecimal page, @javax.annotation.Nullable BigDecimal limit, @javax.annotation.Nullable JobStatus status, @javax.annotation.Nullable BigDecimal offset) throws ApiException {
        ApiResponse<PaginatedJobs> localVarResp = listJobsWithHttpInfo(page, limit, status, offset);
        return localVarResp.getData();
    }

    /**
     * List jobs for the runner
     * Returns a paginated list of jobs for the runner, optionally filtered by status.
     * @param page Page number of the results (optional, default to 1)
     * @param limit Maximum number of jobs to return (default: 100, max: 500) (optional, default to 100)
     * @param status Filter jobs by status (optional)
     * @param offset Number of jobs to skip for pagination (default: 0) (optional)
     * @return ApiResponse&lt;PaginatedJobs&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> List of jobs for the runner </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<PaginatedJobs> listJobsWithHttpInfo(@javax.annotation.Nullable BigDecimal page, @javax.annotation.Nullable BigDecimal limit, @javax.annotation.Nullable JobStatus status, @javax.annotation.Nullable BigDecimal offset) throws ApiException {
        okhttp3.Call localVarCall = listJobsValidateBeforeCall(page, limit, status, offset, null);
        Type localVarReturnType = new TypeToken<PaginatedJobs>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * List jobs for the runner (asynchronously)
     * Returns a paginated list of jobs for the runner, optionally filtered by status.
     * @param page Page number of the results (optional, default to 1)
     * @param limit Maximum number of jobs to return (default: 100, max: 500) (optional, default to 100)
     * @param status Filter jobs by status (optional)
     * @param offset Number of jobs to skip for pagination (default: 0) (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 border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> List of jobs for the runner </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call listJobsAsync(@javax.annotation.Nullable BigDecimal page, @javax.annotation.Nullable BigDecimal limit, @javax.annotation.Nullable JobStatus status, @javax.annotation.Nullable BigDecimal offset, final ApiCallback<PaginatedJobs> _callback) throws ApiException {

        okhttp3.Call localVarCall = listJobsValidateBeforeCall(page, limit, status, offset, _callback);
        Type localVarReturnType = new TypeToken<PaginatedJobs>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for pollJobs
     * @param timeout Timeout in seconds for long polling (default: 30, max: 60) (optional)
     * @param limit Maximum number of jobs to return (default: 10, max: 100) (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 border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> List of jobs for the runner </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call pollJobsCall(@javax.annotation.Nullable BigDecimal timeout, @javax.annotation.Nullable BigDecimal limit, 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/poll";

        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 (timeout != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("timeout", timeout));
        }

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

        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[] { "bearer", "oauth2" };
        return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call pollJobsValidateBeforeCall(@javax.annotation.Nullable BigDecimal timeout, @javax.annotation.Nullable BigDecimal limit, final ApiCallback _callback) throws ApiException {
        return pollJobsCall(timeout, limit, _callback);

    }

    /**
     * Long poll for jobs
     * Long poll endpoint for runners to fetch pending jobs. Returns immediately if jobs are available, otherwise waits up to timeout seconds.
     * @param timeout Timeout in seconds for long polling (default: 30, max: 60) (optional)
     * @param limit Maximum number of jobs to return (default: 10, max: 100) (optional)
     * @return PollJobsResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> List of jobs for the runner </td><td>  -  </td></tr>
     </table>
     */
    public PollJobsResponse pollJobs(@javax.annotation.Nullable BigDecimal timeout, @javax.annotation.Nullable BigDecimal limit) throws ApiException {
        ApiResponse<PollJobsResponse> localVarResp = pollJobsWithHttpInfo(timeout, limit);
        return localVarResp.getData();
    }

    /**
     * Long poll for jobs
     * Long poll endpoint for runners to fetch pending jobs. Returns immediately if jobs are available, otherwise waits up to timeout seconds.
     * @param timeout Timeout in seconds for long polling (default: 30, max: 60) (optional)
     * @param limit Maximum number of jobs to return (default: 10, max: 100) (optional)
     * @return ApiResponse&lt;PollJobsResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> List of jobs for the runner </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<PollJobsResponse> pollJobsWithHttpInfo(@javax.annotation.Nullable BigDecimal timeout, @javax.annotation.Nullable BigDecimal limit) throws ApiException {
        okhttp3.Call localVarCall = pollJobsValidateBeforeCall(timeout, limit, null);
        Type localVarReturnType = new TypeToken<PollJobsResponse>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Long poll for jobs (asynchronously)
     * Long poll endpoint for runners to fetch pending jobs. Returns immediately if jobs are available, otherwise waits up to timeout seconds.
     * @param timeout Timeout in seconds for long polling (default: 30, max: 60) (optional)
     * @param limit Maximum number of jobs to return (default: 10, max: 100) (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 border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> List of jobs for the runner </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call pollJobsAsync(@javax.annotation.Nullable BigDecimal timeout, @javax.annotation.Nullable BigDecimal limit, final ApiCallback<PollJobsResponse> _callback) throws ApiException {

        okhttp3.Call localVarCall = pollJobsValidateBeforeCall(timeout, limit, _callback);
        Type localVarReturnType = new TypeToken<PollJobsResponse>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for updateJobStatus
     * @param jobId ID of the job (required)
     * @param updateJobStatus  (required)
     * @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 border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Job status updated successfully </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call updateJobStatusCall(@javax.annotation.Nonnull String jobId, @javax.annotation.Nonnull UpdateJobStatus updateJobStatus, 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 = updateJobStatus;

        // create path and map variables
        String localVarPath = "/jobs/{jobId}/status"
            .replace("{" + "jobId" + "}", localVarApiClient.escapeString(jobId.toString()));

        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>();

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

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

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

    @SuppressWarnings("rawtypes")
    private okhttp3.Call updateJobStatusValidateBeforeCall(@javax.annotation.Nonnull String jobId, @javax.annotation.Nonnull UpdateJobStatus updateJobStatus, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'jobId' is set
        if (jobId == null) {
            throw new ApiException("Missing the required parameter 'jobId' when calling updateJobStatus(Async)");
        }

        // verify the required parameter 'updateJobStatus' is set
        if (updateJobStatus == null) {
            throw new ApiException("Missing the required parameter 'updateJobStatus' when calling updateJobStatus(Async)");
        }

        return updateJobStatusCall(jobId, updateJobStatus, _callback);

    }

    /**
     * Update job status
     * 
     * @param jobId ID of the job (required)
     * @param updateJobStatus  (required)
     * @return Job
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Job status updated successfully </td><td>  -  </td></tr>
     </table>
     */
    public Job updateJobStatus(@javax.annotation.Nonnull String jobId, @javax.annotation.Nonnull UpdateJobStatus updateJobStatus) throws ApiException {
        ApiResponse<Job> localVarResp = updateJobStatusWithHttpInfo(jobId, updateJobStatus);
        return localVarResp.getData();
    }

    /**
     * Update job status
     * 
     * @param jobId ID of the job (required)
     * @param updateJobStatus  (required)
     * @return ApiResponse&lt;Job&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Job status updated successfully </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<Job> updateJobStatusWithHttpInfo(@javax.annotation.Nonnull String jobId, @javax.annotation.Nonnull UpdateJobStatus updateJobStatus) throws ApiException {
        okhttp3.Call localVarCall = updateJobStatusValidateBeforeCall(jobId, updateJobStatus, null);
        Type localVarReturnType = new TypeToken<Job>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Update job status (asynchronously)
     * 
     * @param jobId ID of the job (required)
     * @param updateJobStatus  (required)
     * @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 border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Job status updated successfully </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call updateJobStatusAsync(@javax.annotation.Nonnull String jobId, @javax.annotation.Nonnull UpdateJobStatus updateJobStatus, final ApiCallback<Job> _callback) throws ApiException {

        okhttp3.Call localVarCall = updateJobStatusValidateBeforeCall(jobId, updateJobStatus, _callback);
        Type localVarReturnType = new TypeToken<Job>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
}
