/*
 * WSO2 API Manager - Publisher API
 * This specifies a **RESTful API** for WSO2 **API Manager** - Publisher.  Please see [full swagger definition](https://raw.githubusercontent.com/wso2/carbon-apimgt/v6.0.4/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher/src/main/resources/publisher-api.yaml) of the API which is written using [swagger 2.0](http://swagger.io/) specification. 
 *
 * OpenAPI spec version: v1.0
 * Contact: architecture@wso2.com
 *
 * 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 org.wso2.am.integration.clients.publisher.api.v1;

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

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import org.wso2.am.integration.clients.publisher.api.v1.dto.ErrorDTO;
import java.io.File;
import org.wso2.am.integration.clients.publisher.api.v1.dto.MediationDTO;

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

public class ApiMediationPolicyApi {
    private ApiClient apiClient;

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

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

    public ApiClient getApiClient() {
        return apiClient;
    }

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

    /**
     * Build call for apisApiIdMediationPoliciesMediationPolicyIdContentGet
     * @param apiId **API ID** consisting of the **UUID** of the API.  (required)
     * @param mediationPolicyId Mediation policy Id  (required)
     * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resource.  (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call apisApiIdMediationPoliciesMediationPolicyIdContentGetCall(String apiId, String mediationPolicyId, String ifNoneMatch, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/apis/{apiId}/mediation-policies/{mediationPolicyId}/content"
            .replaceAll("\\{" + "apiId" + "\\}", apiClient.escapeString(apiId.toString()))
            .replaceAll("\\{" + "mediationPolicyId" + "\\}", apiClient.escapeString(mediationPolicyId.toString()));

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

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        if (ifNoneMatch != null)
        localVarHeaderParams.put("If-None-Match", apiClient.parameterToString(ifNoneMatch));

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

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

        final String[] localVarContentTypes = {
            "application/json"
        };
        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[] { "OAuth2Security" };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call apisApiIdMediationPoliciesMediationPolicyIdContentGetValidateBeforeCall(String apiId, String mediationPolicyId, String ifNoneMatch, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'apiId' is set
        if (apiId == null) {
            throw new ApiException("Missing the required parameter 'apiId' when calling apisApiIdMediationPoliciesMediationPolicyIdContentGet(Async)");
        }
        
        // verify the required parameter 'mediationPolicyId' is set
        if (mediationPolicyId == null) {
            throw new ApiException("Missing the required parameter 'mediationPolicyId' when calling apisApiIdMediationPoliciesMediationPolicyIdContentGet(Async)");
        }
        

        com.squareup.okhttp.Call call = apisApiIdMediationPoliciesMediationPolicyIdContentGetCall(apiId, mediationPolicyId, ifNoneMatch, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Download an API specific mediation policy
     * This operation can be used to download a particular API specific mediation policy. 
     * @param apiId **API ID** consisting of the **UUID** of the API.  (required)
     * @param mediationPolicyId Mediation policy Id  (required)
     * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resource.  (optional)
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public void apisApiIdMediationPoliciesMediationPolicyIdContentGet(String apiId, String mediationPolicyId, String ifNoneMatch) throws ApiException {
        apisApiIdMediationPoliciesMediationPolicyIdContentGetWithHttpInfo(apiId, mediationPolicyId, ifNoneMatch);
    }

    /**
     * Download an API specific mediation policy
     * This operation can be used to download a particular API specific mediation policy. 
     * @param apiId **API ID** consisting of the **UUID** of the API.  (required)
     * @param mediationPolicyId Mediation policy Id  (required)
     * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resource.  (optional)
     * @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> apisApiIdMediationPoliciesMediationPolicyIdContentGetWithHttpInfo(String apiId, String mediationPolicyId, String ifNoneMatch) throws ApiException {
        com.squareup.okhttp.Call call = apisApiIdMediationPoliciesMediationPolicyIdContentGetValidateBeforeCall(apiId, mediationPolicyId, ifNoneMatch, null, null);
        return apiClient.execute(call);
    }

    /**
     * Download an API specific mediation policy (asynchronously)
     * This operation can be used to download a particular API specific mediation policy. 
     * @param apiId **API ID** consisting of the **UUID** of the API.  (required)
     * @param mediationPolicyId Mediation policy Id  (required)
     * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resource.  (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
     */
    public com.squareup.okhttp.Call apisApiIdMediationPoliciesMediationPolicyIdContentGetAsync(String apiId, String mediationPolicyId, String ifNoneMatch, 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 = apisApiIdMediationPoliciesMediationPolicyIdContentGetValidateBeforeCall(apiId, mediationPolicyId, ifNoneMatch, progressListener, progressRequestListener);
        apiClient.executeAsync(call, callback);
        return call;
    }
    /**
     * Build call for apisApiIdMediationPoliciesMediationPolicyIdContentPut
     * @param type Type of the mediation sequence(in/out/fault) (required)
     * @param apiId **API ID** consisting of the **UUID** of the API.  (required)
     * @param mediationPolicyId Mediation policy Id  (required)
     * @param file Mediation Policy to upload (optional)
     * @param inlineContent Inline content of the Mediation Policy (optional)
     * @param ifMatch Validator for conditional requests; based on ETag.  (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call apisApiIdMediationPoliciesMediationPolicyIdContentPutCall(String type, String apiId, String mediationPolicyId, File file, String inlineContent, String ifMatch, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/apis/{apiId}/mediation-policies/{mediationPolicyId}/content"
            .replaceAll("\\{" + "apiId" + "\\}", apiClient.escapeString(apiId.toString()))
            .replaceAll("\\{" + "mediationPolicyId" + "\\}", apiClient.escapeString(mediationPolicyId.toString()));

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

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        if (ifMatch != null)
        localVarHeaderParams.put("If-Match", apiClient.parameterToString(ifMatch));

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();
        if (file != null)
        localVarFormParams.put("file", file);
        if (inlineContent != null)
        localVarFormParams.put("inlineContent", inlineContent);
        if (type != null)
        localVarFormParams.put("type", type);

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

        final String[] localVarContentTypes = {
            "multipart/form-data"
        };
        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[] { "OAuth2Security" };
        return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call apisApiIdMediationPoliciesMediationPolicyIdContentPutValidateBeforeCall(String type, String apiId, String mediationPolicyId, File file, String inlineContent, String ifMatch, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'type' is set
        if (type == null) {
            throw new ApiException("Missing the required parameter 'type' when calling apisApiIdMediationPoliciesMediationPolicyIdContentPut(Async)");
        }
        
        // verify the required parameter 'apiId' is set
        if (apiId == null) {
            throw new ApiException("Missing the required parameter 'apiId' when calling apisApiIdMediationPoliciesMediationPolicyIdContentPut(Async)");
        }
        
        // verify the required parameter 'mediationPolicyId' is set
        if (mediationPolicyId == null) {
            throw new ApiException("Missing the required parameter 'mediationPolicyId' when calling apisApiIdMediationPoliciesMediationPolicyIdContentPut(Async)");
        }
        

        com.squareup.okhttp.Call call = apisApiIdMediationPoliciesMediationPolicyIdContentPutCall(type, apiId, mediationPolicyId, file, inlineContent, ifMatch, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Update an API specific mediation policy
     * This operation can be used to update an existing mediation policy of an API. 
     * @param type Type of the mediation sequence(in/out/fault) (required)
     * @param apiId **API ID** consisting of the **UUID** of the API.  (required)
     * @param mediationPolicyId Mediation policy Id  (required)
     * @param file Mediation Policy to upload (optional)
     * @param inlineContent Inline content of the Mediation Policy (optional)
     * @param ifMatch Validator for conditional requests; based on ETag.  (optional)
     * @return MediationDTO
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public MediationDTO apisApiIdMediationPoliciesMediationPolicyIdContentPut(String type, String apiId, String mediationPolicyId, File file, String inlineContent, String ifMatch) throws ApiException {
        ApiResponse<MediationDTO> resp = apisApiIdMediationPoliciesMediationPolicyIdContentPutWithHttpInfo(type, apiId, mediationPolicyId, file, inlineContent, ifMatch);
        return resp.getData();
    }

    /**
     * Update an API specific mediation policy
     * This operation can be used to update an existing mediation policy of an API. 
     * @param type Type of the mediation sequence(in/out/fault) (required)
     * @param apiId **API ID** consisting of the **UUID** of the API.  (required)
     * @param mediationPolicyId Mediation policy Id  (required)
     * @param file Mediation Policy to upload (optional)
     * @param inlineContent Inline content of the Mediation Policy (optional)
     * @param ifMatch Validator for conditional requests; based on ETag.  (optional)
     * @return ApiResponse&lt;MediationDTO&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<MediationDTO> apisApiIdMediationPoliciesMediationPolicyIdContentPutWithHttpInfo(String type, String apiId, String mediationPolicyId, File file, String inlineContent, String ifMatch) throws ApiException {
        com.squareup.okhttp.Call call = apisApiIdMediationPoliciesMediationPolicyIdContentPutValidateBeforeCall(type, apiId, mediationPolicyId, file, inlineContent, ifMatch, null, null);
        Type localVarReturnType = new TypeToken<MediationDTO>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Update an API specific mediation policy (asynchronously)
     * This operation can be used to update an existing mediation policy of an API. 
     * @param type Type of the mediation sequence(in/out/fault) (required)
     * @param apiId **API ID** consisting of the **UUID** of the API.  (required)
     * @param mediationPolicyId Mediation policy Id  (required)
     * @param file Mediation Policy to upload (optional)
     * @param inlineContent Inline content of the Mediation Policy (optional)
     * @param ifMatch Validator for conditional requests; based on ETag.  (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
     */
    public com.squareup.okhttp.Call apisApiIdMediationPoliciesMediationPolicyIdContentPutAsync(String type, String apiId, String mediationPolicyId, File file, String inlineContent, String ifMatch, final ApiCallback<MediationDTO> 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 = apisApiIdMediationPoliciesMediationPolicyIdContentPutValidateBeforeCall(type, apiId, mediationPolicyId, file, inlineContent, ifMatch, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<MediationDTO>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for apisApiIdMediationPoliciesMediationPolicyIdDelete
     * @param apiId **API ID** consisting of the **UUID** of the API.  (required)
     * @param mediationPolicyId Mediation policy Id  (required)
     * @param ifMatch Validator for conditional requests; based on ETag.  (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call apisApiIdMediationPoliciesMediationPolicyIdDeleteCall(String apiId, String mediationPolicyId, String ifMatch, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/apis/{apiId}/mediation-policies/{mediationPolicyId}"
            .replaceAll("\\{" + "apiId" + "\\}", apiClient.escapeString(apiId.toString()))
            .replaceAll("\\{" + "mediationPolicyId" + "\\}", apiClient.escapeString(mediationPolicyId.toString()));

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

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        if (ifMatch != null)
        localVarHeaderParams.put("If-Match", apiClient.parameterToString(ifMatch));

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

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

        final String[] localVarContentTypes = {
            "application/json"
        };
        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[] { "OAuth2Security" };
        return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call apisApiIdMediationPoliciesMediationPolicyIdDeleteValidateBeforeCall(String apiId, String mediationPolicyId, String ifMatch, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'apiId' is set
        if (apiId == null) {
            throw new ApiException("Missing the required parameter 'apiId' when calling apisApiIdMediationPoliciesMediationPolicyIdDelete(Async)");
        }
        
        // verify the required parameter 'mediationPolicyId' is set
        if (mediationPolicyId == null) {
            throw new ApiException("Missing the required parameter 'mediationPolicyId' when calling apisApiIdMediationPoliciesMediationPolicyIdDelete(Async)");
        }
        

        com.squareup.okhttp.Call call = apisApiIdMediationPoliciesMediationPolicyIdDeleteCall(apiId, mediationPolicyId, ifMatch, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Delete an API specific mediation policy
     * This operation can be used to delete an existing API specific mediation policy providing the Id of the API and the Id of the mediation policy. 
     * @param apiId **API ID** consisting of the **UUID** of the API.  (required)
     * @param mediationPolicyId Mediation policy Id  (required)
     * @param ifMatch Validator for conditional requests; based on ETag.  (optional)
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public void apisApiIdMediationPoliciesMediationPolicyIdDelete(String apiId, String mediationPolicyId, String ifMatch) throws ApiException {
        apisApiIdMediationPoliciesMediationPolicyIdDeleteWithHttpInfo(apiId, mediationPolicyId, ifMatch);
    }

    /**
     * Delete an API specific mediation policy
     * This operation can be used to delete an existing API specific mediation policy providing the Id of the API and the Id of the mediation policy. 
     * @param apiId **API ID** consisting of the **UUID** of the API.  (required)
     * @param mediationPolicyId Mediation policy Id  (required)
     * @param ifMatch Validator for conditional requests; based on ETag.  (optional)
     * @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> apisApiIdMediationPoliciesMediationPolicyIdDeleteWithHttpInfo(String apiId, String mediationPolicyId, String ifMatch) throws ApiException {
        com.squareup.okhttp.Call call = apisApiIdMediationPoliciesMediationPolicyIdDeleteValidateBeforeCall(apiId, mediationPolicyId, ifMatch, null, null);
        return apiClient.execute(call);
    }

    /**
     * Delete an API specific mediation policy (asynchronously)
     * This operation can be used to delete an existing API specific mediation policy providing the Id of the API and the Id of the mediation policy. 
     * @param apiId **API ID** consisting of the **UUID** of the API.  (required)
     * @param mediationPolicyId Mediation policy Id  (required)
     * @param ifMatch Validator for conditional requests; based on ETag.  (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
     */
    public com.squareup.okhttp.Call apisApiIdMediationPoliciesMediationPolicyIdDeleteAsync(String apiId, String mediationPolicyId, String ifMatch, 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 = apisApiIdMediationPoliciesMediationPolicyIdDeleteValidateBeforeCall(apiId, mediationPolicyId, ifMatch, progressListener, progressRequestListener);
        apiClient.executeAsync(call, callback);
        return call;
    }
    /**
     * Build call for apisApiIdMediationPoliciesMediationPolicyIdGet
     * @param apiId **API ID** consisting of the **UUID** of the API.  (required)
     * @param mediationPolicyId Mediation policy Id  (required)
     * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resource.  (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call apisApiIdMediationPoliciesMediationPolicyIdGetCall(String apiId, String mediationPolicyId, String ifNoneMatch, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/apis/{apiId}/mediation-policies/{mediationPolicyId}"
            .replaceAll("\\{" + "apiId" + "\\}", apiClient.escapeString(apiId.toString()))
            .replaceAll("\\{" + "mediationPolicyId" + "\\}", apiClient.escapeString(mediationPolicyId.toString()));

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

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        if (ifNoneMatch != null)
        localVarHeaderParams.put("If-None-Match", apiClient.parameterToString(ifNoneMatch));

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

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

        final String[] localVarContentTypes = {
            "application/json"
        };
        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[] { "OAuth2Security" };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call apisApiIdMediationPoliciesMediationPolicyIdGetValidateBeforeCall(String apiId, String mediationPolicyId, String ifNoneMatch, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'apiId' is set
        if (apiId == null) {
            throw new ApiException("Missing the required parameter 'apiId' when calling apisApiIdMediationPoliciesMediationPolicyIdGet(Async)");
        }
        
        // verify the required parameter 'mediationPolicyId' is set
        if (mediationPolicyId == null) {
            throw new ApiException("Missing the required parameter 'mediationPolicyId' when calling apisApiIdMediationPoliciesMediationPolicyIdGet(Async)");
        }
        

        com.squareup.okhttp.Call call = apisApiIdMediationPoliciesMediationPolicyIdGetCall(apiId, mediationPolicyId, ifNoneMatch, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Get an API specific mediation policy
     * This operation can be used to retrieve a particular API specific mediation policy. 
     * @param apiId **API ID** consisting of the **UUID** of the API.  (required)
     * @param mediationPolicyId Mediation policy Id  (required)
     * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resource.  (optional)
     * @return MediationDTO
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public MediationDTO apisApiIdMediationPoliciesMediationPolicyIdGet(String apiId, String mediationPolicyId, String ifNoneMatch) throws ApiException {
        ApiResponse<MediationDTO> resp = apisApiIdMediationPoliciesMediationPolicyIdGetWithHttpInfo(apiId, mediationPolicyId, ifNoneMatch);
        return resp.getData();
    }

    /**
     * Get an API specific mediation policy
     * This operation can be used to retrieve a particular API specific mediation policy. 
     * @param apiId **API ID** consisting of the **UUID** of the API.  (required)
     * @param mediationPolicyId Mediation policy Id  (required)
     * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resource.  (optional)
     * @return ApiResponse&lt;MediationDTO&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<MediationDTO> apisApiIdMediationPoliciesMediationPolicyIdGetWithHttpInfo(String apiId, String mediationPolicyId, String ifNoneMatch) throws ApiException {
        com.squareup.okhttp.Call call = apisApiIdMediationPoliciesMediationPolicyIdGetValidateBeforeCall(apiId, mediationPolicyId, ifNoneMatch, null, null);
        Type localVarReturnType = new TypeToken<MediationDTO>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Get an API specific mediation policy (asynchronously)
     * This operation can be used to retrieve a particular API specific mediation policy. 
     * @param apiId **API ID** consisting of the **UUID** of the API.  (required)
     * @param mediationPolicyId Mediation policy Id  (required)
     * @param ifNoneMatch Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resource.  (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
     */
    public com.squareup.okhttp.Call apisApiIdMediationPoliciesMediationPolicyIdGetAsync(String apiId, String mediationPolicyId, String ifNoneMatch, final ApiCallback<MediationDTO> 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 = apisApiIdMediationPoliciesMediationPolicyIdGetValidateBeforeCall(apiId, mediationPolicyId, ifNoneMatch, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<MediationDTO>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
}
