eu.operando.core.pdb.client.api.LegislationApi.java Source code

Java tutorial

Introduction

Here is the source code for eu.operando.core.pdb.client.api.LegislationApi.java

Source

/////////////////////////////////////////////////////////////////////////
//
//  University of Southampton IT Innovation Centre, 2016
//
// Copyright in this software belongs to University of Southampton
// IT Innovation Centre of Gamma House, Enterprise Road,
// Chilworth Science Park, Southampton, SO16 7NS, UK.
//
// This software may not be used, sold, licensed, transferred, copied
// or reproduced in whole or in part in any manner or form or in or
// on any media by any person other than in accordance with the terms
// of the Licence Agreement supplied with the software, or otherwise
// without the prior written consent of the copyright owners.
//
// This software is distributed WITHOUT ANY WARRANTY, without even the
// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE, except where stated in the Licence Agreement supplied with
// the software.
//
//      Created By :            Panos Melas
//      Created Date :          2017-03-21
//      Created for Project :   OPERANDO
//
/////////////////////////////////////////////////////////////////////////

/*
 * Policy DB
 * The Policy Database that stores three types of documents in dedicated collections.   1) User Privacy Policy. Each OPERANDO user has one UPP document describing their privacy policies for each of the OSP services they are subscribed to. The UPP contains the current B2C privacy settings for a subscribed to OSP. The UPP contains the users privacy preferences. The UPP contains the G2C access policies for the OSP with justification for access.   2) The legislation policies. The regulations entered into OPERANDO using the OPERANDO regulation API.   3) The OSP descriptions and data requests. For each OSP its privacy policy, its access control rules, and the data it requests (as a workflow). For B2C, the set of privacy settings is stored. 
 *
 * OpenAPI spec version: 1.0.0
 * Contact: support@operando.eu
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 */

package eu.operando.core.pdb.client.api;

import eu.operando.core.pdb.client.ApiCallback;
import eu.operando.core.pdb.client.ApiClient;
import eu.operando.core.pdb.client.ApiException;
import eu.operando.core.pdb.client.ApiResponse;
import eu.operando.core.pdb.client.Configuration;
import eu.operando.core.pdb.client.Pair;
import eu.operando.core.pdb.client.ProgressRequestBody;
import eu.operando.core.pdb.client.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;

import eu.operando.core.pdb.common.model.PrivacyRegulation;
import eu.operando.core.pdb.common.model.PrivacyRegulationInput;

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

public class LegislationApi {
    private ApiClient apiClient;

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

    public LegislationApi(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return apiClient;
    }

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

    /* Build call for regulationsGet */
    private com.squareup.okhttp.Call regulationsGetCall(String filter,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/regulations/".replaceAll("\\{format\\}", "json");

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        if (filter != null)
            localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter));

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {

        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null)
            localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {

        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if (progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain)
                        throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                            .body(new ProgressResponseBody(originalResponse.body(), progressListener)).build();
                }
            });
        }

        String[] localVarAuthNames = new String[] {};
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams,
                localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call regulationsGetValidateBeforeCall(String filter,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {

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

        com.squareup.okhttp.Call call = regulationsGetCall(filter, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Perform a search query across the collection of regulation.
     * The query contains a json object (names, values) and the request returns  the list of documents (regulations) where the filter matches i.e. the  document contains fields with those values. 
     * @param filter The query filter to be matched - ?filter&#x3D;{json description} (required)
     * @return List&lt;PrivacyRegulation&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public List<PrivacyRegulation> regulationsGet(String filter) throws ApiException {
        ApiResponse<List<PrivacyRegulation>> resp = regulationsGetWithHttpInfo(filter);
        return resp.getData();
    }

    /**
     * Perform a search query across the collection of regulation.
     * The query contains a json object (names, values) and the request returns  the list of documents (regulations) where the filter matches i.e. the  document contains fields with those values. 
     * @param filter The query filter to be matched - ?filter&#x3D;{json description} (required)
     * @return ApiResponse&lt;List&lt;PrivacyRegulation&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<List<PrivacyRegulation>> regulationsGetWithHttpInfo(String filter) throws ApiException {
        com.squareup.okhttp.Call call = regulationsGetValidateBeforeCall(filter, null, null);
        Type localVarReturnType = new TypeToken<List<PrivacyRegulation>>() {
        }.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Perform a search query across the collection of regulation. (asynchronously)
     * The query contains a json object (names, values) and the request returns  the list of documents (regulations) where the filter matches i.e. the  document contains fields with those values. 
     * @param filter The query filter to be matched - ?filter&#x3D;{json description} (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
     */
    public com.squareup.okhttp.Call regulationsGetAsync(String filter,
            final ApiCallback<List<PrivacyRegulation>> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        com.squareup.okhttp.Call call = regulationsGetValidateBeforeCall(filter, progressListener,
                progressRequestListener);
        Type localVarReturnType = new TypeToken<List<PrivacyRegulation>>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }

    /* Build call for regulationsPost */
    private com.squareup.okhttp.Call regulationsPostCall(PrivacyRegulationInput regulation,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = regulation;

        // create path and map variables
        String localVarPath = "/regulations/".replaceAll("\\{format\\}", "json");

        List<Pair> localVarQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {

        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null)
            localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {

        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if (progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain)
                        throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                            .body(new ProgressResponseBody(originalResponse.body(), progressListener)).build();
                }
            });
        }

        String[] localVarAuthNames = new String[] {};
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody,
                localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call regulationsPostValidateBeforeCall(PrivacyRegulationInput regulation,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {

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

        com.squareup.okhttp.Call call = regulationsPostCall(regulation, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Create a new legislation entry in the database.
     * Called by the policy computation component when a new regulation is added to OPERANDO. 
     * @param regulation The first instance of this regulation document (required)
     * @return PrivacyRegulation
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public PrivacyRegulation regulationsPost(PrivacyRegulationInput regulation) throws ApiException {
        ApiResponse<PrivacyRegulation> resp = regulationsPostWithHttpInfo(regulation);
        return resp.getData();
    }

    /**
     * Create a new legislation entry in the database.
     * Called by the policy computation component when a new regulation is added to OPERANDO. 
     * @param regulation The first instance of this regulation document (required)
     * @return ApiResponse&lt;PrivacyRegulation&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<PrivacyRegulation> regulationsPostWithHttpInfo(PrivacyRegulationInput regulation)
            throws ApiException {
        com.squareup.okhttp.Call call = regulationsPostValidateBeforeCall(regulation, null, null);
        Type localVarReturnType = new TypeToken<PrivacyRegulation>() {
        }.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Create a new legislation entry in the database. (asynchronously)
     * Called by the policy computation component when a new regulation is added to OPERANDO. 
     * @param regulation The first instance of this regulation document (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
     */
    public com.squareup.okhttp.Call regulationsPostAsync(PrivacyRegulationInput regulation,
            final ApiCallback<PrivacyRegulation> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        com.squareup.okhttp.Call call = regulationsPostValidateBeforeCall(regulation, progressListener,
                progressRequestListener);
        Type localVarReturnType = new TypeToken<PrivacyRegulation>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }

    /* Build call for regulationsRegIdDelete */
    private com.squareup.okhttp.Call regulationsRegIdDeleteCall(String regId,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/regulations/{reg-id}/".replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "reg-id" + "\\}", apiClient.escapeString(regId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {

        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null)
            localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {

        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if (progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain)
                        throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                            .body(new ProgressResponseBody(originalResponse.body(), progressListener)).build();
                }
            });
        }

        String[] localVarAuthNames = new String[] {};
        return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody,
                localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call regulationsRegIdDeleteValidateBeforeCall(String regId,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {

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

        com.squareup.okhttp.Call call = regulationsRegIdDeleteCall(regId, progressListener,
                progressRequestListener);
        return call;

    }

    /**
     * Remove the PrivacyRegulation entry in the database.
     * Called when by the policy computation component when the regulator api requests that the regulation be deleted. 
     * @param regId The identifier number of a regulation (required)
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public void regulationsRegIdDelete(String regId) throws ApiException {
        regulationsRegIdDeleteWithHttpInfo(regId);
    }

    /**
     * Remove the PrivacyRegulation entry in the database.
     * Called when by the policy computation component when the regulator api requests that the regulation be deleted. 
     * @param regId The identifier number of a regulation (required)
     * @return ApiResponse&lt;Void&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<Void> regulationsRegIdDeleteWithHttpInfo(String regId) throws ApiException {
        com.squareup.okhttp.Call call = regulationsRegIdDeleteValidateBeforeCall(regId, null, null);
        return apiClient.execute(call);
    }

    /**
     * Remove the PrivacyRegulation entry in the database. (asynchronously)
     * Called when by the policy computation component when the regulator api requests that the regulation be deleted. 
     * @param regId The identifier number of a regulation (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
     */
    public com.squareup.okhttp.Call regulationsRegIdDeleteAsync(String regId, final ApiCallback<Void> callback)
            throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        com.squareup.okhttp.Call call = regulationsRegIdDeleteValidateBeforeCall(regId, progressListener,
                progressRequestListener);
        apiClient.executeAsync(call, callback);
        return call;
    }

    /* Build call for regulationsRegIdGet */
    private com.squareup.okhttp.Call regulationsRegIdGetCall(String regId,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/regulations/{reg-id}/".replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "reg-id" + "\\}", apiClient.escapeString(regId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {

        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null)
            localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {

        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if (progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain)
                        throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                            .body(new ProgressResponseBody(originalResponse.body(), progressListener)).build();
                }
            });
        }

        String[] localVarAuthNames = new String[] {};
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams,
                localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call regulationsRegIdGetValidateBeforeCall(String regId,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {

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

        com.squareup.okhttp.Call call = regulationsRegIdGetCall(regId, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Read a given legislation with its ID.
     * Get a specific legislation document via the id. This will return the  full legislation document in json format. 
     * @param regId The identifier number of a regulation (required)
     * @return PrivacyRegulation
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public PrivacyRegulation regulationsRegIdGet(String regId) throws ApiException {
        ApiResponse<PrivacyRegulation> resp = regulationsRegIdGetWithHttpInfo(regId);
        return resp.getData();
    }

    /**
     * Read a given legislation with its ID.
     * Get a specific legislation document via the id. This will return the  full legislation document in json format. 
     * @param regId The identifier number of a regulation (required)
     * @return ApiResponse&lt;PrivacyRegulation&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<PrivacyRegulation> regulationsRegIdGetWithHttpInfo(String regId) throws ApiException {
        com.squareup.okhttp.Call call = regulationsRegIdGetValidateBeforeCall(regId, null, null);
        Type localVarReturnType = new TypeToken<PrivacyRegulation>() {
        }.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Read a given legislation with its ID. (asynchronously)
     * Get a specific legislation document via the id. This will return the  full legislation document in json format. 
     * @param regId The identifier number of a regulation (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
     */
    public com.squareup.okhttp.Call regulationsRegIdGetAsync(String regId,
            final ApiCallback<PrivacyRegulation> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        com.squareup.okhttp.Call call = regulationsRegIdGetValidateBeforeCall(regId, progressListener,
                progressRequestListener);
        Type localVarReturnType = new TypeToken<PrivacyRegulation>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }

    /* Build call for regulationsRegIdPut */
    private com.squareup.okhttp.Call regulationsRegIdPutCall(String regId, PrivacyRegulationInput regulation,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = regulation;

        // create path and map variables
        String localVarPath = "/regulations/{reg-id}/".replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "reg-id" + "\\}", apiClient.escapeString(regId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {

        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null)
            localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {

        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if (progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain)
                        throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                            .body(new ProgressResponseBody(originalResponse.body(), progressListener)).build();
                }
            });
        }

        String[] localVarAuthNames = new String[] {};
        return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams,
                localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call regulationsRegIdPutValidateBeforeCall(String regId,
            PrivacyRegulationInput regulation, final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {

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

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

        com.squareup.okhttp.Call call = regulationsRegIdPutCall(regId, regulation, progressListener,
                progressRequestListener);
        return call;

    }

    /**
     * Update PrivacyRegulation entry in the database.
     * Called when by the policy computation component when the regulator api updates a regulation. Their new PrivacyRegulation document is stored in the policy DB. 
     * @param regId The identifier number of a regulation (required)
     * @param regulation The changed instance of this PrivacyRegulation (required)
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public void regulationsRegIdPut(String regId, PrivacyRegulationInput regulation) throws ApiException {
        regulationsRegIdPutWithHttpInfo(regId, regulation);
    }

    /**
     * Update PrivacyRegulation entry in the database.
     * Called when by the policy computation component when the regulator api updates a regulation. Their new PrivacyRegulation document is stored in the policy DB. 
     * @param regId The identifier number of a regulation (required)
     * @param regulation The changed instance of this PrivacyRegulation (required)
     * @return ApiResponse&lt;Void&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<Void> regulationsRegIdPutWithHttpInfo(String regId, PrivacyRegulationInput regulation)
            throws ApiException {
        com.squareup.okhttp.Call call = regulationsRegIdPutValidateBeforeCall(regId, regulation, null, null);
        return apiClient.execute(call);
    }

    /**
     * Update PrivacyRegulation entry in the database. (asynchronously)
     * Called when by the policy computation component when the regulator api updates a regulation. Their new PrivacyRegulation document is stored in the policy DB. 
     * @param regId The identifier number of a regulation (required)
     * @param regulation The changed instance of this PrivacyRegulation (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
     */
    public com.squareup.okhttp.Call regulationsRegIdPutAsync(String regId, PrivacyRegulationInput regulation,
            final ApiCallback<Void> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        com.squareup.okhttp.Call call = regulationsRegIdPutValidateBeforeCall(regId, regulation, progressListener,
                progressRequestListener);
        apiClient.executeAsync(call, callback);
        return call;
    }
}