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

Java tutorial

Introduction

Here is the source code for eu.operando.core.pdb.client.api.GETApi.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.OSPPrivacyPolicy;
import eu.operando.core.pdb.common.model.OSPReasonPolicy;
import eu.operando.core.pdb.common.model.PrivacyRegulation;
import eu.operando.core.pdb.common.model.UserPrivacyPolicy;

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

public class GETApi {
    private ApiClient apiClient;

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

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

    public ApiClient getApiClient() {
        return apiClient;
    }

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

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

        // create path and map variables
        String localVarPath = "/OSP/".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 oSPGetValidateBeforeCall(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 oSPGet(Async)");
        }

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

    }

    /**
     * Perform a search query across the collection of OSP behaviour.
     * 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;OSPPrivacyPolicy&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public List<OSPPrivacyPolicy> oSPGet(String filter) throws ApiException {
        ApiResponse<List<OSPPrivacyPolicy>> resp = oSPGetWithHttpInfo(filter);
        return resp.getData();
    }

    /**
     * Perform a search query across the collection of OSP behaviour.
     * 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;OSPPrivacyPolicy&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<List<OSPPrivacyPolicy>> oSPGetWithHttpInfo(String filter) throws ApiException {
        com.squareup.okhttp.Call call = oSPGetValidateBeforeCall(filter, null, null);
        Type localVarReturnType = new TypeToken<List<OSPPrivacyPolicy>>() {
        }.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Perform a search query across the collection of OSP behaviour. (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 oSPGetAsync(String filter, final ApiCallback<List<OSPPrivacyPolicy>> 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 = oSPGetValidateBeforeCall(filter, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<List<OSPPrivacyPolicy>>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }

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

        // create path and map variables
        String localVarPath = "/OSP/{osp-id}/".replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "osp-id" + "\\}", apiClient.escapeString(ospId.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 oSPOspIdGetValidateBeforeCall(String ospId,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {

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

        com.squareup.okhttp.Call call = oSPOspIdGetCall(ospId, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Read a given OSP behaviour policy.
     * Get a specific OSP document via the id. This will return the full OSP document in json format. 
     * @param ospId The identifier number of an OSP (required)
     * @return OSPPrivacyPolicy
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public OSPPrivacyPolicy oSPOspIdGet(String ospId) throws ApiException {
        ApiResponse<OSPPrivacyPolicy> resp = oSPOspIdGetWithHttpInfo(ospId);
        return resp.getData();
    }

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

    /**
     * Read a given OSP behaviour policy. (asynchronously)
     * Get a specific OSP document via the id. This will return the full OSP document in json format. 
     * @param ospId The identifier number of an OSP (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 oSPOspIdGetAsync(String ospId, final ApiCallback<OSPPrivacyPolicy> 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 = oSPOspIdGetValidateBeforeCall(ospId, progressListener,
                progressRequestListener);
        Type localVarReturnType = new TypeToken<OSPPrivacyPolicy>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }

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

        // create path and map variables
        String localVarPath = "/OSP/{osp-id}/privacy-policy/access-reasons".replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "osp-id" + "\\}", apiClient.escapeString(ospId.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 oSPOspIdPrivacyPolicyAccessReasonsGetValidateBeforeCall(String ospId,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {

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

        com.squareup.okhttp.Call call = oSPOspIdPrivacyPolicyAccessReasonsGetCall(ospId, progressListener,
                progressRequestListener);
        return call;

    }

    /**
     * Get the list of access reason policy statements.
     * List of policy statements.  
     * @param ospId The identifier number of an OSP (required)
     * @return List&lt;OSPReasonPolicy&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public List<OSPReasonPolicy> oSPOspIdPrivacyPolicyAccessReasonsGet(String ospId) throws ApiException {
        ApiResponse<List<OSPReasonPolicy>> resp = oSPOspIdPrivacyPolicyAccessReasonsGetWithHttpInfo(ospId);
        return resp.getData();
    }

    /**
     * Get the list of access reason policy statements.
     * List of policy statements.  
     * @param ospId The identifier number of an OSP (required)
     * @return ApiResponse&lt;List&lt;OSPReasonPolicy&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<List<OSPReasonPolicy>> oSPOspIdPrivacyPolicyAccessReasonsGetWithHttpInfo(String ospId)
            throws ApiException {
        com.squareup.okhttp.Call call = oSPOspIdPrivacyPolicyAccessReasonsGetValidateBeforeCall(ospId, null, null);
        Type localVarReturnType = new TypeToken<List<OSPReasonPolicy>>() {
        }.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Get the list of access reason policy statements. (asynchronously)
     * List of policy statements.  
     * @param ospId The identifier number of an OSP (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 oSPOspIdPrivacyPolicyAccessReasonsGetAsync(String ospId,
            final ApiCallback<List<OSPReasonPolicy>> 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 = oSPOspIdPrivacyPolicyAccessReasonsGetValidateBeforeCall(ospId,
                progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<List<OSPReasonPolicy>>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }

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

        // create path and map variables
        String localVarPath = "/OSP/{osp-id}/privacy-policy/".replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "osp-id" + "\\}", apiClient.escapeString(ospId.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 oSPOspIdPrivacyPolicyGetValidateBeforeCall(String ospId,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {

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

        com.squareup.okhttp.Call call = oSPOspIdPrivacyPolicyGetCall(ospId, progressListener,
                progressRequestListener);
        return call;

    }

    /**
     * Get the current set of privacy policy statements about the usage of data for stated reasons.
     * This is a machine readable version of a G2C privacy policy statement entered using the OSP Admin dashboard; and retrieved by both the OSP &amp; PSP analyst dashboard for display purposes and also by the OSE component for checking regulation compliance.  
     * @param ospId The identifier number of an OSP (required)
     * @return OSPReasonPolicy
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public OSPReasonPolicy oSPOspIdPrivacyPolicyGet(String ospId) throws ApiException {
        ApiResponse<OSPReasonPolicy> resp = oSPOspIdPrivacyPolicyGetWithHttpInfo(ospId);
        return resp.getData();
    }

    /**
     * Get the current set of privacy policy statements about the usage of data for stated reasons.
     * This is a machine readable version of a G2C privacy policy statement entered using the OSP Admin dashboard; and retrieved by both the OSP &amp; PSP analyst dashboard for display purposes and also by the OSE component for checking regulation compliance.  
     * @param ospId The identifier number of an OSP (required)
     * @return ApiResponse&lt;OSPReasonPolicy&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<OSPReasonPolicy> oSPOspIdPrivacyPolicyGetWithHttpInfo(String ospId) throws ApiException {
        com.squareup.okhttp.Call call = oSPOspIdPrivacyPolicyGetValidateBeforeCall(ospId, null, null);
        Type localVarReturnType = new TypeToken<OSPReasonPolicy>() {
        }.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Get the current set of privacy policy statements about the usage of data for stated reasons. (asynchronously)
     * This is a machine readable version of a G2C privacy policy statement entered using the OSP Admin dashboard; and retrieved by both the OSP &amp; PSP analyst dashboard for display purposes and also by the OSE component for checking regulation compliance.  
     * @param ospId The identifier number of an OSP (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 oSPOspIdPrivacyPolicyGetAsync(String ospId,
            final ApiCallback<OSPReasonPolicy> 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 = oSPOspIdPrivacyPolicyGetValidateBeforeCall(ospId, progressListener,
                progressRequestListener);
        Type localVarReturnType = new TypeToken<OSPReasonPolicy>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }

    /* 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 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 userPrivacyPolicyGet */
    private com.squareup.okhttp.Call userPrivacyPolicyGetCall(String filter,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/user_privacy_policy/".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 userPrivacyPolicyGetValidateBeforeCall(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 userPrivacyPolicyGet(Async)");
        }

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

    }

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

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

    /**
     * Perform a search query across the collection of UPPs. (asynchronously)
     * The query contains a json object (names, values) and the request returns the list of documents (UPPs) where the filter matches i.e. each 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 userPrivacyPolicyGetAsync(String filter,
            final ApiCallback<List<UserPrivacyPolicy>> 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 = userPrivacyPolicyGetValidateBeforeCall(filter, progressListener,
                progressRequestListener);
        Type localVarReturnType = new TypeToken<List<UserPrivacyPolicy>>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }

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

        // create path and map variables
        String localVarPath = "/user_privacy_policy/{user-id}/".replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "user-id" + "\\}", apiClient.escapeString(userId.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 userPrivacyPolicyUserIdGetValidateBeforeCall(String userId,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {

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

        com.squareup.okhttp.Call call = userPrivacyPolicyUserIdGetCall(userId, progressListener,
                progressRequestListener);
        return call;

    }

    /**
     * Read the user privacy policy for the given user id.
     * Get a specific UPP document via the user&#39;s id. This will return the full user privacy policy document in json format. 
     * @param userId The user identifier number (required)
     * @return UserPrivacyPolicy
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public UserPrivacyPolicy userPrivacyPolicyUserIdGet(String userId) throws ApiException {
        ApiResponse<UserPrivacyPolicy> resp = userPrivacyPolicyUserIdGetWithHttpInfo(userId);
        return resp.getData();
    }

    /**
     * Read the user privacy policy for the given user id.
     * Get a specific UPP document via the user&#39;s id. This will return the full user privacy policy document in json format. 
     * @param userId The user identifier number (required)
     * @return ApiResponse&lt;UserPrivacyPolicy&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<UserPrivacyPolicy> userPrivacyPolicyUserIdGetWithHttpInfo(String userId)
            throws ApiException {
        com.squareup.okhttp.Call call = userPrivacyPolicyUserIdGetValidateBeforeCall(userId, null, null);
        Type localVarReturnType = new TypeToken<UserPrivacyPolicy>() {
        }.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Read the user privacy policy for the given user id. (asynchronously)
     * Get a specific UPP document via the user&#39;s id. This will return the full user privacy policy document in json format. 
     * @param userId The user identifier number (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 userPrivacyPolicyUserIdGetAsync(String userId,
            final ApiCallback<UserPrivacyPolicy> 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 = userPrivacyPolicyUserIdGetValidateBeforeCall(userId, progressListener,
                progressRequestListener);
        Type localVarReturnType = new TypeToken<UserPrivacyPolicy>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
}