/*
 * Ory Hydra API
 * Documentation for all of Ory Hydra's APIs. 
 *
 * The version of the OpenAPI document: v2.2.0-rc.3
 * Contact: hi@ory.sh
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package sh.ory.hydra.api;

import sh.ory.hydra.ApiCallback;
import sh.ory.hydra.ApiClient;
import sh.ory.hydra.ApiException;
import sh.ory.hydra.ApiResponse;
import sh.ory.hydra.Configuration;
import sh.ory.hydra.Pair;
import sh.ory.hydra.ProgressRequestBody;
import sh.ory.hydra.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import sh.ory.hydra.model.CreateJsonWebKeySet;
import sh.ory.hydra.model.ErrorOAuth2;
import sh.ory.hydra.model.JsonWebKey;
import sh.ory.hydra.model.JsonWebKeySet;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ws.rs.core.GenericType;

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

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

    public JwkApi(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 createJsonWebKeySet
     * @param set The JSON Web Key Set ID (required)
     * @param createJsonWebKeySet  (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> 201 </td><td> jsonWebKeySet </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call createJsonWebKeySetCall(String set, CreateJsonWebKeySet createJsonWebKeySet, 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 = createJsonWebKeySet;

        // create path and map variables
        String localVarPath = "/admin/keys/{set}"
            .replace("{" + "set" + "}", localVarApiClient.escapeString(set.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[] {  };
        return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

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

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

        return createJsonWebKeySetCall(set, createJsonWebKeySet, _callback);

    }

    /**
     * Create JSON Web Key
     * This endpoint is capable of generating JSON Web Key Sets for you. There a different strategies available, such as symmetric cryptographic keys (HS256, HS512) and asymetric cryptographic keys (RS256, ECDSA). If the specified JSON Web Key Set does not exist, it will be created.  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
     * @param set The JSON Web Key Set ID (required)
     * @param createJsonWebKeySet  (required)
     * @return JsonWebKeySet
     * @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> jsonWebKeySet </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public JsonWebKeySet createJsonWebKeySet(String set, CreateJsonWebKeySet createJsonWebKeySet) throws ApiException {
        ApiResponse<JsonWebKeySet> localVarResp = createJsonWebKeySetWithHttpInfo(set, createJsonWebKeySet);
        return localVarResp.getData();
    }

    /**
     * Create JSON Web Key
     * This endpoint is capable of generating JSON Web Key Sets for you. There a different strategies available, such as symmetric cryptographic keys (HS256, HS512) and asymetric cryptographic keys (RS256, ECDSA). If the specified JSON Web Key Set does not exist, it will be created.  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
     * @param set The JSON Web Key Set ID (required)
     * @param createJsonWebKeySet  (required)
     * @return ApiResponse&lt;JsonWebKeySet&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> jsonWebKeySet </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<JsonWebKeySet> createJsonWebKeySetWithHttpInfo(String set, CreateJsonWebKeySet createJsonWebKeySet) throws ApiException {
        okhttp3.Call localVarCall = createJsonWebKeySetValidateBeforeCall(set, createJsonWebKeySet, null);
        Type localVarReturnType = new TypeToken<JsonWebKeySet>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Create JSON Web Key (asynchronously)
     * This endpoint is capable of generating JSON Web Key Sets for you. There a different strategies available, such as symmetric cryptographic keys (HS256, HS512) and asymetric cryptographic keys (RS256, ECDSA). If the specified JSON Web Key Set does not exist, it will be created.  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
     * @param set The JSON Web Key Set ID (required)
     * @param createJsonWebKeySet  (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> 201 </td><td> jsonWebKeySet </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call createJsonWebKeySetAsync(String set, CreateJsonWebKeySet createJsonWebKeySet, final ApiCallback<JsonWebKeySet> _callback) throws ApiException {

        okhttp3.Call localVarCall = createJsonWebKeySetValidateBeforeCall(set, createJsonWebKeySet, _callback);
        Type localVarReturnType = new TypeToken<JsonWebKeySet>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for deleteJsonWebKey
     * @param set The JSON Web Key Set (required)
     * @param kid The JSON Web Key ID (kid) (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> Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call deleteJsonWebKeyCall(String set, String kid, 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 = "/admin/keys/{set}/{kid}"
            .replace("{" + "set" + "}", localVarApiClient.escapeString(set.toString()))
            .replace("{" + "kid" + "}", localVarApiClient.escapeString(kid.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[] {  };
        return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

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

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

        return deleteJsonWebKeyCall(set, kid, _callback);

    }

    /**
     * Delete JSON Web Key
     * Use this endpoint to delete a single JSON Web Key.  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
     * @param set The JSON Web Key Set (required)
     * @param kid The JSON Web Key ID (kid) (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> Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public void deleteJsonWebKey(String set, String kid) throws ApiException {
        deleteJsonWebKeyWithHttpInfo(set, kid);
    }

    /**
     * Delete JSON Web Key
     * Use this endpoint to delete a single JSON Web Key.  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
     * @param set The JSON Web Key Set (required)
     * @param kid The JSON Web Key ID (kid) (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> Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<Void> deleteJsonWebKeyWithHttpInfo(String set, String kid) throws ApiException {
        okhttp3.Call localVarCall = deleteJsonWebKeyValidateBeforeCall(set, kid, null);
        return localVarApiClient.execute(localVarCall);
    }

    /**
     * Delete JSON Web Key (asynchronously)
     * Use this endpoint to delete a single JSON Web Key.  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
     * @param set The JSON Web Key Set (required)
     * @param kid The JSON Web Key ID (kid) (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> Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call deleteJsonWebKeyAsync(String set, String kid, final ApiCallback<Void> _callback) throws ApiException {

        okhttp3.Call localVarCall = deleteJsonWebKeyValidateBeforeCall(set, kid, _callback);
        localVarApiClient.executeAsync(localVarCall, _callback);
        return localVarCall;
    }
    /**
     * Build call for deleteJsonWebKeySet
     * @param set The JSON Web Key Set (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> Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call deleteJsonWebKeySetCall(String set, 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 = "/admin/keys/{set}"
            .replace("{" + "set" + "}", localVarApiClient.escapeString(set.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[] {  };
        return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

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

        return deleteJsonWebKeySetCall(set, _callback);

    }

    /**
     * Delete JSON Web Key Set
     * Use this endpoint to delete a complete JSON Web Key Set and all the keys in that set.  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
     * @param set The JSON Web Key Set (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> Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public void deleteJsonWebKeySet(String set) throws ApiException {
        deleteJsonWebKeySetWithHttpInfo(set);
    }

    /**
     * Delete JSON Web Key Set
     * Use this endpoint to delete a complete JSON Web Key Set and all the keys in that set.  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
     * @param set The JSON Web Key Set (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> Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<Void> deleteJsonWebKeySetWithHttpInfo(String set) throws ApiException {
        okhttp3.Call localVarCall = deleteJsonWebKeySetValidateBeforeCall(set, null);
        return localVarApiClient.execute(localVarCall);
    }

    /**
     * Delete JSON Web Key Set (asynchronously)
     * Use this endpoint to delete a complete JSON Web Key Set and all the keys in that set.  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
     * @param set The JSON Web Key Set (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> Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call deleteJsonWebKeySetAsync(String set, final ApiCallback<Void> _callback) throws ApiException {

        okhttp3.Call localVarCall = deleteJsonWebKeySetValidateBeforeCall(set, _callback);
        localVarApiClient.executeAsync(localVarCall, _callback);
        return localVarCall;
    }
    /**
     * Build call for getJsonWebKey
     * @param set JSON Web Key Set ID (required)
     * @param kid JSON Web Key ID (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> jsonWebKeySet </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getJsonWebKeyCall(String set, String kid, 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 = "/admin/keys/{set}/{kid}"
            .replace("{" + "set" + "}", localVarApiClient.escapeString(set.toString()))
            .replace("{" + "kid" + "}", localVarApiClient.escapeString(kid.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[] {  };
        return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

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

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

        return getJsonWebKeyCall(set, kid, _callback);

    }

    /**
     * Get JSON Web Key
     * This endpoint returns a singular JSON Web Key contained in a set. It is identified by the set and the specific key ID (kid).
     * @param set JSON Web Key Set ID (required)
     * @param kid JSON Web Key ID (required)
     * @return JsonWebKeySet
     * @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> jsonWebKeySet </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public JsonWebKeySet getJsonWebKey(String set, String kid) throws ApiException {
        ApiResponse<JsonWebKeySet> localVarResp = getJsonWebKeyWithHttpInfo(set, kid);
        return localVarResp.getData();
    }

    /**
     * Get JSON Web Key
     * This endpoint returns a singular JSON Web Key contained in a set. It is identified by the set and the specific key ID (kid).
     * @param set JSON Web Key Set ID (required)
     * @param kid JSON Web Key ID (required)
     * @return ApiResponse&lt;JsonWebKeySet&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> jsonWebKeySet </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<JsonWebKeySet> getJsonWebKeyWithHttpInfo(String set, String kid) throws ApiException {
        okhttp3.Call localVarCall = getJsonWebKeyValidateBeforeCall(set, kid, null);
        Type localVarReturnType = new TypeToken<JsonWebKeySet>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Get JSON Web Key (asynchronously)
     * This endpoint returns a singular JSON Web Key contained in a set. It is identified by the set and the specific key ID (kid).
     * @param set JSON Web Key Set ID (required)
     * @param kid JSON Web Key ID (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> jsonWebKeySet </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getJsonWebKeyAsync(String set, String kid, final ApiCallback<JsonWebKeySet> _callback) throws ApiException {

        okhttp3.Call localVarCall = getJsonWebKeyValidateBeforeCall(set, kid, _callback);
        Type localVarReturnType = new TypeToken<JsonWebKeySet>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for getJsonWebKeySet
     * @param set JSON Web Key Set ID (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> jsonWebKeySet </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getJsonWebKeySetCall(String set, 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 = "/admin/keys/{set}"
            .replace("{" + "set" + "}", localVarApiClient.escapeString(set.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[] {  };
        return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

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

        return getJsonWebKeySetCall(set, _callback);

    }

    /**
     * Retrieve a JSON Web Key Set
     * This endpoint can be used to retrieve JWK Sets stored in ORY Hydra.  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
     * @param set JSON Web Key Set ID (required)
     * @return JsonWebKeySet
     * @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> jsonWebKeySet </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public JsonWebKeySet getJsonWebKeySet(String set) throws ApiException {
        ApiResponse<JsonWebKeySet> localVarResp = getJsonWebKeySetWithHttpInfo(set);
        return localVarResp.getData();
    }

    /**
     * Retrieve a JSON Web Key Set
     * This endpoint can be used to retrieve JWK Sets stored in ORY Hydra.  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
     * @param set JSON Web Key Set ID (required)
     * @return ApiResponse&lt;JsonWebKeySet&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> jsonWebKeySet </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<JsonWebKeySet> getJsonWebKeySetWithHttpInfo(String set) throws ApiException {
        okhttp3.Call localVarCall = getJsonWebKeySetValidateBeforeCall(set, null);
        Type localVarReturnType = new TypeToken<JsonWebKeySet>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Retrieve a JSON Web Key Set (asynchronously)
     * This endpoint can be used to retrieve JWK Sets stored in ORY Hydra.  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
     * @param set JSON Web Key Set ID (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> jsonWebKeySet </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getJsonWebKeySetAsync(String set, final ApiCallback<JsonWebKeySet> _callback) throws ApiException {

        okhttp3.Call localVarCall = getJsonWebKeySetValidateBeforeCall(set, _callback);
        Type localVarReturnType = new TypeToken<JsonWebKeySet>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for setJsonWebKey
     * @param set The JSON Web Key Set ID (required)
     * @param kid JSON Web Key ID (required)
     * @param jsonWebKey  (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> jsonWebKey </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call setJsonWebKeyCall(String set, String kid, JsonWebKey jsonWebKey, 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 = jsonWebKey;

        // create path and map variables
        String localVarPath = "/admin/keys/{set}/{kid}"
            .replace("{" + "set" + "}", localVarApiClient.escapeString(set.toString()))
            .replace("{" + "kid" + "}", localVarApiClient.escapeString(kid.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[] {  };
        return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

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

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

        return setJsonWebKeyCall(set, kid, jsonWebKey, _callback);

    }

    /**
     * Set JSON Web Key
     * Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your own.  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
     * @param set The JSON Web Key Set ID (required)
     * @param kid JSON Web Key ID (required)
     * @param jsonWebKey  (optional)
     * @return JsonWebKey
     * @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> jsonWebKey </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public JsonWebKey setJsonWebKey(String set, String kid, JsonWebKey jsonWebKey) throws ApiException {
        ApiResponse<JsonWebKey> localVarResp = setJsonWebKeyWithHttpInfo(set, kid, jsonWebKey);
        return localVarResp.getData();
    }

    /**
     * Set JSON Web Key
     * Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your own.  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
     * @param set The JSON Web Key Set ID (required)
     * @param kid JSON Web Key ID (required)
     * @param jsonWebKey  (optional)
     * @return ApiResponse&lt;JsonWebKey&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> jsonWebKey </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<JsonWebKey> setJsonWebKeyWithHttpInfo(String set, String kid, JsonWebKey jsonWebKey) throws ApiException {
        okhttp3.Call localVarCall = setJsonWebKeyValidateBeforeCall(set, kid, jsonWebKey, null);
        Type localVarReturnType = new TypeToken<JsonWebKey>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Set JSON Web Key (asynchronously)
     * Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your own.  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
     * @param set The JSON Web Key Set ID (required)
     * @param kid JSON Web Key ID (required)
     * @param jsonWebKey  (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> jsonWebKey </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call setJsonWebKeyAsync(String set, String kid, JsonWebKey jsonWebKey, final ApiCallback<JsonWebKey> _callback) throws ApiException {

        okhttp3.Call localVarCall = setJsonWebKeyValidateBeforeCall(set, kid, jsonWebKey, _callback);
        Type localVarReturnType = new TypeToken<JsonWebKey>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for setJsonWebKeySet
     * @param set The JSON Web Key Set ID (required)
     * @param jsonWebKeySet  (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> jsonWebKeySet </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call setJsonWebKeySetCall(String set, JsonWebKeySet jsonWebKeySet, 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 = jsonWebKeySet;

        // create path and map variables
        String localVarPath = "/admin/keys/{set}"
            .replace("{" + "set" + "}", localVarApiClient.escapeString(set.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[] {  };
        return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

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

        return setJsonWebKeySetCall(set, jsonWebKeySet, _callback);

    }

    /**
     * Update a JSON Web Key Set
     * Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your own.  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
     * @param set The JSON Web Key Set ID (required)
     * @param jsonWebKeySet  (optional)
     * @return JsonWebKeySet
     * @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> jsonWebKeySet </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public JsonWebKeySet setJsonWebKeySet(String set, JsonWebKeySet jsonWebKeySet) throws ApiException {
        ApiResponse<JsonWebKeySet> localVarResp = setJsonWebKeySetWithHttpInfo(set, jsonWebKeySet);
        return localVarResp.getData();
    }

    /**
     * Update a JSON Web Key Set
     * Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your own.  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
     * @param set The JSON Web Key Set ID (required)
     * @param jsonWebKeySet  (optional)
     * @return ApiResponse&lt;JsonWebKeySet&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> jsonWebKeySet </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<JsonWebKeySet> setJsonWebKeySetWithHttpInfo(String set, JsonWebKeySet jsonWebKeySet) throws ApiException {
        okhttp3.Call localVarCall = setJsonWebKeySetValidateBeforeCall(set, jsonWebKeySet, null);
        Type localVarReturnType = new TypeToken<JsonWebKeySet>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Update a JSON Web Key Set (asynchronously)
     * Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your own.  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
     * @param set The JSON Web Key Set ID (required)
     * @param jsonWebKeySet  (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> jsonWebKeySet </td><td>  -  </td></tr>
        <tr><td> 0 </td><td> errorOAuth2 </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call setJsonWebKeySetAsync(String set, JsonWebKeySet jsonWebKeySet, final ApiCallback<JsonWebKeySet> _callback) throws ApiException {

        okhttp3.Call localVarCall = setJsonWebKeySetValidateBeforeCall(set, jsonWebKeySet, _callback);
        Type localVarReturnType = new TypeToken<JsonWebKeySet>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
}
