All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.tnb.jira.validation.generated.api.TasksApi Maven / Gradle / Ivy

The newest version!
/*
 * The Jira Cloud platform REST API
 * Jira Cloud platform REST API documentation
 *
 * The version of the OpenAPI document: 1001.0.0-SNAPSHOT
 * Contact: [email protected]
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package software.tnb.jira.validation.generated.api;

import software.tnb.jira.validation.generated.ApiCallback;
import software.tnb.jira.validation.generated.ApiClient;
import software.tnb.jira.validation.generated.ApiException;
import software.tnb.jira.validation.generated.ApiResponse;
import software.tnb.jira.validation.generated.Configuration;
import software.tnb.jira.validation.generated.Pair;
import software.tnb.jira.validation.generated.ProgressRequestBody;
import software.tnb.jira.validation.generated.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import software.tnb.jira.validation.generated.model.TaskProgressBeanObject;

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

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

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

    public TasksApi(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 cancelTask
     * @param taskId The ID of the task. (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
     
Status Code Description Response Headers
202 Returned if the request is successful. -
400 Returned if cancellation of the task is not possible. -
401 Returned if the authentication credentials are incorrect or missing. -
403 Returned if the user does not have the necessary permission. -
404 Returned if the task is not found. -
*/ public okhttp3.Call cancelTaskCall(String taskId, 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 = "/rest/api/3/task/{taskId}/cancel" .replace("{" + "taskId" + "}", localVarApiClient.escapeString(taskId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); 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[] { "OAuth2", "basicAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call cancelTaskValidateBeforeCall(String taskId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'taskId' is set if (taskId == null) { throw new ApiException("Missing the required parameter 'taskId' when calling cancelTask(Async)"); } return cancelTaskCall(taskId, _callback); } /** * Cancel task * Cancels a task. **[Permissions](#permissions) required:** either of: * *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). * Creator of the task. * @param taskId The ID of the task. (required) * @return Object * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
202 Returned if the request is successful. -
400 Returned if cancellation of the task is not possible. -
401 Returned if the authentication credentials are incorrect or missing. -
403 Returned if the user does not have the necessary permission. -
404 Returned if the task is not found. -
*/ public Object cancelTask(String taskId) throws ApiException { ApiResponse localVarResp = cancelTaskWithHttpInfo(taskId); return localVarResp.getData(); } /** * Cancel task * Cancels a task. **[Permissions](#permissions) required:** either of: * *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). * Creator of the task. * @param taskId The ID of the task. (required) * @return ApiResponse<Object> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
202 Returned if the request is successful. -
400 Returned if cancellation of the task is not possible. -
401 Returned if the authentication credentials are incorrect or missing. -
403 Returned if the user does not have the necessary permission. -
404 Returned if the task is not found. -
*/ public ApiResponse cancelTaskWithHttpInfo(String taskId) throws ApiException { okhttp3.Call localVarCall = cancelTaskValidateBeforeCall(taskId, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Cancel task (asynchronously) * Cancels a task. **[Permissions](#permissions) required:** either of: * *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). * Creator of the task. * @param taskId The ID of the task. (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
Status Code Description Response Headers
202 Returned if the request is successful. -
400 Returned if cancellation of the task is not possible. -
401 Returned if the authentication credentials are incorrect or missing. -
403 Returned if the user does not have the necessary permission. -
404 Returned if the task is not found. -
*/ public okhttp3.Call cancelTaskAsync(String taskId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = cancelTaskValidateBeforeCall(taskId, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getTask * @param taskId The ID of the task. (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
Status Code Description Response Headers
200 Returned if the request is successful. -
401 Returned if the authentication credentials are incorrect or missing. -
403 Returned if the user does not have the necessary permission. -
404 Returned if the task is not found. -
*/ public okhttp3.Call getTaskCall(String taskId, 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 = "/rest/api/3/task/{taskId}" .replace("{" + "taskId" + "}", localVarApiClient.escapeString(taskId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); 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[] { "OAuth2", "basicAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call getTaskValidateBeforeCall(String taskId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'taskId' is set if (taskId == null) { throw new ApiException("Missing the required parameter 'taskId' when calling getTask(Async)"); } return getTaskCall(taskId, _callback); } /** * Get task * Returns the status of a [long-running asynchronous task](#async). When a task has finished, this operation returns the JSON blob applicable to the task. See the documentation of the operation that created the task for details. Task details are not permanently retained. As of September 2019, details are retained for 14 days although this period may change without notice. **[Permissions](#permissions) required:** either of: * *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). * Creator of the task. * @param taskId The ID of the task. (required) * @return TaskProgressBeanObject * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 Returned if the request is successful. -
401 Returned if the authentication credentials are incorrect or missing. -
403 Returned if the user does not have the necessary permission. -
404 Returned if the task is not found. -
*/ public TaskProgressBeanObject getTask(String taskId) throws ApiException { ApiResponse localVarResp = getTaskWithHttpInfo(taskId); return localVarResp.getData(); } /** * Get task * Returns the status of a [long-running asynchronous task](#async). When a task has finished, this operation returns the JSON blob applicable to the task. See the documentation of the operation that created the task for details. Task details are not permanently retained. As of September 2019, details are retained for 14 days although this period may change without notice. **[Permissions](#permissions) required:** either of: * *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). * Creator of the task. * @param taskId The ID of the task. (required) * @return ApiResponse<TaskProgressBeanObject> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 Returned if the request is successful. -
401 Returned if the authentication credentials are incorrect or missing. -
403 Returned if the user does not have the necessary permission. -
404 Returned if the task is not found. -
*/ public ApiResponse getTaskWithHttpInfo(String taskId) throws ApiException { okhttp3.Call localVarCall = getTaskValidateBeforeCall(taskId, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Get task (asynchronously) * Returns the status of a [long-running asynchronous task](#async). When a task has finished, this operation returns the JSON blob applicable to the task. See the documentation of the operation that created the task for details. Task details are not permanently retained. As of September 2019, details are retained for 14 days although this period may change without notice. **[Permissions](#permissions) required:** either of: * *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). * Creator of the task. * @param taskId The ID of the task. (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
Status Code Description Response Headers
200 Returned if the request is successful. -
401 Returned if the authentication credentials are incorrect or missing. -
403 Returned if the user does not have the necessary permission. -
404 Returned if the task is not found. -
*/ public okhttp3.Call getTaskAsync(String taskId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getTaskValidateBeforeCall(taskId, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } }