/*
 * WSO2 API Manager - Governance
 * This document specifies a **RESTful API** for WSO2 **API Manager** - Governance. 
 *
 * The version of the OpenAPI document: v1.1
 * Contact: architecture@wso2.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 org.wso2.am.integration.clients.governance.api;

import org.wso2.am.integration.clients.governance.ApiCallback;
import org.wso2.am.integration.clients.governance.ApiClient;
import org.wso2.am.integration.clients.governance.ApiException;
import org.wso2.am.integration.clients.governance.ApiResponse;
import org.wso2.am.integration.clients.governance.Configuration;
import org.wso2.am.integration.clients.governance.Pair;
import org.wso2.am.integration.clients.governance.ProgressRequestBody;
import org.wso2.am.integration.clients.governance.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import org.wso2.am.integration.clients.governance.api.dto.ErrorDTO;
import java.io.File;
import org.wso2.am.integration.clients.governance.api.dto.RulesetInfoDTO;
import org.wso2.am.integration.clients.governance.api.dto.RulesetListDTO;

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

public class RulesetsApi {
    private ApiClient localVarApiClient;

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

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

    public ApiClient getApiClient() {
        return localVarApiClient;
    }

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

    /**
     * Build call for createRuleset
     * @param name Name of the ruleset. (required)
     * @param rulesetContent The content of the ruleset file (YAML or JSON). (required)
     * @param ruleType Context or area to which the ruleset applies. (required)
     * @param artifactType The type of artifact that the ruleset validates. (required)
     * @param description A brief description of the ruleset. (optional)
     * @param ruleCategory Category the rules included in ruleset. (optional, default to SPECTRAL)
     * @param documentationLink URL to the documentation related to the ruleset. (optional)
     * @param provider Entity or individual providing the ruleset. (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> 201 </td><td> OK. Ruleset created successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call createRulesetCall(String name, File rulesetContent, String ruleType, String artifactType, String description, String ruleCategory, String documentationLink, String provider, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/rulesets";

        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 (name != null) {
            localVarFormParams.put("name", name);
        }

        if (description != null) {
            localVarFormParams.put("description", description);
        }

        if (rulesetContent != null) {
            localVarFormParams.put("rulesetContent", rulesetContent);
        }

        if (ruleCategory != null) {
            localVarFormParams.put("ruleCategory", ruleCategory);
        }

        if (ruleType != null) {
            localVarFormParams.put("ruleType", ruleType);
        }

        if (artifactType != null) {
            localVarFormParams.put("artifactType", artifactType);
        }

        if (documentationLink != null) {
            localVarFormParams.put("documentationLink", documentationLink);
        }

        if (provider != null) {
            localVarFormParams.put("provider", provider);
        }

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

        final String[] localVarContentTypes = {
            "multipart/form-data"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

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

    @SuppressWarnings("rawtypes")
    private okhttp3.Call createRulesetValidateBeforeCall(String name, File rulesetContent, String ruleType, String artifactType, String description, String ruleCategory, String documentationLink, String provider, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'name' is set
        if (name == null) {
            throw new ApiException("Missing the required parameter 'name' when calling createRuleset(Async)");
        }
        
        // verify the required parameter 'rulesetContent' is set
        if (rulesetContent == null) {
            throw new ApiException("Missing the required parameter 'rulesetContent' when calling createRuleset(Async)");
        }
        
        // verify the required parameter 'ruleType' is set
        if (ruleType == null) {
            throw new ApiException("Missing the required parameter 'ruleType' when calling createRuleset(Async)");
        }
        
        // verify the required parameter 'artifactType' is set
        if (artifactType == null) {
            throw new ApiException("Missing the required parameter 'artifactType' when calling createRuleset(Async)");
        }
        

        okhttp3.Call localVarCall = createRulesetCall(name, rulesetContent, ruleType, artifactType, description, ruleCategory, documentationLink, provider, _callback);
        return localVarCall;

    }

    /**
     * Create a new ruleset.
     * Creates a new ruleset in the user&#39;s organization.
     * @param name Name of the ruleset. (required)
     * @param rulesetContent The content of the ruleset file (YAML or JSON). (required)
     * @param ruleType Context or area to which the ruleset applies. (required)
     * @param artifactType The type of artifact that the ruleset validates. (required)
     * @param description A brief description of the ruleset. (optional)
     * @param ruleCategory Category the rules included in ruleset. (optional, default to SPECTRAL)
     * @param documentationLink URL to the documentation related to the ruleset. (optional)
     * @param provider Entity or individual providing the ruleset. (optional)
     * @return RulesetInfoDTO
     * @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> 201 </td><td> OK. Ruleset created successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public RulesetInfoDTO createRuleset(String name, File rulesetContent, String ruleType, String artifactType, String description, String ruleCategory, String documentationLink, String provider) throws ApiException {
        ApiResponse<RulesetInfoDTO> localVarResp = createRulesetWithHttpInfo(name, rulesetContent, ruleType, artifactType, description, ruleCategory, documentationLink, provider);
        return localVarResp.getData();
    }

    /**
     * Create a new ruleset.
     * Creates a new ruleset in the user&#39;s organization.
     * @param name Name of the ruleset. (required)
     * @param rulesetContent The content of the ruleset file (YAML or JSON). (required)
     * @param ruleType Context or area to which the ruleset applies. (required)
     * @param artifactType The type of artifact that the ruleset validates. (required)
     * @param description A brief description of the ruleset. (optional)
     * @param ruleCategory Category the rules included in ruleset. (optional, default to SPECTRAL)
     * @param documentationLink URL to the documentation related to the ruleset. (optional)
     * @param provider Entity or individual providing the ruleset. (optional)
     * @return ApiResponse&lt;RulesetInfoDTO&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> 201 </td><td> OK. Ruleset created successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<RulesetInfoDTO> createRulesetWithHttpInfo(String name, File rulesetContent, String ruleType, String artifactType, String description, String ruleCategory, String documentationLink, String provider) throws ApiException {
        okhttp3.Call localVarCall = createRulesetValidateBeforeCall(name, rulesetContent, ruleType, artifactType, description, ruleCategory, documentationLink, provider, null);
        Type localVarReturnType = new TypeToken<RulesetInfoDTO>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Create a new ruleset. (asynchronously)
     * Creates a new ruleset in the user&#39;s organization.
     * @param name Name of the ruleset. (required)
     * @param rulesetContent The content of the ruleset file (YAML or JSON). (required)
     * @param ruleType Context or area to which the ruleset applies. (required)
     * @param artifactType The type of artifact that the ruleset validates. (required)
     * @param description A brief description of the ruleset. (optional)
     * @param ruleCategory Category the rules included in ruleset. (optional, default to SPECTRAL)
     * @param documentationLink URL to the documentation related to the ruleset. (optional)
     * @param provider Entity or individual providing the ruleset. (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> 201 </td><td> OK. Ruleset created successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call createRulesetAsync(String name, File rulesetContent, String ruleType, String artifactType, String description, String ruleCategory, String documentationLink, String provider, final ApiCallback<RulesetInfoDTO> _callback) throws ApiException {

        okhttp3.Call localVarCall = createRulesetValidateBeforeCall(name, rulesetContent, ruleType, artifactType, description, ruleCategory, documentationLink, provider, _callback);
        Type localVarReturnType = new TypeToken<RulesetInfoDTO>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for deleteRuleset
     * @param rulesetId **UUID** of the Ruleset.  (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 summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 204 </td><td> OK. Ruleset deleted successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call deleteRulesetCall(String rulesetId, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/rulesets/{rulesetId}"
            .replaceAll("\\{" + "rulesetId" + "\\}", localVarApiClient.escapeString(rulesetId.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);
        localVarHeaderParams.put("Content-Type", localVarContentType);

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

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

        okhttp3.Call localVarCall = deleteRulesetCall(rulesetId, _callback);
        return localVarCall;

    }

    /**
     * Deletes a specific ruleset.
     * Deletes an existing ruleset identified by the rulesetId.
     * @param rulesetId **UUID** of the Ruleset.  (required)
     * @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> 204 </td><td> OK. Ruleset deleted successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public void deleteRuleset(String rulesetId) throws ApiException {
        deleteRulesetWithHttpInfo(rulesetId);
    }

    /**
     * Deletes a specific ruleset.
     * Deletes an existing ruleset identified by the rulesetId.
     * @param rulesetId **UUID** of the Ruleset.  (required)
     * @return ApiResponse&lt;Void&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> 204 </td><td> OK. Ruleset deleted successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<Void> deleteRulesetWithHttpInfo(String rulesetId) throws ApiException {
        okhttp3.Call localVarCall = deleteRulesetValidateBeforeCall(rulesetId, null);
        return localVarApiClient.execute(localVarCall);
    }

    /**
     * Deletes a specific ruleset. (asynchronously)
     * Deletes an existing ruleset identified by the rulesetId.
     * @param rulesetId **UUID** of the Ruleset.  (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 summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 204 </td><td> OK. Ruleset deleted successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call deleteRulesetAsync(String rulesetId, final ApiCallback<Void> _callback) throws ApiException {

        okhttp3.Call localVarCall = deleteRulesetValidateBeforeCall(rulesetId, _callback);
        localVarApiClient.executeAsync(localVarCall, _callback);
        return localVarCall;
    }
    /**
     * Build call for getRulesetById
     * @param rulesetId **UUID** of the Ruleset.  (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 summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK. Ruleset details retrieved successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getRulesetByIdCall(String rulesetId, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/rulesets/{rulesetId}"
            .replaceAll("\\{" + "rulesetId" + "\\}", localVarApiClient.escapeString(rulesetId.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);
        localVarHeaderParams.put("Content-Type", localVarContentType);

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

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

        okhttp3.Call localVarCall = getRulesetByIdCall(rulesetId, _callback);
        return localVarCall;

    }

    /**
     * Retrieves details of a specific ruleset.
     * Retrieves details of the ruleset identified by the rulesetId.
     * @param rulesetId **UUID** of the Ruleset.  (required)
     * @return RulesetInfoDTO
     * @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> OK. Ruleset details retrieved successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public RulesetInfoDTO getRulesetById(String rulesetId) throws ApiException {
        ApiResponse<RulesetInfoDTO> localVarResp = getRulesetByIdWithHttpInfo(rulesetId);
        return localVarResp.getData();
    }

    /**
     * Retrieves details of a specific ruleset.
     * Retrieves details of the ruleset identified by the rulesetId.
     * @param rulesetId **UUID** of the Ruleset.  (required)
     * @return ApiResponse&lt;RulesetInfoDTO&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> OK. Ruleset details retrieved successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<RulesetInfoDTO> getRulesetByIdWithHttpInfo(String rulesetId) throws ApiException {
        okhttp3.Call localVarCall = getRulesetByIdValidateBeforeCall(rulesetId, null);
        Type localVarReturnType = new TypeToken<RulesetInfoDTO>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Retrieves details of a specific ruleset. (asynchronously)
     * Retrieves details of the ruleset identified by the rulesetId.
     * @param rulesetId **UUID** of the Ruleset.  (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 summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK. Ruleset details retrieved successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getRulesetByIdAsync(String rulesetId, final ApiCallback<RulesetInfoDTO> _callback) throws ApiException {

        okhttp3.Call localVarCall = getRulesetByIdValidateBeforeCall(rulesetId, _callback);
        Type localVarReturnType = new TypeToken<RulesetInfoDTO>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for getRulesetContent
     * @param rulesetId **UUID** of the Ruleset.  (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 summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK. Ruleset content retrieved successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getRulesetContentCall(String rulesetId, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/rulesets/{rulesetId}/content"
            .replaceAll("\\{" + "rulesetId" + "\\}", localVarApiClient.escapeString(rulesetId.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/x-yaml", "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

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

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

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

        okhttp3.Call localVarCall = getRulesetContentCall(rulesetId, _callback);
        return localVarCall;

    }

    /**
     * Retrieves the content of a specific ruleset.
     * Retrieves the content of the ruleset identified by the rulesetId.
     * @param rulesetId **UUID** of the Ruleset.  (required)
     * @return String
     * @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> OK. Ruleset content retrieved successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public String getRulesetContent(String rulesetId) throws ApiException {
        ApiResponse<String> localVarResp = getRulesetContentWithHttpInfo(rulesetId);
        return localVarResp.getData();
    }

    /**
     * Retrieves the content of a specific ruleset.
     * Retrieves the content of the ruleset identified by the rulesetId.
     * @param rulesetId **UUID** of the Ruleset.  (required)
     * @return ApiResponse&lt;String&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> OK. Ruleset content retrieved successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<String> getRulesetContentWithHttpInfo(String rulesetId) throws ApiException {
        okhttp3.Call localVarCall = getRulesetContentValidateBeforeCall(rulesetId, null);
        Type localVarReturnType = new TypeToken<String>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Retrieves the content of a specific ruleset. (asynchronously)
     * Retrieves the content of the ruleset identified by the rulesetId.
     * @param rulesetId **UUID** of the Ruleset.  (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 summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK. Ruleset content retrieved successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getRulesetContentAsync(String rulesetId, final ApiCallback<String> _callback) throws ApiException {

        okhttp3.Call localVarCall = getRulesetContentValidateBeforeCall(rulesetId, _callback);
        Type localVarReturnType = new TypeToken<String>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for getRulesetUsage
     * @param rulesetId **UUID** of the Ruleset.  (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 summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK. Ruleset usage retrieved successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getRulesetUsageCall(String rulesetId, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/rulesets/{rulesetId}/usage"
            .replaceAll("\\{" + "rulesetId" + "\\}", localVarApiClient.escapeString(rulesetId.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);
        localVarHeaderParams.put("Content-Type", localVarContentType);

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

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

        okhttp3.Call localVarCall = getRulesetUsageCall(rulesetId, _callback);
        return localVarCall;

    }

    /**
     * Retrieves the policy usage of a specific ruleset.
     * Retrieves the list of policies using the ruleset identified by the rulesetId.
     * @param rulesetId **UUID** of the Ruleset.  (required)
     * @return List&lt;String&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> OK. Ruleset usage retrieved successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public List<String> getRulesetUsage(String rulesetId) throws ApiException {
        ApiResponse<List<String>> localVarResp = getRulesetUsageWithHttpInfo(rulesetId);
        return localVarResp.getData();
    }

    /**
     * Retrieves the policy usage of a specific ruleset.
     * Retrieves the list of policies using the ruleset identified by the rulesetId.
     * @param rulesetId **UUID** of the Ruleset.  (required)
     * @return ApiResponse&lt;List&lt;String&gt;&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> OK. Ruleset usage retrieved successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<List<String>> getRulesetUsageWithHttpInfo(String rulesetId) throws ApiException {
        okhttp3.Call localVarCall = getRulesetUsageValidateBeforeCall(rulesetId, null);
        Type localVarReturnType = new TypeToken<List<String>>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Retrieves the policy usage of a specific ruleset. (asynchronously)
     * Retrieves the list of policies using the ruleset identified by the rulesetId.
     * @param rulesetId **UUID** of the Ruleset.  (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 summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK. Ruleset usage retrieved successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getRulesetUsageAsync(String rulesetId, final ApiCallback<List<String>> _callback) throws ApiException {

        okhttp3.Call localVarCall = getRulesetUsageValidateBeforeCall(rulesetId, _callback);
        Type localVarReturnType = new TypeToken<List<String>>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for getRulesets
     * @param limit Maximum size of resource array to return.  (optional, default to 25)
     * @param offset Starting point within the complete list of items qualified.  (optional, default to 0)
     * @param query You can search for rulesets using the following format:    - \&quot;query&#x3D;name:{NAME}\&quot; searches rulesets by name.   - \&quot;query&#x3D;artifactType:{ARTIFACT_TYPE}\&quot; searches rulesets by artifact type.   - \&quot;query&#x3D;ruleType:{RULE_TYPE}\&quot; searches rulesets by rule type.  You can combine multiple attributes to search for rulesets:   - \&quot;query&#x3D;name:{NAME} artifactType:{ARTIFACT_TYPE} ruleType:{RULE_TYPE}\&quot; searches rulesets by name, artifact type, and rule type.  Remember to use URL encoding if your client does not support it (e.g., curl).  (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> OK. Successful response with a list of rulesets. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getRulesetsCall(Integer limit, Integer offset, String query, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/rulesets";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        if (limit != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit));
        }

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

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

        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);
        localVarHeaderParams.put("Content-Type", localVarContentType);

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

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getRulesetsValidateBeforeCall(Integer limit, Integer offset, String query, final ApiCallback _callback) throws ApiException {
        

        okhttp3.Call localVarCall = getRulesetsCall(limit, offset, query, _callback);
        return localVarCall;

    }

    /**
     * Retrieves a list of rulesets.
     * Returns a list of all rulesets associated with the requested organization.
     * @param limit Maximum size of resource array to return.  (optional, default to 25)
     * @param offset Starting point within the complete list of items qualified.  (optional, default to 0)
     * @param query You can search for rulesets using the following format:    - \&quot;query&#x3D;name:{NAME}\&quot; searches rulesets by name.   - \&quot;query&#x3D;artifactType:{ARTIFACT_TYPE}\&quot; searches rulesets by artifact type.   - \&quot;query&#x3D;ruleType:{RULE_TYPE}\&quot; searches rulesets by rule type.  You can combine multiple attributes to search for rulesets:   - \&quot;query&#x3D;name:{NAME} artifactType:{ARTIFACT_TYPE} ruleType:{RULE_TYPE}\&quot; searches rulesets by name, artifact type, and rule type.  Remember to use URL encoding if your client does not support it (e.g., curl).  (optional)
     * @return RulesetListDTO
     * @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> OK. Successful response with a list of rulesets. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public RulesetListDTO getRulesets(Integer limit, Integer offset, String query) throws ApiException {
        ApiResponse<RulesetListDTO> localVarResp = getRulesetsWithHttpInfo(limit, offset, query);
        return localVarResp.getData();
    }

    /**
     * Retrieves a list of rulesets.
     * Returns a list of all rulesets associated with the requested organization.
     * @param limit Maximum size of resource array to return.  (optional, default to 25)
     * @param offset Starting point within the complete list of items qualified.  (optional, default to 0)
     * @param query You can search for rulesets using the following format:    - \&quot;query&#x3D;name:{NAME}\&quot; searches rulesets by name.   - \&quot;query&#x3D;artifactType:{ARTIFACT_TYPE}\&quot; searches rulesets by artifact type.   - \&quot;query&#x3D;ruleType:{RULE_TYPE}\&quot; searches rulesets by rule type.  You can combine multiple attributes to search for rulesets:   - \&quot;query&#x3D;name:{NAME} artifactType:{ARTIFACT_TYPE} ruleType:{RULE_TYPE}\&quot; searches rulesets by name, artifact type, and rule type.  Remember to use URL encoding if your client does not support it (e.g., curl).  (optional)
     * @return ApiResponse&lt;RulesetListDTO&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> OK. Successful response with a list of rulesets. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<RulesetListDTO> getRulesetsWithHttpInfo(Integer limit, Integer offset, String query) throws ApiException {
        okhttp3.Call localVarCall = getRulesetsValidateBeforeCall(limit, offset, query, null);
        Type localVarReturnType = new TypeToken<RulesetListDTO>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Retrieves a list of rulesets. (asynchronously)
     * Returns a list of all rulesets associated with the requested organization.
     * @param limit Maximum size of resource array to return.  (optional, default to 25)
     * @param offset Starting point within the complete list of items qualified.  (optional, default to 0)
     * @param query You can search for rulesets using the following format:    - \&quot;query&#x3D;name:{NAME}\&quot; searches rulesets by name.   - \&quot;query&#x3D;artifactType:{ARTIFACT_TYPE}\&quot; searches rulesets by artifact type.   - \&quot;query&#x3D;ruleType:{RULE_TYPE}\&quot; searches rulesets by rule type.  You can combine multiple attributes to search for rulesets:   - \&quot;query&#x3D;name:{NAME} artifactType:{ARTIFACT_TYPE} ruleType:{RULE_TYPE}\&quot; searches rulesets by name, artifact type, and rule type.  Remember to use URL encoding if your client does not support it (e.g., curl).  (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> OK. Successful response with a list of rulesets. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getRulesetsAsync(Integer limit, Integer offset, String query, final ApiCallback<RulesetListDTO> _callback) throws ApiException {

        okhttp3.Call localVarCall = getRulesetsValidateBeforeCall(limit, offset, query, _callback);
        Type localVarReturnType = new TypeToken<RulesetListDTO>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for updateRulesetById
     * @param rulesetId **UUID** of the Ruleset.  (required)
     * @param name Name of the ruleset. (required)
     * @param rulesetContent The content of the ruleset file (YAML or JSON). (required)
     * @param ruleType Context or area to which the ruleset applies. (required)
     * @param artifactType The type of artifact that the ruleset validates. (required)
     * @param description A brief description of the ruleset. (optional)
     * @param ruleCategory Category the rules included in ruleset. (optional, default to SPECTRAL)
     * @param documentationLink URL to the documentation related to the ruleset. (optional)
     * @param provider Entity or individual providing the ruleset. (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> OK. Ruleset updated successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call updateRulesetByIdCall(String rulesetId, String name, File rulesetContent, String ruleType, String artifactType, String description, String ruleCategory, String documentationLink, String provider, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/rulesets/{rulesetId}"
            .replaceAll("\\{" + "rulesetId" + "\\}", localVarApiClient.escapeString(rulesetId.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>();
        if (name != null) {
            localVarFormParams.put("name", name);
        }

        if (description != null) {
            localVarFormParams.put("description", description);
        }

        if (rulesetContent != null) {
            localVarFormParams.put("rulesetContent", rulesetContent);
        }

        if (ruleCategory != null) {
            localVarFormParams.put("ruleCategory", ruleCategory);
        }

        if (ruleType != null) {
            localVarFormParams.put("ruleType", ruleType);
        }

        if (artifactType != null) {
            localVarFormParams.put("artifactType", artifactType);
        }

        if (documentationLink != null) {
            localVarFormParams.put("documentationLink", documentationLink);
        }

        if (provider != null) {
            localVarFormParams.put("provider", provider);
        }

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

        final String[] localVarContentTypes = {
            "multipart/form-data"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

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

    @SuppressWarnings("rawtypes")
    private okhttp3.Call updateRulesetByIdValidateBeforeCall(String rulesetId, String name, File rulesetContent, String ruleType, String artifactType, String description, String ruleCategory, String documentationLink, String provider, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'rulesetId' is set
        if (rulesetId == null) {
            throw new ApiException("Missing the required parameter 'rulesetId' when calling updateRulesetById(Async)");
        }
        
        // verify the required parameter 'name' is set
        if (name == null) {
            throw new ApiException("Missing the required parameter 'name' when calling updateRulesetById(Async)");
        }
        
        // verify the required parameter 'rulesetContent' is set
        if (rulesetContent == null) {
            throw new ApiException("Missing the required parameter 'rulesetContent' when calling updateRulesetById(Async)");
        }
        
        // verify the required parameter 'ruleType' is set
        if (ruleType == null) {
            throw new ApiException("Missing the required parameter 'ruleType' when calling updateRulesetById(Async)");
        }
        
        // verify the required parameter 'artifactType' is set
        if (artifactType == null) {
            throw new ApiException("Missing the required parameter 'artifactType' when calling updateRulesetById(Async)");
        }
        

        okhttp3.Call localVarCall = updateRulesetByIdCall(rulesetId, name, rulesetContent, ruleType, artifactType, description, ruleCategory, documentationLink, provider, _callback);
        return localVarCall;

    }

    /**
     * Updates a specific ruleset.
     * Updates the details of the ruleset identified by the &#x60;rulesetId&#x60;.
     * @param rulesetId **UUID** of the Ruleset.  (required)
     * @param name Name of the ruleset. (required)
     * @param rulesetContent The content of the ruleset file (YAML or JSON). (required)
     * @param ruleType Context or area to which the ruleset applies. (required)
     * @param artifactType The type of artifact that the ruleset validates. (required)
     * @param description A brief description of the ruleset. (optional)
     * @param ruleCategory Category the rules included in ruleset. (optional, default to SPECTRAL)
     * @param documentationLink URL to the documentation related to the ruleset. (optional)
     * @param provider Entity or individual providing the ruleset. (optional)
     * @return RulesetInfoDTO
     * @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> OK. Ruleset updated successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public RulesetInfoDTO updateRulesetById(String rulesetId, String name, File rulesetContent, String ruleType, String artifactType, String description, String ruleCategory, String documentationLink, String provider) throws ApiException {
        ApiResponse<RulesetInfoDTO> localVarResp = updateRulesetByIdWithHttpInfo(rulesetId, name, rulesetContent, ruleType, artifactType, description, ruleCategory, documentationLink, provider);
        return localVarResp.getData();
    }

    /**
     * Updates a specific ruleset.
     * Updates the details of the ruleset identified by the &#x60;rulesetId&#x60;.
     * @param rulesetId **UUID** of the Ruleset.  (required)
     * @param name Name of the ruleset. (required)
     * @param rulesetContent The content of the ruleset file (YAML or JSON). (required)
     * @param ruleType Context or area to which the ruleset applies. (required)
     * @param artifactType The type of artifact that the ruleset validates. (required)
     * @param description A brief description of the ruleset. (optional)
     * @param ruleCategory Category the rules included in ruleset. (optional, default to SPECTRAL)
     * @param documentationLink URL to the documentation related to the ruleset. (optional)
     * @param provider Entity or individual providing the ruleset. (optional)
     * @return ApiResponse&lt;RulesetInfoDTO&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> OK. Ruleset updated successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<RulesetInfoDTO> updateRulesetByIdWithHttpInfo(String rulesetId, String name, File rulesetContent, String ruleType, String artifactType, String description, String ruleCategory, String documentationLink, String provider) throws ApiException {
        okhttp3.Call localVarCall = updateRulesetByIdValidateBeforeCall(rulesetId, name, rulesetContent, ruleType, artifactType, description, ruleCategory, documentationLink, provider, null);
        Type localVarReturnType = new TypeToken<RulesetInfoDTO>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Updates a specific ruleset. (asynchronously)
     * Updates the details of the ruleset identified by the &#x60;rulesetId&#x60;.
     * @param rulesetId **UUID** of the Ruleset.  (required)
     * @param name Name of the ruleset. (required)
     * @param rulesetContent The content of the ruleset file (YAML or JSON). (required)
     * @param ruleType Context or area to which the ruleset applies. (required)
     * @param artifactType The type of artifact that the ruleset validates. (required)
     * @param description A brief description of the ruleset. (optional)
     * @param ruleCategory Category the rules included in ruleset. (optional, default to SPECTRAL)
     * @param documentationLink URL to the documentation related to the ruleset. (optional)
     * @param provider Entity or individual providing the ruleset. (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> OK. Ruleset updated successfully. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call updateRulesetByIdAsync(String rulesetId, String name, File rulesetContent, String ruleType, String artifactType, String description, String ruleCategory, String documentationLink, String provider, final ApiCallback<RulesetInfoDTO> _callback) throws ApiException {

        okhttp3.Call localVarCall = updateRulesetByIdValidateBeforeCall(rulesetId, name, rulesetContent, ruleType, artifactType, description, ruleCategory, documentationLink, provider, _callback);
        Type localVarReturnType = new TypeToken<RulesetInfoDTO>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
}
